author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:06:50 +0300 | |
branch | RCL_3 |
changeset 71 | d5e927d5853b |
parent 66 | 2455ef1f5bbc |
child 77 | 7cee158cb8cd |
permissions | -rw-r--r-- |
66 | 1 |
/* |
2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: This class implements MMMADisplay |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// Include Files |
|
20 |
#include <jdebug.h> |
|
21 |
||
22 |
#include "cmmadisplay.h" |
|
23 |
#include "mmmadisplaywindow.h" |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
24 |
// below include is added to get the enumerated player's state |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
25 |
#include "cmmaplayer.h" |
66 | 26 |
|
27 |
// Destructor (virtual by CBase) |
|
28 |
CMMADisplay::~CMMADisplay() |
|
29 |
{ |
|
30 |
||
31 |
if (iDirectContainer) |
|
32 |
{ |
|
33 |
// Remove clip rect if set |
|
34 |
if (!iClipRect.IsEmpty()) |
|
35 |
{ |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
36 |
DEBUG_INT2("CMMADisplay::~CMMADisplay(): Removing clip rect iTL = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
37 |
iClipRect.iTl.iX,iClipRect.iTl.iY); |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
38 |
DEBUG_INT2("CMMADisplay::~CMMADisplay(): Removing clip rect iBr = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
39 |
iClipRect.iBr.iX,iClipRect.iBr.iY); |
66 | 40 |
iDirectContainer->MdcRemoveContentBounds(iClipRect); |
41 |
} |
|
42 |
||
43 |
// Remove this object from MDirectContainer |
|
44 |
iDirectContainer->MdcRemoveContent(this); |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
45 |
DEBUG("~CMMADisplay() is done"); |
66 | 46 |
} |
47 |
} |
|
48 |
||
49 |
||
50 |
CMMADisplay::CMMADisplay(): |
|
51 |
iVisible(EFalse), |
|
52 |
iFullScreen(EFalse), |
|
53 |
iContainerVisible(EFalse), |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
54 |
iUserRectSet(EFalse), |
66 | 55 |
iIsForeground(ETrue), |
56 |
iResetDrawRect(EFalse) |
|
57 |
{ |
|
58 |
} |
|
59 |
||
60 |
void CMMADisplay::Construct(MDirectContainer* aDirectContainer) |
|
61 |
{ |
|
62 |
// Components must have direct content. |
|
63 |
__ASSERT_DEBUG(aDirectContainer, User::Invariant()); |
|
64 |
||
65 |
// Not owned |
|
66 |
iDirectContainer = aDirectContainer; |
|
67 |
||
68 |
// Get component visibility. Later visibility changes will |
|
69 |
// be informed through MDirectContent observer. |
|
70 |
iContainerVisible = iDirectContainer->MdcContainerVisibility(); |
|
71 |
DEBUG_INT("MID::CMMADisplay::Construct iContainerVisible = %d", iContainerVisible); |
|
72 |
DEBUG_INT("MID::CMMADisplay::Construct iVisible = %d", iVisible); |
|
73 |
||
74 |
// Add this MDirectContent to the MDirectContainer. Cannot fail. |
|
75 |
iDirectContainer->MdcAddContent(this); |
|
76 |
} |
|
77 |
||
78 |
TRect CMMADisplay::ScaleToFullScreen(const TSize& aFullScreenSize, |
|
79 |
const TSize& aSourceSize) |
|
80 |
{ |
|
81 |
if ((aSourceSize.iWidth == 0) && |
|
82 |
(aSourceSize.iHeight == 0)) |
|
83 |
{ |
|
84 |
// Avoid divide by zero. |
|
85 |
return TRect(); |
|
86 |
} |
|
87 |
||
88 |
// Width or height will be full size. |
|
89 |
TRect drawRect(TPoint(0, 0), |
|
90 |
aFullScreenSize); |
|
91 |
||
92 |
// Smaller dimension scale ratio will be scaled. |
|
93 |
// Changed to area calculation to avoid reals and dimension |
|
94 |
// with smaller area will be scaled. |
|
95 |
TInt vDif((aFullScreenSize.iWidth - aSourceSize.iWidth) |
|
96 |
* aFullScreenSize.iHeight); |
|
97 |
TInt hDif((aFullScreenSize.iHeight - aSourceSize.iHeight) |
|
98 |
* aFullScreenSize.iWidth); |
|
99 |
||
100 |
TPoint position(0, 0); |
|
101 |
||
102 |
// Check which side to scale to fullscreen size. |
|
103 |
if (hDif > vDif) |
|
104 |
{ |
|
105 |
// Width is full screen width. |
|
106 |
// Scale height with aspect ratio. |
|
107 |
drawRect.iBr.iY = aFullScreenSize.iWidth * aSourceSize.iHeight |
|
108 |
/ aSourceSize.iWidth; |
|
109 |
// move rect middle of the screen |
|
110 |
position.iY = (aFullScreenSize.iHeight - drawRect.iBr.iY) / 2; |
|
111 |
} |
|
112 |
else |
|
113 |
{ |
|
114 |
// Height is full screen height. |
|
115 |
// Scale width with aspect ratio. |
|
116 |
drawRect.iBr.iX = aFullScreenSize.iHeight * aSourceSize.iWidth |
|
117 |
/ aSourceSize.iHeight; |
|
118 |
// move rect middle of the screen |
|
119 |
position.iX = (aFullScreenSize.iWidth - drawRect.iBr.iX) / 2; |
|
120 |
} |
|
121 |
||
122 |
drawRect.Move(position); |
|
123 |
return drawRect; |
|
124 |
} |
|
125 |
||
126 |
// from MMMADisplay |
|
127 |
void CMMADisplay::DrawFrameL(const CFbsBitmap* aBitmap) |
|
128 |
{ |
|
129 |
// This method is called only if bitmap is used. |
|
130 |
// Runs in mmapi thread |
|
131 |
if (iVisible && iWindow && iDirectContainer) |
|
132 |
{ |
|
133 |
iWindow->DrawFrameL(aBitmap); |
|
134 |
iDirectContainer->MdcFlushContainer(iWindow->WindowRect()); |
|
135 |
} |
|
136 |
} |
|
137 |
||
138 |
void CMMADisplay::SetClippingRegion() |
|
139 |
{ |
|
140 |
DEBUG("CMMADisplay::SetClippingRegion"); |
|
141 |
||
142 |
if (!iWindow || |
|
143 |
(iWindow->GetDisplayWindowType() == MMMADisplayWindow::EDisplayWindowTypeIsBitmap) || |
|
144 |
iClipRect == iWindow->DrawRect() && iContainerVisible && iVisible) |
|
145 |
{ |
|
146 |
return; |
|
147 |
} |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
148 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
149 |
#ifdef RD_JAVA_NGA_ENABLED |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
150 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
151 |
if(iWindow->IsVideoPlayer() && iWindow->PlayerState() < CMMAPlayer::EPrefetched) |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
152 |
{ |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
153 |
// dont snatch window from UI too early. wait till its PREFETCHED or STARTED |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
154 |
// because UI could be showing some progressive indicator for playback start and that should continue |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
155 |
// at the last possible moment |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
156 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
157 |
return; |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
158 |
} |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
159 |
#endif |
66 | 160 |
TBool refreshScreen(EFalse); |
161 |
// Remove first the current clip rect if set |
|
162 |
if (!iClipRect.IsEmpty()) |
|
163 |
{ |
|
164 |
DEBUG("CMMADisplay::SetClippingRegion: Removing old rect"); |
|
165 |
iDirectContainer->MdcRemoveContentBounds(iClipRect); |
|
166 |
iClipRect.SetRect(0, 0, 0, 0); |
|
167 |
refreshScreen = ETrue; |
|
168 |
} |
|
169 |
// If visible then set a new clip rect |
|
170 |
if (iVisible && iContainerVisible) |
|
171 |
{ |
|
172 |
iClipRect = iWindow->DrawRect(); |
|
173 |
||
174 |
if (!iClipRect.IsEmpty()) |
|
175 |
{ |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
176 |
DEBUG_INT2("CMMADisplay::SetClippingRegion: Adding new rect iTL = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
177 |
iClipRect.iTl.iX,iClipRect.iTl.iY); |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
178 |
DEBUG_INT2("CMMADisplay::SetClippingRegion: Adding new rect iBr = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
179 |
iClipRect.iBr.iX,iClipRect.iBr.iY); |
66 | 180 |
// Add new clipping rect |
181 |
iDirectContainer->MdcAddContentBounds(iClipRect); |
|
182 |
refreshScreen = ETrue; |
|
183 |
} |
|
184 |
} |
|
185 |
if (refreshScreen) |
|
186 |
{ |
|
187 |
// refresh screen |
|
188 |
iDirectContainer->MdcFlushContainer(iWindow->WindowRect()); |
|
189 |
} |
|
190 |
DEBUG("CMMADisplay::SetClippingRegion -"); |
|
191 |
} |
|
192 |
||
193 |
void CMMADisplay::RemoveClippingRegion() |
|
194 |
{ |
|
195 |
// Called in mmapi thread |
|
196 |
DEBUG("CMMADisplay::RemoveClippingRegion"); |
|
197 |
||
198 |
if (!iWindow || |
|
199 |
(iWindow->GetDisplayWindowType() == MMMADisplayWindow::EDisplayWindowTypeIsBitmap)) |
|
200 |
{ |
|
201 |
return; |
|
202 |
} |
|
203 |
// Remove first the current clip rect if set |
|
204 |
if (!iClipRect.IsEmpty()) |
|
205 |
{ |
|
206 |
DEBUG("CMMADisplay::RemoveClippingRegion: Removing old rect"); |
|
207 |
iDirectContainer->MdcRemoveContentBounds(iClipRect); |
|
208 |
iClipRect.SetRect(0, 0, 0, 0); |
|
209 |
// refresh screen |
|
210 |
iDirectContainer->MdcFlushContainer(iWindow->WindowRect()); |
|
211 |
} |
|
212 |
} |
|
213 |
||
214 |
void CMMADisplay::AddClippingRegion() |
|
215 |
{ |
|
216 |
// Called in mmapi thread |
|
217 |
DEBUG("CMMADisplay::AddClippingRegion"); |
|
218 |
||
219 |
if (!iWindow || |
|
220 |
(iWindow->GetDisplayWindowType() == |
|
221 |
MMMADisplayWindow::EDisplayWindowTypeIsBitmap) || |
|
222 |
iClipRect == iWindow->DrawRect()) |
|
223 |
{ |
|
224 |
return; |
|
225 |
} |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
226 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
227 |
#ifdef RD_JAVA_NGA_ENABLED |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
228 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
229 |
if(iWindow->IsVideoPlayer() && iWindow->PlayerState() < CMMAPlayer::EPrefetched) |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
230 |
{ |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
231 |
// dont snatch window from UI too early. wait till its PREFETCHED or STARTED |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
232 |
// because UI could be showing some progressive indicator for playback start and that should continue |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
233 |
// at the last possible moment |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
234 |
return; |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
235 |
} |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
236 |
#endif |
66 | 237 |
// If visible then set a new clip rect |
238 |
if (iVisible) |
|
239 |
{ |
|
240 |
iClipRect = iWindow->DrawRect(); |
|
241 |
||
242 |
if (!iClipRect.IsEmpty()) |
|
243 |
{ |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
244 |
DEBUG_INT2("CMMADisplay::AddClippingRegion: Adding new rect iTL = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
245 |
iClipRect.iTl.iX,iClipRect.iTl.iY); |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
246 |
DEBUG_INT2("CMMADisplay::AddClippingRegion: Adding new rect iBr = %d X %d", |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
247 |
iClipRect.iBr.iX,iClipRect.iBr.iY); |
66 | 248 |
// Add new clipping rect |
249 |
iDirectContainer->MdcAddContentBounds(iClipRect); |
|
250 |
// refresh screen |
|
251 |
iDirectContainer->MdcFlushContainer( |
|
252 |
iWindow->WindowRect()); |
|
253 |
} |
|
254 |
} |
|
255 |
} |
|
256 |
||
257 |
// from MMMADisplay |
|
258 |
TSize CMMADisplay::DisplaySize() |
|
259 |
{ |
|
260 |
if (iWindow && iFullScreen) |
|
261 |
{ |
|
262 |
return iWindow->DrawRect().Size(); |
|
263 |
} |
|
264 |
else |
|
265 |
{ |
|
266 |
return iUserRect.Size(); |
|
267 |
} |
|
268 |
} |
|
269 |
||
270 |
// from MMMADisplay |
|
271 |
void CMMADisplay::SetDisplaySizeL(const TSize& aSize) |
|
272 |
{ |
|
273 |
// user rect contains size set from java. |
|
274 |
iUserRect.SetSize(aSize); |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
275 |
UserRectSet(); |
66 | 276 |
// Size change has no effect if fullscreen mode is on. |
277 |
// New size could be used when fullscreen is turned off. |
|
278 |
if (iContainerVisible && !iFullScreen && iWindow) |
|
279 |
{ |
|
280 |
RemoveClippingRegion(); |
|
281 |
iWindow->SetDrawRect(iUserRect); |
|
282 |
AddClippingRegion(); |
|
283 |
} |
|
284 |
else |
|
285 |
{ |
|
286 |
iResetDrawRect = ETrue; |
|
287 |
} |
|
288 |
} |
|
289 |
||
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
290 |
void CMMADisplay::UserRectSet() |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
291 |
{ |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
292 |
if(!IsUserRectSet()) |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
293 |
iUserRectSet = ETrue; |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
294 |
} |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
295 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
296 |
TBool CMMADisplay::IsUserRectSet() |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
297 |
{ |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
298 |
return iUserRectSet; |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
299 |
} |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
300 |
|
66 | 301 |
// from MMMADisplay |
302 |
void CMMADisplay::SetVisible(TBool aValue) |
|
303 |
{ |
|
304 |
iVisible = aValue; |
|
305 |
// Window may be set visible only if container is on screen, |
|
306 |
||
307 |
DEBUG_INT("MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible); |
|
308 |
DEBUG_INT("MID::CMMADisplay::SetVisible iVisible = %d", iVisible); |
|
309 |
||
310 |
if (!iIsForeground) |
|
311 |
{ |
|
312 |
DEBUG("MID::CMMADisplay::SetVisible - iIsForeground = 0"); |
|
313 |
return; |
|
314 |
} |
|
315 |
// if not it can not be set visible. |
|
316 |
if (iWindow && iContainerVisible) |
|
317 |
{ |
|
318 |
iWindow->SetVisible(aValue, EFalse); |
|
319 |
SetClippingRegion(); |
|
320 |
} |
|
321 |
} |
|
322 |
||
323 |
// from MMMADisplay |
|
324 |
void CMMADisplay::SetWindowL(MMMADisplayWindow* aWindow) |
|
325 |
{ |
|
326 |
// Sets new window. Ownership is not transferred. |
|
327 |
iWindow = aWindow; |
|
328 |
} |
|
329 |
||
330 |
// from MMMADisplay |
|
331 |
MMMADisplayWindow* CMMADisplay::Window() |
|
332 |
{ |
|
333 |
return iWindow; |
|
334 |
} |
|
335 |
||
336 |
TBool CMMADisplay::IsVisible() |
|
337 |
{ |
|
338 |
DEBUG_INT("MID::CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible); |
|
339 |
DEBUG_INT("MID::CMMADisplay::IsVisible iVisible = %d", iVisible); |
|
340 |
// display is visible if container is on screen and |
|
341 |
// java side has set it visible |
|
342 |
return iVisible && iContainerVisible; |
|
343 |
} |
|
344 |
||
345 |
TBool CMMADisplay::IsFullScreen() |
|
346 |
{ |
|
347 |
return iFullScreen; |
|
348 |
} |
|
349 |
||
350 |
TBool CMMADisplay::HasContainer() |
|
351 |
{ |
|
352 |
return iDirectContainer != NULL; |
|
353 |
} |
|
354 |
||
355 |
void CMMADisplay::MdcContainerVisibilityChanged(TBool aVisible) |
|
356 |
{ |
|
357 |
DEBUG_INT("MID::CMMADisplay::MdcContainerVisibilityChanged aVisible = %d", |
|
358 |
aVisible); |
|
359 |
if (!iIsForeground && aVisible) |
|
360 |
{ |
|
361 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged Condition 1 "); |
|
362 |
return; |
|
363 |
} |
|
364 |
||
365 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged After condition1"); |
|
366 |
||
367 |
iContainerVisible = aVisible; |
|
368 |
||
369 |
if (iWindow) |
|
370 |
{ |
|
371 |
// midlet comes to foreground (0 to 1 transition), |
|
372 |
// Allow turn on or turn off based on aVisible |
|
373 |
if (aVisible != iWindow->IsVisible()) |
|
374 |
{ |
|
375 |
// Allow |
|
376 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged Allow "); |
|
377 |
} |
|
378 |
else //if( iContainerVisible == aVisible ) |
|
379 |
{ |
|
380 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible "); |
|
381 |
// if state is not changed, we do not need to do it again |
|
382 |
return; |
|
383 |
} |
|
384 |
} |
|
385 |
||
386 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged After condition2"); |
|
387 |
||
388 |
if (iWindow) |
|
389 |
{ |
|
390 |
DEBUG("MID::CMMADisplay::MdcContainerVisibilityChanged iWindow is valid "); |
|
391 |
// change is only needed if java side has set display visible or |
|
392 |
// if container loses focus |
|
393 |
if (!iContainerVisible || iVisible) |
|
394 |
{ |
|
395 |
if (iResetDrawRect && aVisible && !iFullScreen) |
|
396 |
{ |
|
397 |
iWindow->SetDrawRectThread(iUserRect); |
|
398 |
iResetDrawRect = EFalse; |
|
399 |
} |
|
400 |
if (iIsForeground) |
|
401 |
{ |
|
402 |
iWindow->SetVisible(aVisible); |
|
403 |
} |
|
404 |
SetClippingRegion(); |
|
405 |
} |
|
406 |
} |
|
407 |
} |
|
408 |
||
409 |
void CMMADisplay::MdcItemContentRectChanged(const TRect& /*aContentRect*/, |
|
410 |
const TRect& /*aScreenRect*/) |
|
411 |
{ |
|
412 |
// To be overwritten if used |
|
413 |
__ASSERT_DEBUG(EFalse, User::Invariant()); |
|
414 |
} |
|
415 |
||
416 |
void CMMADisplay::MdcContainerWindowRectChanged(const TRect& |
|
417 |
#ifdef RD_JAVA_NGA_ENABLED |
|
418 |
aRect |
|
419 |
#endif |
|
420 |
) |
|
421 |
{ |
|
422 |
DEBUG("CMMADisplay::MdcContainerWindowRectChanged +"); |
|
423 |
||
424 |
#ifdef RD_JAVA_NGA_ENABLED |
|
425 |
if (iWindow) |
|
426 |
{ |
|
427 |
DEBUG("CMMADisplay::MdcContainerWindowRectChanged, SetRWindowRect"); |
|
428 |
iWindow->SetRWindowRect(aRect, MMMADisplay::EUiThread); |
|
429 |
} |
|
430 |
#endif |
|
431 |
} |
|
432 |
void CMMADisplay::MdcContainerDestroyed() |
|
433 |
{ |
|
434 |
DEBUG("MMA::CMMADisplay::MdcContainerDestroyed"); |
|
435 |
||
436 |
if (iWindow) |
|
437 |
{ |
|
438 |
iWindow->ContainerDestroyed(); |
|
439 |
} |
|
440 |
||
441 |
iDirectContainer = NULL; |
|
442 |
} |
|
443 |
||
444 |
||
445 |
void CMMADisplay::SetForeground(TBool aForeground, TBool aUseEventServer) |
|
446 |
{ |
|
447 |
DEBUG_INT("MMA::CMMADisplay::SetForeground %d", aForeground); |
|
448 |
iIsForeground = aForeground; |
|
449 |
||
450 |
if (aForeground) |
|
451 |
{ |
|
452 |
if (iContainerVisible && !iWindow->IsVisible()) |
|
453 |
{ |
|
454 |
iWindow->SetVisible(ETrue, aUseEventServer); |
|
455 |
} |
|
456 |
} |
|
457 |
else |
|
458 |
{ |
|
459 |
if (iWindow->IsVisible()) |
|
460 |
{ |
|
461 |
iWindow->SetVisible(EFalse, aUseEventServer); |
|
462 |
} |
|
463 |
} |
|
464 |
} |
|
465 |
||
466 |
void CMMADisplay::MdcAbortDSA() |
|
467 |
{ |
|
468 |
if (iWindow) |
|
469 |
{ |
|
470 |
iWindow->AbortDSA(); |
|
471 |
} |
|
472 |
} |
|
473 |
||
474 |
||
475 |
void CMMADisplay::MdcResumeDSA() |
|
476 |
{ |
|
477 |
if (iWindow) |
|
478 |
{ |
|
479 |
iWindow->ResumeDSA(); |
|
480 |
} |
|
481 |
} |
|
482 |
||
483 |
||
484 |
void CMMADisplay::UIGetDSAResources( |
|
485 |
MUiEventConsumer& aConsumer, |
|
486 |
MMMADisplay::TThreadType /* aThreadType */) |
|
487 |
{ |
|
488 |
if (iDirectContainer) |
|
489 |
{ |
|
490 |
iDirectContainer->MdcGetDSAResources(aConsumer); |
|
491 |
} |
|
492 |
} |
|
493 |
||
494 |
void CMMADisplay::UIGetCallback( |
|
495 |
MUiEventConsumer& aConsumer, |
|
496 |
TInt aCallbackId) |
|
497 |
{ |
|
498 |
if (iDirectContainer) |
|
499 |
{ |
|
500 |
iDirectContainer->MdcGetUICallback(aConsumer, aCallbackId); |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
void CMMADisplay::FixUIOrientation(TBool aFix) |
|
505 |
{ |
|
506 |
if (iDirectContainer) |
|
507 |
{ |
|
508 |
iDirectContainer->MdcFixUIOrientation(aFix); |
|
509 |
} |
|
510 |
} |
|
511 |
||
512 |
// END OF FILE |