author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:23:59 +0300 | |
branch | RCL_3 |
changeset 83 | 26b2b12093af |
parent 66 | 2455ef1f5bbc |
permissions | -rw-r--r-- |
66 | 1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. This program and the accompanying materials |
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|
5 |
* which accompanies this distribution, and is available at |
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
|
7 |
* |
|
8 |
* Contributors: |
|
9 |
* Nokia Corporation - S60 implementation |
|
10 |
*******************************************************************************/ |
|
11 |
||
12 |
||
13 |
#include <bautils.h> |
|
14 |
#include <eikon.hrh> |
|
15 |
#include <eikbtgpc.h> |
|
16 |
#include <eikenv.h> |
|
17 |
#include <avkon.rsg> |
|
18 |
#include <aknenv.h> |
|
19 |
#include <akncontext.h> |
|
20 |
#include <akntitle.h> |
|
21 |
#include <aknnavide.h> |
|
22 |
#include <AknsUtils.h> |
|
23 |
#include <eswtcore.rsg> |
|
24 |
#include <AknUtils.h> |
|
25 |
#include <AknsDrawUtils.h> |
|
26 |
#include <AknTextDecorationMetrics.h> |
|
27 |
#include <layoutmetadata.cdl.h> |
|
28 |
#ifdef RD_JAVA_S60_RELEASE_9_2 |
|
29 |
#include <AknPriv.hrh> |
|
30 |
#include <aknappui.h> |
|
31 |
#endif |
|
32 |
#include <coreuiavkoneswt.h> |
|
33 |
#include <swtlaffacade.h> |
|
34 |
#include "eswtmobileextensions.h" |
|
35 |
#include "eswtwidgetsexpanded.h" |
|
36 |
#include "swtcontrolhelper.h" |
|
37 |
#include "swtmessagebox.h" |
|
38 |
#include "swtuiutils.h" |
|
39 |
#include "swtbrowser.h" |
|
40 |
#include "swtdisplaybase.h" |
|
41 |
||
42 |
_LIT(KSeparator, "-"); |
|
43 |
const TInt KVariationFullScreen = 3; |
|
44 |
||
45 |
// ======== MEMBER FUNCTIONS ======== |
|
46 |
||
47 |
||
48 |
// --------------------------------------------------------------------------- |
|
49 |
// CSwtUiUtils::NewL |
|
50 |
// --------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
CSwtUiUtils* CSwtUiUtils::NewL(MSwtDisplay& aDisplay) |
|
53 |
{ |
|
54 |
CSwtUiUtils* self = new(ELeave) CSwtUiUtils(aDisplay); |
|
55 |
CleanupStack::PushL(self); |
|
56 |
self->ConstructL(); |
|
57 |
CleanupStack::Pop(self); |
|
58 |
return self; |
|
59 |
} |
|
60 |
||
61 |
// --------------------------------------------------------------------------- |
|
62 |
// CSwtUiUtils::~CSwtUiUtils |
|
63 |
// --------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
CSwtUiUtils::~CSwtUiUtils() |
|
66 |
{ |
|
67 |
ASSERT(iShells.Count() == 0); |
|
68 |
iShells.Close(); |
|
69 |
||
70 |
delete iCba; |
|
71 |
iCba = NULL; |
|
72 |
||
73 |
iStatusPane = NULL; |
|
74 |
||
75 |
delete iNaviDecorator; |
|
76 |
iNaviDecorator = NULL; |
|
77 |
||
78 |
iActiveShell = NULL; |
|
79 |
iNextActiveShell = NULL; |
|
80 |
iNextFocusedControl = NULL; |
|
81 |
||
82 |
if (iAppName) |
|
83 |
{ |
|
84 |
delete iAppName; |
|
85 |
iAppName = NULL; |
|
86 |
} |
|
87 |
||
88 |
if (iBrowserGarbage) |
|
89 |
{ |
|
90 |
iBrowserGarbage->Control()->Destroy(); |
|
91 |
iBrowserEngineLib.Close(); |
|
92 |
} |
|
93 |
if (iBrowserShellGarbage) |
|
94 |
{ |
|
95 |
iBrowserShellGarbage->Control()->Destroy(); |
|
96 |
} |
|
97 |
} |
|
98 |
||
99 |
// --------------------------------------------------------------------------- |
|
100 |
// CSwtUiUtils::RegisterShellL |
|
101 |
// --------------------------------------------------------------------------- |
|
102 |
// |
|
103 |
void CSwtUiUtils::RegisterShellL(MSwtShell& aShell) |
|
104 |
{ |
|
105 |
ASSERT(iShells.Find(&aShell) == KErrNotFound); |
|
106 |
ASSERT(!CanBeActive(aShell)); // strict check |
|
107 |
User::LeaveIfError(iShells.Append(&aShell)); |
|
108 |
aShell.Control()->HideSilently(); |
|
109 |
} |
|
110 |
||
111 |
// --------------------------------------------------------------------------- |
|
112 |
// CSwtUiUtils::UnregisterShell |
|
113 |
// --------------------------------------------------------------------------- |
|
114 |
// |
|
115 |
void CSwtUiUtils::UnregisterShell(MSwtShell& aShell) |
|
116 |
{ |
|
117 |
TInt index = iShells.Find(&aShell); |
|
118 |
if (index == KErrNotFound) |
|
119 |
{ |
|
120 |
return; |
|
121 |
} |
|
122 |
iShells.Remove(index); |
|
123 |
||
124 |
// If the application has focus and the unregistered shell was |
|
125 |
// active, find a new active shell. If the application is out of |
|
126 |
// focus, and this was the next shell to become active, clear it. |
|
127 |
// A new active shell will be searched when focus is gained. |
|
128 |
if (iFocusLost) |
|
129 |
{ |
|
130 |
if (iNextActiveShell == &aShell) |
|
131 |
{ |
|
132 |
iNextActiveShell = NULL; |
|
133 |
} |
|
134 |
} |
|
135 |
else |
|
136 |
{ |
|
137 |
if (iActiveShell == &aShell) |
|
138 |
{ |
|
139 |
SetShellFade(iActiveShell, EFalse); |
|
140 |
iActiveShell = NULL; |
|
141 |
FindAndActivateShell(); |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
145 |
||
146 |
// --------------------------------------------------------------------------- |
|
147 |
// CSwtUiUtils::SetActiveShell |
|
148 |
// --------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
TBool CSwtUiUtils::SetActiveShell(MSwtShell& aShell, TBool aSetFocus) |
|
151 |
{ |
|
152 |
if (iActiveShell == &aShell) |
|
153 |
{ |
|
154 |
return ETrue; |
|
155 |
} |
|
156 |
||
157 |
if (CanBeActive(aShell)) // strict check |
|
158 |
{ |
|
159 |
if (iFocusLost) |
|
160 |
{ |
|
161 |
// Application out of focus, remember the next active shell. |
|
162 |
iNextActiveShell = &aShell; |
|
163 |
return EFalse; |
|
164 |
} |
|
165 |
else |
|
166 |
{ |
|
167 |
// Application in focus, let the shell be active. |
|
168 |
DoSetActiveShell(aShell, aSetFocus); |
|
169 |
return ETrue; |
|
170 |
} |
|
171 |
} |
|
172 |
||
173 |
return EFalse; |
|
174 |
} |
|
175 |
||
176 |
// --------------------------------------------------------------------------- |
|
177 |
// CSwtUiUtils::CanBeActive |
|
178 |
// --------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
TBool CSwtUiUtils::CanBeActive(MSwtShell& aShell, TBool aStrictCheck /*=ETrue*/) const |
|
181 |
{ |
|
182 |
MSwtControl& ctrl = *aShell.Control(); |
|
183 |
||
184 |
// Must not have the NO_TRIM style (see 11.4.11 of Steve Northover's book on SWT) |
|
185 |
if (ctrl.Style() & KSwtStyleNoTrim) |
|
186 |
{ |
|
187 |
return EFalse; |
|
188 |
} |
|
189 |
||
190 |
// Must be visible and enabled |
|
191 |
CCoeControl& coeCtrl = ctrl.CoeControl(); |
|
192 |
if (!coeCtrl.IsVisible() || coeCtrl.IsDimmed()) |
|
193 |
{ |
|
194 |
return EFalse; |
|
195 |
} |
|
196 |
||
197 |
// If the new shell is modal or the parent of the new shell is the current |
|
198 |
// active modal shell then the new shell can still become active |
|
199 |
if (aStrictCheck && iActiveShell && IsApplicationModal(*iActiveShell)) |
|
200 |
{ |
|
201 |
if (!IsApplicationModal(aShell)) |
|
202 |
{ |
|
203 |
if (!aShell.Control()->IsDescentOf(*iActiveShell->Control())) |
|
204 |
{ |
|
205 |
return EFalse; |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
||
210 |
// Same as above, while in background |
|
211 |
if (iFocusLost && aStrictCheck && iNextActiveShell && IsApplicationModal(*iNextActiveShell)) |
|
212 |
{ |
|
213 |
if (!IsApplicationModal(aShell)) |
|
214 |
{ |
|
215 |
if (!aShell.Control()->IsDescentOf(*iNextActiveShell->Control())) |
|
216 |
{ |
|
217 |
return EFalse; |
|
218 |
} |
|
219 |
} |
|
220 |
} |
|
221 |
||
222 |
return ETrue; |
|
223 |
} |
|
224 |
||
225 |
// --------------------------------------------------------------------------- |
|
226 |
// CSwtUiUtils::CanBeTopMost |
|
227 |
// --------------------------------------------------------------------------- |
|
228 |
// |
|
229 |
TBool CSwtUiUtils::CanBeTopMost(MSwtShell& aShell) const |
|
230 |
{ |
|
231 |
MSwtControl& ctrl = *aShell.Control(); |
|
232 |
||
233 |
// Must be visible and enabled |
|
234 |
CCoeControl& coeCtrl = ctrl.CoeControl(); |
|
235 |
if (!coeCtrl.IsVisible()) |
|
236 |
{ |
|
237 |
return EFalse; |
|
238 |
} |
|
239 |
||
240 |
return ETrue; |
|
241 |
} |
|
242 |
||
243 |
// --------------------------------------------------------------------------- |
|
244 |
// CSwtUiUtils::ShellActivabilityChanged |
|
245 |
// Called from CSwtShell::MakeVisible and CSwtShell::SetDimmed |
|
246 |
// --------------------------------------------------------------------------- |
|
247 |
// |
|
248 |
void CSwtUiUtils::ShellActivabilityChanged(MSwtShell& aShell) |
|
249 |
{ |
|
250 |
// Use the next active shell during no focus. |
|
251 |
MSwtShell* activeShell = NULL; |
|
252 |
if (iFocusLost) |
|
253 |
{ |
|
254 |
activeShell = iNextActiveShell; |
|
255 |
} |
|
256 |
else |
|
257 |
{ |
|
258 |
activeShell = iActiveShell; |
|
259 |
} |
|
260 |
||
261 |
// 1. Activate Shell |
|
262 |
// The new shell can become active if no shell was previously active |
|
263 |
// or if it is modal. This, only when setVisible() or setEnabled() |
|
264 |
// is called. If setActive() is called and the shell can become |
|
265 |
// active it will be set active anyway. |
|
266 |
if (CanBeActive(aShell)) // strict check |
|
267 |
{ |
|
268 |
if (activeShell == &aShell) |
|
269 |
{ |
|
270 |
return; |
|
271 |
} |
|
272 |
||
273 |
if (!activeShell || IsApplicationModal(aShell)) |
|
274 |
{ |
|
275 |
if (iFocusLost) |
|
276 |
{ |
|
277 |
iNextActiveShell = &aShell; |
|
278 |
} |
|
279 |
else |
|
280 |
{ |
|
281 |
DoSetActiveShell(aShell, ETrue); |
|
282 |
} |
|
283 |
return; |
|
284 |
} |
|
285 |
} |
|
286 |
||
287 |
// 2. Show Shell if it is a parent or a child of the currently active shell |
|
288 |
if (activeShell && activeShell != &aShell && aShell.Control()->CoeControl().IsVisible()) |
|
289 |
{ |
|
290 |
if (activeShell->Control()->IsDescentOf(*aShell.Control())) |
|
291 |
{ |
|
292 |
// The active shell is a child of aShell |
|
293 |
MoveToEndOfQueue(aShell); |
|
294 |
MoveToEndOfQueue(*activeShell); |
|
295 |
aShell.Control()->ShowSilently(); |
|
296 |
if (!aShell.GetParentShell() && iLastTopMostShell && iLastTopMostShell != &aShell) |
|
297 |
{ |
|
298 |
iLastTopMostShell->Control()->HideSilently(); |
|
299 |
// No need to remember the top most Shell till next activity change |
|
300 |
iLastTopMostShell = NULL; |
|
301 |
} |
|
302 |
TRAP_IGNORE(UpdateStatusPaneL()); |
|
303 |
return; |
|
304 |
} |
|
305 |
if (aShell.Control()->IsDescentOf(*activeShell->Control())) |
|
306 |
{ |
|
307 |
// The active shell is parent of aShell |
|
308 |
// The queue sorting is not important for child Shells. |
|
309 |
aShell.Control()->ShowSilently(); |
|
310 |
return; |
|
311 |
} |
|
312 |
} |
|
313 |
||
314 |
// 3. Pick new active Shell if the active shell cannot be active anymore. |
|
315 |
// If the application is out of focus, let another shell become active |
|
316 |
// when focus is regained, otherwise deactivate and find new shell. |
|
317 |
if (activeShell == &aShell) |
|
318 |
{ |
|
319 |
if (iFocusLost) |
|
320 |
{ |
|
321 |
iNextActiveShell = NULL; |
|
322 |
} |
|
323 |
else |
|
324 |
{ |
|
325 |
// Ancestors have priority in becoming active |
|
326 |
MSwtShell* parent = activeShell->GetParentShell(); |
|
327 |
while (parent) |
|
328 |
{ |
|
329 |
if (CanBeActive(*parent, EFalse)) // loose check |
|
330 |
{ |
|
331 |
DoSetActiveShell(*parent, ETrue); |
|
332 |
break; |
|
333 |
} |
|
334 |
parent = parent->GetParentShell(); |
|
335 |
} |
|
336 |
if (!parent) |
|
337 |
{ |
|
338 |
if (!FindAndActivateShell()) |
|
339 |
{ |
|
340 |
// Lost the last activateable Shell. |
|
341 |
activeShell->ActivityChanged(EFalse, ETrue); |
|
342 |
SetShellFade(activeShell, EFalse); |
|
343 |
iActiveShell = NULL; |
|
344 |
TRAP_IGNORE(UpdateStatusPaneL()); |
|
345 |
} |
|
346 |
} |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
// 4. Top Shells loosing ability of being topmost |
|
351 |
if (iLastTopMostShell && iLastTopMostShell == &aShell && !CanBeTopMost(aShell)) |
|
352 |
{ |
|
353 |
iLastTopMostShell = NULL; |
|
354 |
TRAP_IGNORE(UpdateStatusPaneL()); |
|
355 |
} |
|
356 |
} |
|
357 |
||
358 |
// --------------------------------------------------------------------------- |
|
359 |
// CSwtUiUtils::SetNextFocusedControl |
|
360 |
// --------------------------------------------------------------------------- |
|
361 |
// |
|
362 |
void CSwtUiUtils::SetNextFocusedControl(MSwtControl* aNextFocusedControl) |
|
363 |
{ |
|
364 |
iNextFocusedControl = aNextFocusedControl; |
|
365 |
} |
|
366 |
||
367 |
// --------------------------------------------------------------------------- |
|
368 |
// CSwtUiUtils::NextFocusedControl |
|
369 |
// --------------------------------------------------------------------------- |
|
370 |
// |
|
371 |
MSwtControl* CSwtUiUtils::NextFocusedControl() |
|
372 |
{ |
|
373 |
return iNextFocusedControl; |
|
374 |
} |
|
375 |
||
376 |
// --------------------------------------------------------------------------- |
|
377 |
// CSwtUiUtils::ChangeAppFocus |
|
378 |
// --------------------------------------------------------------------------- |
|
379 |
// |
|
380 |
void CSwtUiUtils::ChangeAppFocus(MSwtShell& aShell, TBool aForeground) |
|
381 |
{ |
|
382 |
CCoeEnv* coeEnv = iDisplay.CoeEnv(); |
|
383 |
TApaTask task(coeEnv->WsSession()); |
|
384 |
task.SetWgId(coeEnv->RootWin().Identifier()); |
|
385 |
if (aForeground) |
|
386 |
{ |
|
387 |
iNextActiveShell = &aShell; |
|
388 |
task.BringToForeground(); |
|
389 |
} |
|
390 |
else |
|
391 |
{ |
|
392 |
task.SendToBackground(); |
|
393 |
} |
|
394 |
} |
|
395 |
||
396 |
// --------------------------------------------------------------------------- |
|
397 |
// CSwtUiUtils::BrowserDllEntry |
|
398 |
// --------------------------------------------------------------------------- |
|
399 |
// |
|
400 |
TLibraryFunction CSwtUiUtils::BrowserDllEntryL() |
|
401 |
{ |
|
402 |
if (iBrowserDllEntry != NULL) |
|
403 |
{ |
|
404 |
return iBrowserDllEntry; |
|
405 |
} |
|
406 |
if (KErrNone != iBrowserEngineLib.Load(_L("BrowserEngine.dll"))) |
|
407 |
{ |
|
408 |
User::Leave(KErrNoMemory); |
|
409 |
} |
|
410 |
#ifdef __WINS__ |
|
411 |
iBrowserDllEntry = iBrowserEngineLib.Lookup(10); |
|
412 |
#else |
|
413 |
iBrowserDllEntry = iBrowserEngineLib.Lookup(1); |
|
414 |
#endif |
|
415 |
return iBrowserDllEntry; |
|
416 |
} |
|
417 |
||
418 |
// --------------------------------------------------------------------------- |
|
419 |
// CSwtUiUtils::ActiveBrowserCount |
|
420 |
// --------------------------------------------------------------------------- |
|
421 |
// |
|
422 |
TInt CSwtUiUtils::ActiveBrowserCount() const |
|
423 |
{ |
|
424 |
return iCurrentBrowserCount; |
|
425 |
} |
|
426 |
||
427 |
// --------------------------------------------------------------------------- |
|
428 |
// CSwtUiUtils::RegisterBrowser |
|
429 |
// --------------------------------------------------------------------------- |
|
430 |
// |
|
431 |
void CSwtUiUtils::NotifyNewBrowserCreated() |
|
432 |
{ |
|
433 |
if (iBrowserGarbage) |
|
434 |
{ |
|
435 |
iBrowserGarbage->Control()->Destroy(); |
|
436 |
iBrowserGarbage = NULL; |
|
437 |
if (iShellGarbageCollectionRequested && iBrowserShellGarbage) |
|
438 |
{ |
|
439 |
// There was request to destroy previous browser's shell, |
|
440 |
// so we destroy it now, when browser is gone |
|
441 |
iBrowserShellGarbage->Control()->Destroy(); |
|
442 |
iShellGarbageCollectionRequested = EFalse; |
|
443 |
iBrowserShellGarbage = NULL; |
|
444 |
} |
|
445 |
else |
|
446 |
{ |
|
447 |
// Old garbage shell was not requested to destroy, so there |
|
448 |
// will be new garbage when current browser is being destroyed. |
|
449 |
iBrowserShellGarbage = NULL; |
|
450 |
} |
|
451 |
} |
|
452 |
iCurrentBrowserCount++; |
|
453 |
} |
|
454 |
||
455 |
// --------------------------------------------------------------------------- |
|
456 |
// CSwtUiUtils::GarbageCollect |
|
457 |
// --------------------------------------------------------------------------- |
|
458 |
// |
|
459 |
void CSwtUiUtils::GarbageCollect(MSwtBrowser& aBrowser) |
|
460 |
{ |
|
461 |
if (!iBrowserGarbage) |
|
462 |
{ |
|
463 |
// Collect browser |
|
464 |
iBrowserGarbage = &aBrowser; |
|
465 |
iBrowserShellGarbage = &aBrowser.Control()->GetShell(); |
|
466 |
iShellGarbageCollectionRequested = EFalse; |
|
467 |
} |
|
468 |
iCurrentBrowserCount--; |
|
469 |
} |
|
470 |
||
471 |
// --------------------------------------------------------------------------- |
|
472 |
// CSwtUiUtils::GarbageCollect |
|
473 |
// --------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
void CSwtUiUtils::GarbageCollect(MSwtShell& aShell) |
|
476 |
{ |
|
477 |
if (&aShell != iBrowserShellGarbage) |
|
478 |
{ |
|
479 |
aShell.Control()->Destroy(); |
|
480 |
} |
|
481 |
else |
|
482 |
{ |
|
483 |
aShell.Control()->CoeControl().MakeVisible(EFalse); |
|
484 |
iShellGarbageCollectionRequested = ETrue; |
|
485 |
} |
|
486 |
} |
|
487 |
||
488 |
// --------------------------------------------------------------------------- |
|
489 |
// CSwtUiUtils::CSwtUiUtils |
|
490 |
// --------------------------------------------------------------------------- |
|
491 |
// |
|
492 |
CSwtUiUtils::CSwtUiUtils(MSwtDisplay& aDisplay) |
|
493 |
: iDisplay(aDisplay) |
|
494 |
, iFocusLost(EFalse) |
|
495 |
, iCurrentBrowserCount(0) |
|
496 |
, iBrowserGarbage(NULL) |
|
497 |
, iBrowserShellGarbage(NULL) |
|
498 |
, iShellGarbageCollectionRequested(EFalse) |
|
499 |
, iScrollBarBreadth(-1) |
|
500 |
, iFixScreenOrientationApplicantsCount(0) |
|
501 |
{ |
|
502 |
} |
|
503 |
||
504 |
// --------------------------------------------------------------------------- |
|
505 |
// CSwtUiUtils::ConstructL |
|
506 |
// --------------------------------------------------------------------------- |
|
507 |
// |
|
508 |
void CSwtUiUtils::ConstructL() |
|
509 |
{ |
|
510 |
CEikonEnv& eikEnv = *iDisplay.CoeEnv(); |
|
511 |
MEikAppUiFactory& appUiFactory = *(eikEnv.AppUiFactory()); |
|
512 |
CEikAppUi& appUi = *(eikEnv.EikAppUi()); |
|
513 |
||
514 |
// Set the status pane |
|
515 |
iStatusPane = appUiFactory.StatusPane(); |
|
516 |
ASSERT(iStatusPane); |
|
517 |
iStatusPane->SetObserver(NULL); |
|
518 |
iStatusPane->MakeVisible(EFalse); |
|
519 |
iStatusPane->SetObserver(this); |
|
520 |
||
521 |
// Override window priorities. See TSwtWinPriority. |
|
522 |
// These traps cannot be packed into a single one since |
|
523 |
// we do not know which status pane controls exist. |
|
524 |
CCoeControl* ctrl = NULL; |
|
525 |
RDrawableWindow* win = NULL; |
|
526 |
||
527 |
// Context pane priority (image). |
|
528 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
529 |
TUid::Uid(EEikStatusPaneUidContext))); |
|
530 |
if (ctrl) |
|
531 |
{ |
|
532 |
win = ctrl->DrawableWindow(); |
|
533 |
if (win) |
|
534 |
{ |
|
535 |
win->SetOrdinalPosition( |
|
536 |
win->OrdinalPosition(), |
|
537 |
ESwtWinPriorityStatusPane); |
|
538 |
} |
|
539 |
} |
|
540 |
||
541 |
// Title pane priority. |
|
542 |
ctrl = NULL; |
|
543 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
544 |
TUid::Uid(EEikStatusPaneUidTitle))); |
|
545 |
if (ctrl) |
|
546 |
{ |
|
547 |
win = ctrl->DrawableWindow(); |
|
548 |
if (win) |
|
549 |
{ |
|
550 |
win->SetOrdinalPosition( |
|
551 |
win->OrdinalPosition(), |
|
552 |
ESwtWinPriorityStatusPane); |
|
553 |
} |
|
554 |
} |
|
555 |
||
556 |
// Navi pane priority. |
|
557 |
ctrl = NULL; |
|
558 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
559 |
TUid::Uid(EEikStatusPaneUidNavi))); |
|
560 |
if (ctrl) |
|
561 |
{ |
|
562 |
win = ctrl->DrawableWindow(); |
|
563 |
if (win) |
|
564 |
{ |
|
565 |
win->SetOrdinalPosition( |
|
566 |
win->OrdinalPosition(), |
|
567 |
ESwtWinPriorityStatusPane); |
|
568 |
} |
|
569 |
} |
|
570 |
||
571 |
// Empty pane priority. |
|
572 |
ctrl = NULL; |
|
573 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
574 |
TUid::Uid(EEikStatusPaneUidEmpty))); |
|
575 |
if (ctrl) |
|
576 |
{ |
|
577 |
win = ctrl->DrawableWindow(); |
|
578 |
if (win) |
|
579 |
{ |
|
580 |
win->SetOrdinalPosition( |
|
581 |
win->OrdinalPosition(), |
|
582 |
ESwtWinPriorityStatusPane); |
|
583 |
} |
|
584 |
} |
|
585 |
||
586 |
// Indi pane priority. |
|
587 |
ctrl = NULL; |
|
588 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
589 |
TUid::Uid(EEikStatusPaneUidIndic))); |
|
590 |
if (ctrl) |
|
591 |
{ |
|
592 |
win = ctrl->DrawableWindow(); |
|
593 |
if (win) |
|
594 |
{ |
|
595 |
win->SetOrdinalPosition( |
|
596 |
win->OrdinalPosition(), |
|
597 |
ESwtWinPriorityStatusPane); |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
// Clock pane priority. |
|
602 |
ctrl = NULL; |
|
603 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
604 |
TUid::Uid(EEikStatusPaneUidClock))); |
|
605 |
if (ctrl) |
|
606 |
{ |
|
607 |
win = ctrl->DrawableWindow(); |
|
608 |
if (win) |
|
609 |
{ |
|
610 |
win->SetOrdinalPosition( |
|
611 |
win->OrdinalPosition(), |
|
612 |
ESwtWinPriorityStatusPane); |
|
613 |
} |
|
614 |
} |
|
615 |
||
616 |
// Digital clock pane priority. |
|
617 |
ctrl = NULL; |
|
618 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
619 |
TUid::Uid(EEikStatusPaneUidDigitalClock))); |
|
620 |
if (ctrl) |
|
621 |
{ |
|
622 |
win = ctrl->DrawableWindow(); |
|
623 |
if (win) |
|
624 |
{ |
|
625 |
win->SetOrdinalPosition( |
|
626 |
win->OrdinalPosition(), |
|
627 |
ESwtWinPriorityStatusPane); |
|
628 |
} |
|
629 |
} |
|
630 |
||
631 |
// Signal pane priority. |
|
632 |
ctrl = NULL; |
|
633 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
634 |
TUid::Uid(EEikStatusPaneUidSignal))); |
|
635 |
if (ctrl) |
|
636 |
{ |
|
637 |
win = ctrl->DrawableWindow(); |
|
638 |
if (win) |
|
639 |
{ |
|
640 |
win->SetOrdinalPosition( |
|
641 |
win->OrdinalPosition(), |
|
642 |
ESwtWinPriorityStatusPane); |
|
643 |
} |
|
644 |
} |
|
645 |
||
646 |
// Battery pane priority. |
|
647 |
ctrl = NULL; |
|
648 |
TRAP_IGNORE(ctrl = iStatusPane->ContainerControlL( |
|
649 |
TUid::Uid(EEikStatusPaneUidBattery))); |
|
650 |
if (ctrl) |
|
651 |
{ |
|
652 |
win = ctrl->DrawableWindow(); |
|
653 |
if (win) |
|
654 |
{ |
|
655 |
win->SetOrdinalPosition( |
|
656 |
win->OrdinalPosition(), |
|
657 |
ESwtWinPriorityStatusPane); |
|
658 |
} |
|
659 |
} |
|
660 |
||
661 |
// Create the CBA |
|
662 |
iCba = CEikButtonGroupContainer::NewL( |
|
663 |
CEikButtonGroupContainer::ECba, |
|
664 |
CEikButtonGroupContainer::EHorizontal, |
|
665 |
&appUi, |
|
666 |
NULL, |
|
667 |
CEikButtonGroupContainer::EAddToStack); |
|
668 |
||
669 |
// The Cba will be made visible by the firtst top shell to show |
|
670 |
// or by the first child Shell with commands to show. |
|
671 |
iCba->MakeVisible(EFalse); |
|
672 |
||
673 |
#ifdef RD_JAVA_S60_RELEASE_9_2 |
|
674 |
static_cast<CEikCba*>(iCba->ButtonGroup())->EnableItemSpecificSoftkey(EFalse); |
|
675 |
#endif |
|
676 |
||
677 |
const TSize screenSize = iDisplay.CoeEnv()->ScreenDevice()->SizeInPixels(); |
|
678 |
iCba->SetBoundingRect(TRect(screenSize)); |
|
679 |
||
680 |
iCba->SetCommandL(0, EEikBidBlank, KNullDesC); |
|
681 |
iCba->SetCommandL(2, EEikBidBlank, KNullDesC); |
|
682 |
} |
|
683 |
||
684 |
// --------------------------------------------------------------------------- |
|
685 |
// CSwtUiUtils::DoSetActiveShell |
|
686 |
// --------------------------------------------------------------------------- |
|
687 |
// |
|
688 |
void CSwtUiUtils::DoSetActiveShell(MSwtShell& aShell, TBool aSetFocus) |
|
689 |
{ |
|
690 |
ASSERT(CanBeActive(aShell, EFalse)); // loose check |
|
691 |
||
692 |
if (iActiveShell == &aShell) |
|
693 |
{ |
|
694 |
return; |
|
695 |
} |
|
696 |
||
697 |
MSwtShell* newParentShell = aShell.GetParentShell(); |
|
698 |
MSwtShell& newTopMostShell = aShell.Control()->GetTopShell(); |
|
699 |
TBool keepTopMost(EFalse); |
|
700 |
||
701 |
if (iActiveShell) |
|
702 |
{ |
|
703 |
iActiveShell->ActivityChanged(EFalse, EFalse); |
|
704 |
SetShellFade(iActiveShell, EFalse); |
|
705 |
||
706 |
// Hide current active shell (no matter if it's dialog or top shell) |
|
707 |
// if the new shell is a top shell or if the top parent of the new |
|
708 |
// dialog shell is activateable. |
|
709 |
if (!newParentShell || (CanBeActive(newTopMostShell, EFalse))) // loose check |
|
710 |
{ |
|
711 |
if (iActiveShell == &newTopMostShell) |
|
712 |
{ |
|
713 |
// This is essential to avoid flickering. |
|
714 |
keepTopMost = ETrue; |
|
715 |
} |
|
716 |
else |
|
717 |
{ |
|
718 |
iActiveShell->Control()->HideSilently(); |
|
719 |
} |
|
720 |
} |
|
721 |
} |
|
722 |
||
723 |
iActiveShell = &aShell; |
|
724 |
||
725 |
// If the new active Shell is a child Shell, make sure its top parent Shell |
|
726 |
// and all siblings are displayed behind. ShowSilently makes sure this happens |
|
727 |
// only if the Shells are visible. |
|
728 |
if (newParentShell && !keepTopMost) |
|
729 |
{ |
|
730 |
MoveToEndOfQueue(newTopMostShell); |
|
731 |
newTopMostShell.Control()->ShowSilently(); |
|
732 |
} |
|
733 |
||
734 |
// Bring back on screen and activate the new Shell. |
|
735 |
MoveToEndOfQueue(*iActiveShell); |
|
736 |
||
737 |
TRAP_IGNORE(UpdateStatusPaneL()); |
|
738 |
||
739 |
iActiveShell->Control()->ShowSilently(); |
|
740 |
iActiveShell->ActivityChanged(ETrue, aSetFocus); |
|
741 |
||
742 |
// Remember the new top most Shell for Shell activability changes. |
|
743 |
iLastTopMostShell = TopMostTopShell(); |
|
744 |
||
745 |
||
746 |
SetShellFade(iActiveShell, ETrue); |
|
747 |
} |
|
748 |
||
749 |
// --------------------------------------------------------------------------- |
|
750 |
// CSwtUiUtils::FindAndActivateShell |
|
751 |
// --------------------------------------------------------------------------- |
|
752 |
// |
|
753 |
TBool CSwtUiUtils::FindAndActivateShell() |
|
754 |
{ |
|
755 |
TBool res = EFalse; |
|
756 |
const TInt count = iShells.Count(); |
|
757 |
for (TInt i = count - 1; i >= 0; --i) |
|
758 |
{ |
|
759 |
MSwtShell* shell = iShells[i]; |
|
760 |
if (CanBeActive(*shell, EFalse)) // loose check |
|
761 |
{ |
|
762 |
DoSetActiveShell(*shell, ETrue); |
|
763 |
res = ETrue; |
|
764 |
break; |
|
765 |
} |
|
766 |
} |
|
767 |
return res; |
|
768 |
} |
|
769 |
||
770 |
// --------------------------------------------------------------------------- |
|
771 |
// CSwtUiUtils::IsApplicationModal |
|
772 |
// --------------------------------------------------------------------------- |
|
773 |
// |
|
774 |
TBool CSwtUiUtils::IsApplicationModal(MSwtShell& aShell) |
|
775 |
{ |
|
776 |
return ((aShell.Control()->Style() & KSwtModalityMask) |
|
777 |
!= KSwtStyleModeless); |
|
778 |
} |
|
779 |
||
780 |
// --------------------------------------------------------------------------- |
|
781 |
// CSwtUiUtils::FreeBrowserRam |
|
782 |
// --------------------------------------------------------------------------- |
|
783 |
// |
|
784 |
void CSwtUiUtils::FreeBrowserRamL(MSwtComposite* aComposite, TInt aEventType) |
|
785 |
{ |
|
786 |
ASSERT(aComposite); |
|
787 |
MSwtBrowser* browser = aComposite->Control()->BrowserInterface(); |
|
788 |
if (browser) |
|
789 |
{ |
|
790 |
if ((!IsAppFocused()) |
|
791 |
|| aEventType == CSwtLafFacade::GetConstant(CSwtLafFacade::EBrowserMemoryGood)) |
|
792 |
{ |
|
793 |
browser->HandleFreeRamEventL(aEventType); |
|
794 |
} |
|
795 |
} |
|
796 |
const RSwtControlArray* children = aComposite->Children(); |
|
797 |
if (children) |
|
798 |
{ |
|
799 |
for (TInt i = 0; i < children->Count(); ++i) |
|
800 |
{ |
|
801 |
MSwtControl* child = (*children)[i]; |
|
802 |
if (child->CompositeInterface()) |
|
803 |
{ |
|
804 |
FreeBrowserRamL(child->CompositeInterface(), aEventType); |
|
805 |
} |
|
806 |
} |
|
807 |
} |
|
808 |
} |
|
809 |
||
810 |
// --------------------------------------------------------------------------- |
|
811 |
// CSwtUiUtils::MoveToEndOfQueue |
|
812 |
// --------------------------------------------------------------------------- |
|
813 |
// |
|
814 |
void CSwtUiUtils::MoveToEndOfQueue(MSwtShell& aShell) |
|
815 |
{ |
|
816 |
TInt index = iShells.Find(&aShell); |
|
817 |
ASSERT(index != KErrNotFound); |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
818 |
iShells.Remove(index); |
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
819 |
iShells.Append(&aShell); |
66 | 820 |
} |
821 |
||
822 |
// --------------------------------------------------------------------------- |
|
823 |
// CSwtUiUtils::InlineReferenceFont |
|
824 |
// --------------------------------------------------------------------------- |
|
825 |
// |
|
826 |
const CFont& CSwtUiUtils::InlineReferenceFont() const |
|
827 |
{ |
|
828 |
if (!iInlineFont) |
|
829 |
{ |
|
830 |
// Pick the highest among Button, DateEditor, Text. |
|
831 |
iInlineFont = AknLayoutUtils::FontFromId( |
|
832 |
CSwtLafFacade::GetFontId(CSwtLafFacade::EFont2MidpTextPaneT1Font, 1, 0)); |
|
833 |
} |
|
834 |
ASSERT(iInlineFont); |
|
835 |
return *iInlineFont; |
|
836 |
} |
|
837 |
||
838 |
// --------------------------------------------------------------------------- |
|
839 |
// CSwtUiUtils::HideIndicator |
|
840 |
// --------------------------------------------------------------------------- |
|
841 |
// |
|
842 |
void CSwtUiUtils::HideIndicator(TInt aId) |
|
843 |
{ |
|
844 |
TUid uid = TUid::Uid(aId); |
|
845 |
CEikStatusPaneBase::TPaneCapabilities subPane = iStatusPane->PaneCapabilities(uid); |
|
846 |
if (subPane.IsPresent() && subPane.IsAppOwned()) |
|
847 |
{ |
|
848 |
CCoeControl* ctrl = NULL; |
|
849 |
TRAP_IGNORE(ctrl = iStatusPane->ControlL(uid)); |
|
850 |
if (ctrl) |
|
851 |
{ |
|
852 |
ctrl->MakeVisible(EFalse); |
|
853 |
} |
|
854 |
} |
|
855 |
} |
|
856 |
||
857 |
// --------------------------------------------------------------------------- |
|
858 |
// CSwtUiUtils::HideIndicators |
|
859 |
// --------------------------------------------------------------------------- |
|
860 |
// |
|
861 |
void CSwtUiUtils::HideIndicators() |
|
862 |
{ |
|
863 |
if (!iStatusPane) |
|
864 |
return; |
|
865 |
||
866 |
HideIndicator(EEikStatusPaneUidSignal); |
|
867 |
HideIndicator(EEikStatusPaneUidBattery); |
|
868 |
HideIndicator(EEikStatusPaneUidIndic); |
|
869 |
HideIndicator(EEikStatusPaneUidMessage); |
|
870 |
HideIndicator(EEikStatusPaneUidClock); |
|
871 |
HideIndicator(EEikStatusPaneUidDigitalClock); |
|
872 |
} |
|
873 |
||
874 |
// --------------------------------------------------------------------------- |
|
875 |
// CSwtUiUtils::DoSetSplitInputShellPos |
|
876 |
// --------------------------------------------------------------------------- |
|
877 |
// |
|
878 |
void CSwtUiUtils::DoSetSplitInputShellPos(const TPoint& aPos) |
|
879 |
{ |
|
880 |
MSwtShell& shell = iSplitInputView->GetShell(); |
|
881 |
MSwtControl* temp = iSplitInputView; |
|
882 |
iSplitInputView = 0; // stop recursion. |
|
883 |
shell.DoSetLocation(aPos); |
|
884 |
iSplitInputView = temp; |
|
885 |
} |
|
886 |
||
887 |
// --------------------------------------------------------------------------- |
|
888 |
// CSwtUiUtils::DoSetSplitInputViewSize |
|
889 |
// --------------------------------------------------------------------------- |
|
890 |
// |
|
891 |
void CSwtUiUtils::DoSetSplitInputViewSize(const TSize& aSize) |
|
892 |
{ |
|
893 |
MSwtControl* temp = iSplitInputView; |
|
894 |
iSplitInputView = 0; // stop recursion. |
|
895 |
temp->SetWidgetSize(aSize); |
|
896 |
iSplitInputView = temp; |
|
897 |
} |
|
898 |
||
899 |
// --------------------------------------------------------------------------- |
|
900 |
// CSwtUiUtils::ScrolledCompositeAncestor |
|
901 |
// --------------------------------------------------------------------------- |
|
902 |
// |
|
903 |
MSwtControl* CSwtUiUtils::ScrolledCompositeAncestor(const MSwtControl& aControl) const |
|
904 |
{ |
|
905 |
MSwtComposite* parent = aControl.GetParent(); |
|
906 |
const MSwtControl* control = &aControl; |
|
907 |
while (parent) |
|
908 |
{ |
|
909 |
if (parent->ScrolledCompositeContent() == control) |
|
910 |
{ |
|
911 |
return parent->Control(); |
|
912 |
} |
|
913 |
control = parent->Control(); |
|
914 |
parent = parent->Control()->GetParent(); |
|
915 |
} |
|
916 |
||
917 |
return 0; |
|
918 |
} |
|
919 |
||
920 |
// --------------------------------------------------------------------------- |
|
921 |
// CSwtUiUtils::GetSystemColor |
|
922 |
// From MSwtUiUtils |
|
923 |
// --------------------------------------------------------------------------- |
|
924 |
// |
|
925 |
TRgb CSwtUiUtils::GetSystemColor(TSwtColorId aId) const |
|
926 |
{ |
|
927 |
TRgb color(KRgbBlack); |
|
928 |
CEikonEnv* env = iDisplay.CoeEnv(); |
|
929 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
930 |
||
931 |
switch (aId) |
|
932 |
{ |
|
933 |
case ESwtColorWidgetBorder: |
|
934 |
case ESwtColorWidgetDarkShadow: |
|
935 |
case ESwtColorWidgetNormalShadow: |
|
936 |
case ESwtColorWidgetLightShadow: |
|
937 |
case ESwtColorWidgetHighlightShadow: |
|
938 |
// This border color is used also to draw the actual borders lines |
|
939 |
// See ASwtControlBase::DrawBorder() |
|
940 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnOtherColors, |
|
941 |
EAknsCIQsnOtherColorsCG12); |
|
942 |
break; |
|
943 |
case ESwtColorWidgetBackground: |
|
944 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnOtherColors, |
|
945 |
EAknsCIQsnOtherColorsCG10); |
|
946 |
break; |
|
947 |
case ESwtColorListBackground: |
|
948 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnOtherColors, |
|
949 |
EAknsCIQsnOtherColorsCG13); |
|
950 |
break; |
|
951 |
case ESwtColorListSelection: |
|
952 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnOtherColors, |
|
953 |
EAknsCIQsnOtherColorsCG14); |
|
954 |
break; |
|
955 |
case ESwtColorTitleBackground: |
|
956 |
case ESwtColorTitleBackgroundGradient: |
|
957 |
case ESwtColorTitleInactiveBackground: |
|
958 |
case ESwtColorTitleInactiveBackgroundGradient: |
|
959 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnOtherColors, |
|
960 |
EAknsCIQsnOtherColorsCG11); |
|
961 |
break; |
|
962 |
case ESwtColorWidgetForeground: |
|
963 |
case ESwtColorListForeground: |
|
964 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
|
965 |
KNonHighlightedTextColor); |
|
966 |
break; |
|
967 |
case ESwtColorListSelectionText: |
|
968 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
|
969 |
EAknsCIQsnTextColorsCG10); |
|
970 |
break; |
|
971 |
case ESwtColorTitleForeground: |
|
972 |
case ESwtColorTitleInactiveForeground: |
|
973 |
AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
|
974 |
EAknsCIQsnTextColorsCG1); |
|
975 |
break; |
|
976 |
default: |
|
977 |
// Should not occur, but not an error |
|
978 |
__DEBUGGER(); |
|
979 |
break; |
|
980 |
} |
|
981 |
||
982 |
return color; |
|
983 |
} |
|
984 |
||
985 |
// --------------------------------------------------------------------------- |
|
986 |
// CSwtUiUtils::SystemFont |
|
987 |
// From MSwtUiUtils |
|
988 |
// --------------------------------------------------------------------------- |
|
989 |
// |
|
990 |
TFontSpec CSwtUiUtils::SystemFontSpec() const |
|
991 |
{ |
|
992 |
// Normal environment font |
|
993 |
const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont, NULL); |
|
994 |
return font->FontSpecInTwips(); |
|
995 |
} |
|
996 |
||
997 |
// --------------------------------------------------------------------------- |
|
998 |
// CSwtUiUtils::RunMessageBoxDlgLD |
|
999 |
// From MSwtUiUtils |
|
1000 |
// --------------------------------------------------------------------------- |
|
1001 |
// |
|
1002 |
TInt CSwtUiUtils::RunMessageBoxDlgLD(MSwtDisplay& aDisplay, const TDesC& aTitle, |
|
1003 |
const TDesC& aMessage, TInt aStyle) const |
|
1004 |
{ |
|
1005 |
return CSwtMessageBox::RunDlgLD(aDisplay, aTitle, aMessage, aStyle); |
|
1006 |
} |
|
1007 |
||
1008 |
// --------------------------------------------------------------------------- |
|
1009 |
// CSwtUiUtils::GetParentTopShellOfActiveShell |
|
1010 |
// From MSwtUiUtils |
|
1011 |
// --------------------------------------------------------------------------- |
|
1012 |
// |
|
1013 |
MSwtShell* CSwtUiUtils::GetParentTopShellOfActiveShell() const |
|
1014 |
{ |
|
1015 |
if (!iActiveShell) |
|
1016 |
{ |
|
1017 |
return NULL; |
|
1018 |
} |
|
1019 |
const MSwtControl* activeShellControl = iActiveShell->Control(); |
|
1020 |
return &GetControlTopShell(*activeShellControl); |
|
1021 |
} |
|
1022 |
||
1023 |
// --------------------------------------------------------------------------- |
|
1024 |
// CSwtUiUtils::TopMostTopShell |
|
1025 |
// From MSwtUiUtils |
|
1026 |
// --------------------------------------------------------------------------- |
|
1027 |
// |
|
1028 |
MSwtShell* CSwtUiUtils::TopMostTopShell() const |
|
1029 |
{ |
|
1030 |
if (iActiveShell) |
|
1031 |
{ |
|
1032 |
if (iActiveShell->GetParentShell()) |
|
1033 |
{ |
|
1034 |
if (CanBeTopMost(iActiveShell->Control()->GetTopShell())) |
|
1035 |
{ |
|
1036 |
return &iActiveShell->Control()->GetTopShell(); |
|
1037 |
} |
|
1038 |
} |
|
1039 |
else |
|
1040 |
{ |
|
1041 |
return iActiveShell; |
|
1042 |
} |
|
1043 |
} |
|
1044 |
||
1045 |
// Find last active Shell |
|
1046 |
const TInt count = iShells.Count(); |
|
1047 |
for (TInt i = count - 1; i >= 0; --i) |
|
1048 |
{ |
|
1049 |
MSwtShell* shell = iShells[i]; |
|
1050 |
if (!shell->GetParentShell() && CanBeTopMost(*shell)) |
|
1051 |
{ |
|
1052 |
return shell; |
|
1053 |
} |
|
1054 |
} |
|
1055 |
||
1056 |
return NULL; |
|
1057 |
} |
|
1058 |
||
1059 |
// --------------------------------------------------------------------------- |
|
1060 |
// CSwtUiUtils::GetActiveShellPeer |
|
1061 |
// From MSwtUiUtils |
|
1062 |
// --------------------------------------------------------------------------- |
|
1063 |
// |
|
1064 |
TSwtPeer CSwtUiUtils::GetActiveShellPeer() const |
|
1065 |
{ |
|
1066 |
if (iActiveShell) |
|
1067 |
{ |
|
1068 |
return iActiveShell->Control()->JavaPeer(); |
|
1069 |
} |
|
1070 |
else |
|
1071 |
{ |
|
1072 |
return NULL; |
|
1073 |
} |
|
1074 |
} |
|
1075 |
||
1076 |
// --------------------------------------------------------------------------- |
|
1077 |
// CSwtUiUtils::GetShellPeersL |
|
1078 |
// From MSwtUiUtils |
|
1079 |
// --------------------------------------------------------------------------- |
|
1080 |
// |
|
1081 |
CSwtPeerArray* CSwtUiUtils::GetShellPeersL() const |
|
1082 |
{ |
|
1083 |
const TInt count = iShells.Count(); |
|
1084 |
if (count == 0) |
|
1085 |
{ |
|
1086 |
return NULL; |
|
1087 |
} |
|
1088 |
||
1089 |
CSwtPeerArray* array = new(ELeave) CSwtPeerArray(count); |
|
1090 |
CleanupStack::PushL(array); |
|
1091 |
for (TInt i = 0; i < count; ++i) |
|
1092 |
{ |
|
1093 |
array->AppendL(iShells[i]->Control()->JavaPeer()); |
|
1094 |
} |
|
1095 |
CleanupStack::Pop(array); |
|
1096 |
||
1097 |
return array; |
|
1098 |
} |
|
1099 |
||
1100 |
// --------------------------------------------------------------------------- |
|
1101 |
// CSwtUiUtils::GetFocusControl |
|
1102 |
// From MSwtUiUtils |
|
1103 |
// --------------------------------------------------------------------------- |
|
1104 |
// |
|
1105 |
TSwtPeer CSwtUiUtils::GetFocusControl() const |
|
1106 |
{ |
|
1107 |
if (iActiveShell) |
|
1108 |
{ |
|
1109 |
MSwtControl* focusControl = iActiveShell->FocusControl(); |
|
1110 |
if (focusControl) |
|
1111 |
{ |
|
1112 |
return focusControl->JavaPeer(); |
|
1113 |
} |
|
1114 |
else |
|
1115 |
{ |
|
1116 |
return iActiveShell->Control()->JavaPeer(); |
|
1117 |
} |
|
1118 |
} |
|
1119 |
return NULL; |
|
1120 |
} |
|
1121 |
||
1122 |
// --------------------------------------------------------------------------- |
|
1123 |
// CSwtUiUtils::GetControlTopShell |
|
1124 |
// From MSwtUiUtils |
|
1125 |
// --------------------------------------------------------------------------- |
|
1126 |
// |
|
1127 |
MSwtShell& CSwtUiUtils::GetControlTopShell(const MSwtControl& aControl) const |
|
1128 |
{ |
|
1129 |
const MSwtControl* ctrl = &aControl; |
|
1130 |
for (MSwtComposite* parent; (parent = ctrl->GetParent()) != NULL;) |
|
1131 |
{ |
|
1132 |
ctrl = parent->Control(); |
|
1133 |
} |
|
1134 |
MSwtShell* shell = const_cast<MSwtControl*>(ctrl)->ShellInterface(); |
|
1135 |
ASSERT(shell); |
|
1136 |
return *shell; |
|
1137 |
} |
|
1138 |
||
1139 |
// --------------------------------------------------------------------------- |
|
1140 |
// CSwtUiUtils::DrawFocusRect |
|
1141 |
// From MSwtUiUtils |
|
1142 |
// --------------------------------------------------------------------------- |
|
1143 |
// |
|
1144 |
void CSwtUiUtils::DrawFocusRect(MSwtGc& aGc, const TRect& aRect) const |
|
1145 |
{ |
|
1146 |
// Get highlight frame and highlight center graphics locations from |
|
1147 |
// the skin. |
|
1148 |
TAknLayoutRect topLeft = CSwtLafFacade::GetLayoutRect( |
|
1149 |
CSwtLafFacade::EListHighlightSkinPlacingGeneralLine2, aRect); |
|
1150 |
||
1151 |
TAknLayoutRect bottomRight = CSwtLafFacade::GetLayoutRect( |
|
1152 |
CSwtLafFacade::EListHighlightSkinPlacingGeneralLine5, aRect); |
|
1153 |
||
1154 |
TRect innerRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
|
1155 |
||
1156 |
AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), |
|
1157 |
static_cast<CFbsBitGc&>(aGc.BitmapContext()), |
|
1158 |
aRect, |
|
1159 |
innerRect, |
|
1160 |
KAknsIIDQsnFrList, |
|
1161 |
KAknsIIDQsnFrListCenter); |
|
1162 |
||
1163 |
} |
|
1164 |
||
1165 |
// --------------------------------------------------------------------------- |
|
1166 |
// CSwtUiUtils::Cba |
|
1167 |
// From MSwtUiUtils |
|
1168 |
// --------------------------------------------------------------------------- |
|
1169 |
// |
|
1170 |
CEikButtonGroupContainer& CSwtUiUtils::Cba() const |
|
1171 |
{ |
|
1172 |
ASSERT(iCba); |
|
1173 |
return *iCba; |
|
1174 |
} |
|
1175 |
||
1176 |
// --------------------------------------------------------------------------- |
|
1177 |
// CSwtUiUtils::UpdateStatusPaneL |
|
1178 |
// From MSwtUiUtils |
|
1179 |
// Calls to this should be kept to a severe minimum! This function is not anymore |
|
1180 |
// responsible of resizing the topmost shells since Shell's bounds should not |
|
1181 |
// depend on the current status pane height(See CSwtShell::DefaultBounds()). |
|
1182 |
// --------------------------------------------------------------------------- |
|
1183 |
// |
|
1184 |
void CSwtUiUtils::UpdateStatusPaneL() |
|
1185 |
{ |
|
1186 |
if (!iStatusPane) |
|
1187 |
{ |
|
1188 |
return; |
|
1189 |
} |
|
1190 |
||
1191 |
MSwtShell* topShell = TopMostTopShell(); |
|
1192 |
if (!topShell || topShell->FullScreenMode()) |
|
1193 |
{ |
|
1194 |
if (iSplitInputEditor) |
|
1195 |
{ |
|
1196 |
// Split input editing is ongoing and the status pane is hidden. |
|
1197 |
// Cache the new status pane visibility for when the split input ends. |
|
1198 |
iSplitInputSPVisible = EFalse; |
|
1199 |
} |
|
1200 |
else |
|
1201 |
{ |
|
1202 |
if (iStatusPane->IsVisible()) |
|
1203 |
{ |
|
1204 |
iStatusPane->SetObserver(NULL); |
|
1205 |
iStatusPane->MakeVisible(EFalse); |
|
1206 |
} |
|
1207 |
} |
|
1208 |
return; |
|
1209 |
} |
|
1210 |
||
1211 |
// Title |
|
1212 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(iStatusPane->ControlL( |
|
1213 |
TUid::Uid(EEikStatusPaneUidTitle))); |
|
1214 |
const TDesC* title = NULL; |
|
1215 |
if (topShell) |
|
1216 |
{ |
|
1217 |
title = topShell->Decorations()->GetText(); |
|
1218 |
} |
|
1219 |
if (titlePane) |
|
1220 |
{ |
|
1221 |
if (title) |
|
1222 |
{ |
|
1223 |
titlePane->SetTextL(*title); |
|
1224 |
} |
|
1225 |
else if (iAppName) |
|
1226 |
{ |
|
1227 |
titlePane->SetTextL(*iAppName); |
|
1228 |
} |
|
1229 |
else |
|
1230 |
{ |
|
1231 |
titlePane->SetTextToDefaultL(); |
|
1232 |
} |
|
1233 |
} |
|
1234 |
||
1235 |
// Status |
|
1236 |
CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*>( |
|
1237 |
iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); |
|
1238 |
if (naviPane) |
|
1239 |
{ |
|
1240 |
if (iNaviDecorator) |
|
1241 |
{ |
|
1242 |
naviPane->Pop(iNaviDecorator); |
|
1243 |
delete iNaviDecorator; |
|
1244 |
iNaviDecorator = NULL; |
|
1245 |
} |
|
1246 |
} |
|
1247 |
||
1248 |
MSwtShell::TSwtStatusPaneStyle style(MSwtShell::EStyleNoStatusPane); |
|
1249 |
if (topShell && naviPane) |
|
1250 |
{ |
|
1251 |
style = topShell->StatusPaneStyle(); |
|
1252 |
||
1253 |
MSwtMobileShell* activeTopMobileShell = topShell->MobileShellInterface(); |
|
1254 |
if (activeTopMobileShell) |
|
1255 |
{ |
|
1256 |
const TDesC* status = activeTopMobileShell->GetStatusText(); |
|
1257 |
TInt statusLength(status ? status->Length() : 0); |
|
1258 |
TInt titleLength(title ? title->Length() : 0); |
|
1259 |
||
1260 |
HBufC* extendedStatus = HBufC::NewLC(titleLength + statusLength + 1); |
|
1261 |
TPtr extendedStatusTxt(extendedStatus->Des()); |
|
1262 |
TBool landscape = CSwtLafFacade::IsLandscapeOrientation(); |
|
1263 |
if ((style == MSwtShell::EStyleSmallStatusPane) && !(landscape)) |
|
1264 |
{ |
|
1265 |
if (titleLength > 0) |
|
1266 |
{ |
|
1267 |
extendedStatusTxt.Append(*title); |
|
1268 |
} |
|
1269 |
if (statusLength > 0 && titleLength > 0) |
|
1270 |
{ |
|
1271 |
extendedStatusTxt.Append(KSeparator); |
|
1272 |
} |
|
1273 |
} |
|
1274 |
if (extendedStatus) |
|
1275 |
{ |
|
1276 |
if (statusLength) |
|
1277 |
{ |
|
1278 |
extendedStatusTxt.Append(*status); |
|
1279 |
} |
|
1280 |
iNaviDecorator = naviPane->CreateMessageLabelL(*extendedStatus); |
|
1281 |
naviPane->PushL(*iNaviDecorator); |
|
1282 |
} |
|
1283 |
CleanupStack::PopAndDestroy(extendedStatus); |
|
1284 |
} |
|
1285 |
} |
|
1286 |
||
1287 |
// Image |
|
1288 |
if (iStatusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidContext)).IsInCurrentLayout()) |
|
1289 |
{ |
|
1290 |
CAknContextPane* contextPane = static_cast<CAknContextPane*>( |
|
1291 |
iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidContext))); |
|
1292 |
if (contextPane) |
|
1293 |
{ |
|
1294 |
const MSwtImage* image = topShell ? topShell->Decorations()->GetImage() : NULL; |
|
1295 |
if (image) |
|
1296 |
{ |
|
1297 |
CFbsBitmap* bitmap = NULL; |
|
1298 |
CFbsBitmap* mask = NULL; |
|
1299 |
bitmap = SwtControlHelper::GetCopyOfBitmapLC(&(image->Bitmap())); |
|
1300 |
mask = SwtControlHelper::GetCopyOfBitmapLC(image->MaskBitmap()); |
|
1301 |
CleanupStack::Pop(mask ? 2 : 1); |
|
1302 |
contextPane->SetPicture(bitmap, mask); |
|
1303 |
} |
|
1304 |
else |
|
1305 |
{ |
|
1306 |
TRAP_IGNORE(contextPane->SetPictureToDefaultL()); |
|
1307 |
} |
|
1308 |
} |
|
1309 |
} |
|
1310 |
||
1311 |
// Style changed last to avoid flickering |
|
1312 |
iStatusPane->SetObserver(NULL); |
|
1313 |
if (!topShell || style == MSwtShell::EStyleNoStatusPane) |
|
1314 |
{ |
|
1315 |
if (iSplitInputEditor) |
|
1316 |
{ |
|
1317 |
// Split input editing is ongoing and the status pane is hidden. |
|
1318 |
// Cache the new status pane visibility for when the split input ends. |
|
1319 |
iSplitInputSPVisible = EFalse; |
|
1320 |
} |
|
1321 |
else |
|
1322 |
{ |
|
1323 |
iStatusPane->MakeVisible(EFalse); |
|
1324 |
} |
|
1325 |
} |
|
1326 |
else |
|
1327 |
{ |
|
1328 |
if (style == MSwtShell::EStyleLargeStatusPane) |
|
1329 |
{ |
|
1330 |
iStatusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); |
|
1331 |
} |
|
1332 |
else if (style == MSwtShell::EStyleSmallStatusPane) |
|
1333 |
{ |
|
1334 |
iStatusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE); |
|
1335 |
} |
|
1336 |
||
1337 |
if (iSplitInputEditor) |
|
1338 |
{ |
|
1339 |
// Split input editing is ongoing and the status pane is hidden. |
|
1340 |
// Cache the new status pane visibility for when the split input ends. |
|
1341 |
iSplitInputSPVisible = ETrue; |
|
1342 |
} |
|
1343 |
else |
|
1344 |
{ |
|
1345 |
iStatusPane->MakeVisible(ETrue); |
|
1346 |
||
1347 |
java::ui::CoreUiAvkonAppUi* appUi = java::ui::CoreUiAvkonEswt::getInstance().getJavaUiAppUi(); |
|
1348 |
if (appUi && appUi->hidesIndicators()) |
|
1349 |
{ |
|
1350 |
HideIndicators(); |
|
1351 |
} |
|
1352 |
||
1353 |
// The above relies on DrawDeferred which is too slow for some cases. |
|
1354 |
// For instance, the pane must draw immediately when the app draws the |
|
1355 |
// first time otherwise the startup screenshot will miss the pane. |
|
1356 |
iStatusPane->DrawNow(); |
|
1357 |
} |
|
1358 |
} |
|
1359 |
||
1360 |
// This will cause HandleStatusPaneSizeChange notifications again |
|
1361 |
if (!iSplitInputEditor) |
|
1362 |
{ |
|
1363 |
iStatusPane->SetObserver(this); |
|
1364 |
} |
|
1365 |
||
1366 |
// Shells are trusted to have the correct size already. |
|
1367 |
} |
|
1368 |
||
1369 |
// --------------------------------------------------------------------------- |
|
1370 |
// CSwtUiUtils::HandleAppFocusGainedL |
|
1371 |
// From MSwtAppFocusObserver |
|
1372 |
// --------------------------------------------------------------------------- |
|
1373 |
// |
|
1374 |
void CSwtUiUtils::HandleAppFocusChangeL(TBool aFocused) |
|
1375 |
{ |
|
1376 |
if (aFocused) |
|
1377 |
{ |
|
1378 |
if (!iFocusLost) |
|
1379 |
{ |
|
1380 |
return; |
|
1381 |
} |
|
1382 |
||
1383 |
ASSERT(!iActiveShell); |
|
1384 |
||
1385 |
// Update flag |
|
1386 |
iFocusLost = EFalse; |
|
1387 |
TBool getFocused(EFalse); |
|
1388 |
if (iNextFocusedControl) |
|
1389 |
{ |
|
1390 |
getFocused = iNextFocusedControl->SetSwtFocus(KSwtFocusByForce); |
|
1391 |
iNextFocusedControl = NULL; |
|
1392 |
} |
|
1393 |
||
1394 |
if (getFocused) |
|
1395 |
{ |
|
1396 |
// do nothing |
|
1397 |
} |
|
1398 |
else if (iNextActiveShell) |
|
1399 |
{ |
|
1400 |
// Activate the shell waiting to become active. |
|
1401 |
DoSetActiveShell(*iNextActiveShell, ETrue); |
|
1402 |
} |
|
1403 |
else |
|
1404 |
{ |
|
1405 |
// Search for a shell capable of becoming active. |
|
1406 |
FindAndActivateShell(); |
|
1407 |
} |
|
1408 |
} |
|
1409 |
else |
|
1410 |
{ |
|
1411 |
if (iFocusLost) |
|
1412 |
{ |
|
1413 |
return; |
|
1414 |
} |
|
1415 |
||
1416 |
// Update flag |
|
1417 |
iFocusLost = ETrue; |
|
1418 |
||
1419 |
// Remember active shell |
|
1420 |
iNextActiveShell = iActiveShell; |
|
1421 |
||
1422 |
// Deactivate the active shell |
|
1423 |
if (iActiveShell) |
|
1424 |
{ |
|
1425 |
iActiveShell->ActivityChanged(EFalse, EFalse); |
|
1426 |
SetShellFade(iActiveShell, EFalse); |
|
1427 |
iActiveShell = NULL; |
|
1428 |
} |
|
1429 |
} |
|
1430 |
} |
|
1431 |
||
1432 |
// --------------------------------------------------------------------------- |
|
1433 |
// CSwtUiUtils::IsAppFocused |
|
1434 |
// From MSwtUiUtils |
|
1435 |
// --------------------------------------------------------------------------- |
|
1436 |
// |
|
1437 |
TBool CSwtUiUtils::IsAppFocused() const |
|
1438 |
{ |
|
1439 |
return !iFocusLost; |
|
1440 |
} |
|
1441 |
||
1442 |
// --------------------------------------------------------------------------- |
|
1443 |
// CSwtUiUtils::GetCommandOkTitleL |
|
1444 |
// From MSwtUiUtils |
|
1445 |
// --------------------------------------------------------------------------- |
|
1446 |
// |
|
1447 |
const HBufC* CSwtUiUtils::GetCommandOkTitleL() const |
|
1448 |
{ |
|
1449 |
return iDisplay.CoeEnv()->AllocReadResourceL(R_SWT_SOFTKEY_TEXT_OK); |
|
1450 |
} |
|
1451 |
||
1452 |
// --------------------------------------------------------------------------- |
|
1453 |
// CSwtUiUtils::GetCommandCancelTitleL |
|
1454 |
// From MSwtUiUtils |
|
1455 |
// --------------------------------------------------------------------------- |
|
1456 |
// |
|
1457 |
const HBufC* CSwtUiUtils::GetCommandCancelTitleL() const |
|
1458 |
{ |
|
1459 |
return iDisplay.CoeEnv()->AllocReadResourceL(R_SWT_SOFTKEY_TEXT_CANCEL); |
|
1460 |
} |
|
1461 |
||
1462 |
// --------------------------------------------------------------------------- |
|
1463 |
// CSwtUiUtils::GetPointerEventStateMask |
|
1464 |
// From MSwtUiUtils |
|
1465 |
// --------------------------------------------------------------------------- |
|
1466 |
// |
|
1467 |
TInt CSwtUiUtils::GetPointerEventStateMask(TUint aPointerEventModifiers) const |
|
1468 |
{ |
|
1469 |
// Compute the state mask |
|
1470 |
TInt stateMask = 0; |
|
1471 |
if (aPointerEventModifiers & EModifierCtrl) |
|
1472 |
{ |
|
1473 |
stateMask |= KSwtModifierControl; |
|
1474 |
} |
|
1475 |
if (aPointerEventModifiers & EModifierShift) |
|
1476 |
{ |
|
1477 |
stateMask |= KSwtModifierShift; |
|
1478 |
} |
|
1479 |
if (aPointerEventModifiers & EModifierAlt) |
|
1480 |
{ |
|
1481 |
stateMask |= KSwtModifierAlt; |
|
1482 |
} |
|
1483 |
||
1484 |
return stateMask; |
|
1485 |
} |
|
1486 |
||
1487 |
// --------------------------------------------------------------------------- |
|
1488 |
// CSwtUiUtils::InlineReferencePadding |
|
1489 |
// From MSwtUiUtils |
|
1490 |
// --------------------------------------------------------------------------- |
|
1491 |
// |
|
1492 |
TMargins8 CSwtUiUtils::InlineReferencePadding() const |
|
1493 |
{ |
|
1494 |
if (iInlinePadding.iTop > 0) |
|
1495 |
return iInlinePadding; |
|
1496 |
||
1497 |
// The top and bottom margins are given by list |
|
1498 |
TRect mainRect(TRect::EUninitialized); |
|
1499 |
TAknLayoutRect layoutRect; |
|
1500 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect); |
|
1501 |
layoutRect = CSwtLafFacade::GetLayoutRect(CSwtLafFacade::EListScrollGenPane, mainRect, 0); |
|
1502 |
layoutRect = CSwtLafFacade::GetLayoutRect(CSwtLafFacade::EListGenPane, layoutRect.Rect(), 0); |
|
1503 |
||
1504 |
TAknLayoutText txtLayoutRect; |
|
1505 |
layoutRect = CSwtLafFacade::GetLayoutRect(CSwtLafFacade::EListSinglePane, layoutRect.Rect(), 0); |
|
1506 |
txtLayoutRect = CSwtLafFacade::GetLayoutText(CSwtLafFacade::EListSinglePaneT1, layoutRect.Rect(), 0); |
|
1507 |
||
1508 |
TRect listItemPaddingRect(layoutRect.Rect().iTl, txtLayoutRect.TextRect().iTl); |
|
1509 |
TInt listItemPaddingHeight = listItemPaddingRect.Height(); |
|
1510 |
||
1511 |
// Left and right margins come from Button |
|
1512 |
TRect tl = CSwtLafFacade::GetLayoutRect(CSwtLafFacade::EToolbarButtonPaneG2, TRect(), 0).Rect(); |
|
1513 |
TInt w = tl.Width(); |
|
1514 |
TInt h = tl.Height(); |
|
1515 |
TMargins8 res(w, h, w, h); // (aLeft, aTop, aRight, aBottom) |
|
1516 |
||
1517 |
res.iTop = listItemPaddingHeight; |
|
1518 |
res.iBottom = listItemPaddingHeight; |
|
1519 |
||
1520 |
iInlinePadding = res; |
|
1521 |
||
1522 |
return iInlinePadding; |
|
1523 |
} |
|
1524 |
||
1525 |
// --------------------------------------------------------------------------- |
|
1526 |
// CSwtUiUtils::InlineReferenceFontHeight |
|
1527 |
// From MSwtUiUtils |
|
1528 |
// --------------------------------------------------------------------------- |
|
1529 |
// |
|
1530 |
TInt CSwtUiUtils::InlineReferenceFontHeight() const |
|
1531 |
{ |
|
1532 |
if (iInlineFontHeight <= 0) |
|
1533 |
iInlineFontHeight = InlineReferenceFont().FontMaxHeight(); |
|
1534 |
return iInlineFontHeight; |
|
1535 |
} |
|
1536 |
||
1537 |
||
1538 |
// --------------------------------------------------------------------------- |
|
1539 |
// CSwtUiUtils::SetAppNameL |
|
1540 |
// --------------------------------------------------------------------------- |
|
1541 |
// |
|
1542 |
void CSwtUiUtils::SetAppNameL(const TDesC* aNewName) |
|
1543 |
{ |
|
1544 |
if (iAppName) |
|
1545 |
{ |
|
1546 |
delete iAppName; |
|
1547 |
iAppName = NULL; |
|
1548 |
} |
|
1549 |
||
1550 |
if (aNewName) |
|
1551 |
{ |
|
1552 |
iAppName = aNewName->AllocL(); |
|
1553 |
} |
|
1554 |
||
1555 |
if (TopMostTopShell()) |
|
1556 |
{ |
|
1557 |
UpdateStatusPaneL(); |
|
1558 |
} |
|
1559 |
} |
|
1560 |
||
1561 |
// --------------------------------------------------------------------------- |
|
1562 |
// CSwtUiUtils::GetBestImageSize |
|
1563 |
// --------------------------------------------------------------------------- |
|
1564 |
// |
|
1565 |
TSize CSwtUiUtils::GetBestImageSize(TInt aImageType) |
|
1566 |
{ |
|
1567 |
TSize maxImageSize(0, 0); |
|
1568 |
switch (aImageType) |
|
1569 |
{ |
|
1570 |
case ESwtListImage: |
|
1571 |
maxImageSize = CSwtLafFacade::GetLayoutRect( |
|
1572 |
CSwtLafFacade::EListDoubleLargeGraphicPaneG1, TRect(), 0).Rect().Size(); |
|
1573 |
break; |
|
1574 |
case ESwtChoiceImage: |
|
1575 |
maxImageSize = CSwtLafFacade::GetLayoutRect( |
|
1576 |
CSwtLafFacade::EListSingle2GraphicPaneG1Cp4, TRect()).Rect().Size(); |
|
1577 |
break; |
|
1578 |
case ESwtAlertImage: |
|
1579 |
maxImageSize = CSwtLafFacade::GetLayoutRect( |
|
1580 |
CSwtLafFacade::EPopupMidpNoteAlarmWindowG1, TRect(), 0).Rect().Size(); |
|
1581 |
break; |
|
1582 |
default: |
|
1583 |
||
1584 |
break; |
|
1585 |
} |
|
1586 |
return maxImageSize; |
|
1587 |
} |
|
1588 |
||
1589 |
// --------------------------------------------------------------------------- |
|
1590 |
// CSwtUiUtils::HandleResourceChangedL |
|
1591 |
// From MSwtUiUtils |
|
1592 |
// --------------------------------------------------------------------------- |
|
1593 |
// |
|
1594 |
void CSwtUiUtils::HandleResourceChangedL(TInt aType) |
|
1595 |
{ |
|
1596 |
if (aType == KEikDynamicLayoutVariantSwitch) |
|
1597 |
{ |
|
1598 |
iScrollBarBreadth = -1; |
|
1599 |
iInlineFont = NULL; |
|
1600 |
iInlineFontHeight = -1; |
|
1601 |
iInlinePadding.iTop = -1; |
|
1602 |
||
1603 |
// Sometimes CBA bounds are incorrect at this point in the case we have |
|
1604 |
// a dialog shell active. As a result Shell gets wrong size. |
|
1605 |
// Set the bounds here to make sure they are always correct. |
|
1606 |
const TSize screenSize(iDisplay.CoeEnv()->ScreenDevice()->SizeInPixels()); |
|
1607 |
iCba->SetBoundingRect(TRect(screenSize)); |
|
1608 |
} |
|
1609 |
||
1610 |
TInt count = iShells.Count(); |
|
1611 |
for (TInt i = 0; i < count; ++i) |
|
1612 |
{ |
|
1613 |
// Forward HandleResourceChange to all Shells (except active one because |
|
1614 |
// already informed through control stack) |
|
1615 |
MSwtShell* shell = iShells[i]; |
|
1616 |
if (shell != iActiveShell) |
|
1617 |
{ |
|
1618 |
shell->Control()->CoeControl().HandleResourceChange(aType); |
|
1619 |
} |
|
1620 |
} |
|
1621 |
#ifdef RD_JAVA_S60_RELEASE_9_2 |
|
1622 |
if (aType == KAknSplitInputDisabled) |
|
1623 |
{ |
|
1624 |
SetSplitInputEditor(0); |
|
1625 |
} |
|
1626 |
#endif |
|
1627 |
} |
|
1628 |
||
1629 |
// --------------------------------------------------------------------------- |
|
1630 |
// CSwtUiUtils::ScrollBarBreadth |
|
1631 |
// From MSwtUiUtils |
|
1632 |
// --------------------------------------------------------------------------- |
|
1633 |
// |
|
1634 |
TInt CSwtUiUtils::ScrollBarBreadth(const CEikScrollBar* aBar) |
|
1635 |
{ |
|
1636 |
if (!aBar) |
|
1637 |
{ |
|
1638 |
return 0; |
|
1639 |
} |
|
1640 |
||
1641 |
if (iScrollBarBreadth < 0) |
|
1642 |
{ |
|
1643 |
iScrollBarBreadth = aBar->ScrollBarBreadth(); |
|
1644 |
} |
|
1645 |
#if 0 |
|
1646 |
else |
|
1647 |
{ |
|
1648 |
ASSERT(aBar->ScrollBarBreadth() == iScrollBarBreadth); |
|
1649 |
} |
|
1650 |
#endif |
|
1651 |
return iScrollBarBreadth; |
|
1652 |
} |
|
1653 |
||
1654 |
// --------------------------------------------------------------------------- |
|
1655 |
// CSwtUiUtils::NaviKeyInput |
|
1656 |
// From MSwtUiUtils |
|
1657 |
// --------------------------------------------------------------------------- |
|
1658 |
// |
|
1659 |
TBool CSwtUiUtils::NaviKeyInput() const |
|
1660 |
{ |
|
1661 |
return iNaviKeyInput; |
|
1662 |
} |
|
1663 |
||
1664 |
// --------------------------------------------------------------------------- |
|
1665 |
// CSwtUiUtils::SetLastInputIsKey |
|
1666 |
// From MSwtUiUtils |
|
1667 |
// --------------------------------------------------------------------------- |
|
1668 |
// |
|
1669 |
void CSwtUiUtils::SetNaviKeyInput(TBool aStatus) |
|
1670 |
{ |
|
1671 |
TBool prevNaviKeyInput(iNaviKeyInput); |
|
1672 |
iNaviKeyInput = aStatus; |
|
1673 |
if (prevNaviKeyInput != iNaviKeyInput) |
|
1674 |
{ |
|
1675 |
if (iActiveShell) |
|
1676 |
{ |
|
1677 |
iActiveShell->UpdateHighlight(); |
|
1678 |
} |
|
1679 |
} |
|
1680 |
} |
|
1681 |
||
1682 |
// --------------------------------------------------------------------------- |
|
1683 |
// CSwtUiUtils::SetCbaVisible |
|
1684 |
// From MSwtUiUtils |
|
1685 |
// --------------------------------------------------------------------------- |
|
1686 |
// |
|
1687 |
void CSwtUiUtils::SetCbaVisible(TBool aVisible) |
|
1688 |
{ |
|
1689 |
ASSERT(iCba); |
|
1690 |
if (aVisible == iCba->IsVisible()) |
|
1691 |
{ |
|
1692 |
return; |
|
1693 |
} |
|
1694 |
iCba->MakeVisible(aVisible); |
|
1695 |
||
1696 |
#ifdef RD_JAVA_S60_RELEASE_9_2 |
|
1697 |
// To enable clock pane in landscape after MIDlet was started |
|
1698 |
iCba->SetBoundingRect(TRect(0, 0, 0, 0)); |
|
1699 |
#endif // RD_JAVA_S60_RELEASE_9_2 |
|
1700 |
} |
|
1701 |
||
1702 |
// --------------------------------------------------------------------------- |
|
1703 |
// CSwtUiUtils::GetPointerGrabbingControl |
|
1704 |
// From MSwtUiUtils |
|
1705 |
// --------------------------------------------------------------------------- |
|
1706 |
// |
|
1707 |
MSwtControl* CSwtUiUtils::GetPointerGrabbingControl() |
|
1708 |
{ |
|
1709 |
MSwtControl* grabbingControl = iPointerCaptureControl; |
|
1710 |
if (grabbingControl) |
|
1711 |
{ |
|
1712 |
return grabbingControl; |
|
1713 |
} |
|
1714 |
||
1715 |
MSwtComposite* composite = NULL; |
|
1716 |
||
1717 |
if (iActiveShell) |
|
1718 |
{ |
|
1719 |
composite = iActiveShell->Composite(); |
|
1720 |
grabbingControl = iActiveShell->Control(); |
|
1721 |
} |
|
1722 |
||
1723 |
MSwtControl* ctrl = NULL; |
|
1724 |
while (composite) |
|
1725 |
{ |
|
1726 |
ctrl = composite->GetPointerGrabbingControl(); |
|
1727 |
if (!ctrl) |
|
1728 |
break; |
|
1729 |
grabbingControl = ctrl; |
|
1730 |
composite = grabbingControl->CompositeInterface(); |
|
1731 |
} |
|
1732 |
||
1733 |
return grabbingControl; |
|
1734 |
} |
|
1735 |
||
1736 |
// --------------------------------------------------------------------------- |
|
1737 |
// CSwtUiUtils::HandleFreeRamEventL |
|
1738 |
// From MSwtUiUtils |
|
1739 |
// --------------------------------------------------------------------------- |
|
1740 |
// |
|
1741 |
TRect CSwtUiUtils::TaskTipRect() const |
|
1742 |
{ |
|
1743 |
TRect screenRect; |
|
1744 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, screenRect); |
|
1745 |
TAknLayoutRect layoutMainPane = CSwtLafFacade::GetLayoutRect( |
|
1746 |
CSwtLafFacade::EMainEswtPane, |
|
1747 |
screenRect, |
|
1748 |
KVariationFullScreen); |
|
1749 |
TRect mainPaneRect = layoutMainPane.Rect(); |
|
1750 |
TAknLayoutRect layoutShell = CSwtLafFacade::GetLayoutRect( |
|
1751 |
CSwtLafFacade::EPopupEswtTasktipWindow, |
|
1752 |
mainPaneRect); |
|
1753 |
return layoutShell.Rect(); |
|
1754 |
} |
|
1755 |
||
1756 |
// --------------------------------------------------------------------------- |
|
1757 |
// CSwtUiUtils::SetPointerCaptureControl |
|
1758 |
// From MSwtUtils |
|
1759 |
// --------------------------------------------------------------------------- |
|
1760 |
// |
|
1761 |
void CSwtUiUtils::SetPointerCaptureControl(MSwtControl* aControl) |
|
1762 |
{ |
|
1763 |
if (aControl) |
|
1764 |
{ |
|
1765 |
iPointerCaptureControl = aControl; |
|
1766 |
} |
|
1767 |
else |
|
1768 |
{ |
|
1769 |
iPointerCaptureControl = NULL; |
|
1770 |
} |
|
1771 |
} |
|
1772 |
||
1773 |
// --------------------------------------------------------------------------- |
|
1774 |
// CSwtUiUtils::PointerCaptureControl |
|
1775 |
// From MSwtUtils |
|
1776 |
// --------------------------------------------------------------------------- |
|
1777 |
// |
|
1778 |
MSwtControl* CSwtUiUtils::PointerCaptureControl() |
|
1779 |
{ |
|
1780 |
return iPointerCaptureControl; |
|
1781 |
} |
|
1782 |
||
1783 |
// --------------------------------------------------------------------------- |
|
1784 |
// CSwtUiUtils::SetSplitInputEditor |
|
1785 |
// From MSwtUtils |
|
1786 |
// --------------------------------------------------------------------------- |
|
1787 |
// |
|
1788 |
void CSwtUiUtils::SetSplitInputEditor(MSwtControl* aEditor) |
|
1789 |
{ |
|
1790 |
if (iSplitInputEditor == aEditor) |
|
1791 |
{ |
|
1792 |
// This can happen when pressing Enter in a multi line editor. |
|
1793 |
return; |
|
1794 |
} |
|
1795 |
||
1796 |
CAknAppUi* appUi = (CAknAppUi*)iDisplay.CoeEnv()->EikAppUi(); |
|
1797 |
||
1798 |
if (aEditor) |
|
1799 |
{ |
|
1800 |
MSwtShell& shell = aEditor->GetShell(); |
|
1801 |
MSwtControl* view = ScrolledCompositeAncestor(*aEditor); |
|
1802 |
TBool editorSwitch(iSplitInputEditor != 0); |
|
1803 |
TBool keepView(view && view == iSplitInputView); |
|
1804 |
TBool keepShell(editorSwitch && ((&iSplitInputEditor->GetShell()) == (&shell))); |
|
1805 |
||
1806 |
if (editorSwitch) |
|
1807 |
{ |
|
1808 |
if (!keepShell) |
|
1809 |
{ |
|
1810 |
// Move back the previous split input Shell keeping the SP hidden. |
|
1811 |
DoSetSplitInputShellPos(iSplitInputShellPos); |
|
1812 |
} |
|
1813 |
// Otherwise no need for the shell to restore its original |
|
1814 |
// position as it is going to be moved again right after this. |
|
1815 |
||
1816 |
if (!keepView) |
|
1817 |
{ |
|
1818 |
// Resize back the previous split input view |
|
1819 |
DoSetSplitInputViewSize(iSplitInputViewSize); |
|
1820 |
} |
|
1821 |
} |
|
1822 |
||
1823 |
iSplitInputEditor = aEditor; |
|
1824 |
iSplitInputView = view; |
|
1825 |
if (!iSplitInputView) |
|
1826 |
{ |
|
1827 |
iSplitInputView = iSplitInputEditor; |
|
1828 |
} |
|
1829 |
||
1830 |
if (!editorSwitch || !keepShell) |
|
1831 |
{ |
|
1832 |
iSplitInputShellPos = shell.Control()->GetLocation(); |
|
1833 |
} |
|
1834 |
||
1835 |
if (!editorSwitch) |
|
1836 |
{ |
|
1837 |
iSplitInputSPVisible = iStatusPane->IsVisible(); |
|
1838 |
} |
|
1839 |
||
1840 |
if (iStatusPane->IsVisible()) |
|
1841 |
{ |
|
1842 |
// Hide the SP. The observer must be cleared before so that |
|
1843 |
// HandleStatusPaneSizeChange is not called on the Shell. |
|
1844 |
iStatusPane->SetObserver(NULL); |
|
1845 |
iStatusPane->MakeVisible(EFalse); |
|
1846 |
} |
|
1847 |
||
1848 |
if (!keepView) |
|
1849 |
{ |
|
1850 |
iSplitInputViewSize = TSize(0, 0); |
|
1851 |
SetSplitInputViewSize(iSplitInputView->GetWidgetSize()); |
|
1852 |
} |
|
1853 |
||
1854 |
if (!editorSwitch && view) |
|
1855 |
{ |
|
1856 |
TRAP_IGNORE(iDisplay.PostShowFocusedControlEventL(view->JavaPeer())); |
|
1857 |
} |
|
1858 |
} |
|
1859 |
else |
|
1860 |
{ |
|
1861 |
ASSERT(iSplitInputEditor); |
|
1862 |
if (iSplitInputSPVisible) |
|
1863 |
{ |
|
1864 |
iStatusPane->MakeVisible(ETrue); |
|
1865 |
iStatusPane->SetObserver(this); |
|
1866 |
} |
|
1867 |
DoSetSplitInputShellPos(iSplitInputShellPos); |
|
1868 |
DoSetSplitInputViewSize(iSplitInputViewSize); |
|
1869 |
iSplitInputEditor = 0; |
|
1870 |
iSplitInputView = 0; |
|
1871 |
} |
|
1872 |
} |
|
1873 |
||
1874 |
// --------------------------------------------------------------------------- |
|
1875 |
// CSwtUiUtils::SetSplitInputEditor |
|
1876 |
// From MSwtUtils |
|
1877 |
// --------------------------------------------------------------------------- |
|
1878 |
// |
|
1879 |
MSwtControl* CSwtUiUtils::SplitInputEditor() const |
|
1880 |
{ |
|
1881 |
return iSplitInputEditor; |
|
1882 |
} |
|
1883 |
||
1884 |
// --------------------------------------------------------------------------- |
|
1885 |
// CSwtUiUtils::SetSplitInputEditor |
|
1886 |
// From MSwtUtils |
|
1887 |
// --------------------------------------------------------------------------- |
|
1888 |
// |
|
1889 |
MSwtControl* CSwtUiUtils::SplitInputView() const |
|
1890 |
{ |
|
1891 |
return iSplitInputView; |
|
1892 |
} |
|
1893 |
||
1894 |
// --------------------------------------------------------------------------- |
|
1895 |
// CSwtUiUtils::SetSplitInputShellPos |
|
1896 |
// From MSwtUtils |
|
1897 |
// --------------------------------------------------------------------------- |
|
1898 |
// |
|
1899 |
void CSwtUiUtils::SetSplitInputShellPos(const TPoint& aOriginalPos) |
|
1900 |
{ |
|
1901 |
iSplitInputShellPos = aOriginalPos; |
|
1902 |
} |
|
1903 |
||
1904 |
// --------------------------------------------------------------------------- |
|
1905 |
// CSwtUiUtils::SetSplitInputViewSize |
|
1906 |
// From MSwtUtils |
|
1907 |
// --------------------------------------------------------------------------- |
|
1908 |
// |
|
1909 |
void CSwtUiUtils::SetSplitInputViewSize(const TSize& aOriginalSize) |
|
1910 |
{ |
|
1911 |
if (aOriginalSize == iSplitInputViewSize) |
|
1912 |
{ |
|
1913 |
return; |
|
1914 |
} |
|
1915 |
||
1916 |
// Remember the size of the editor and resize it if needed |
|
1917 |
// to fit into remaining space above the vkb. |
|
1918 |
iSplitInputViewSize = aOriginalSize; |
|
1919 |
CAknAppUi* appUi = (CAknAppUi*)iDisplay.CoeEnv()->EikAppUi(); |
|
1920 |
TRect appUiRect(appUi->ClientRect()); |
|
1921 |
TSize size(iSplitInputViewSize); |
|
1922 |
if (size.iHeight > appUiRect.Height()) |
|
1923 |
{ |
|
1924 |
size.iHeight = appUiRect.Height(); |
|
1925 |
} |
|
1926 |
DoSetSplitInputViewSize(size); |
|
1927 |
AdjustSplitInputShellPos(); |
|
1928 |
} |
|
1929 |
||
1930 |
// --------------------------------------------------------------------------- |
|
1931 |
// CSwtUiUtils::AdjustSplitInputShellPos |
|
1932 |
// From MSwtUtils |
|
1933 |
// --------------------------------------------------------------------------- |
|
1934 |
// |
|
1935 |
void CSwtUiUtils::AdjustSplitInputShellPos() |
|
1936 |
{ |
|
1937 |
if (!iSplitInputView) |
|
1938 |
{ |
|
1939 |
return; |
|
1940 |
} |
|
1941 |
||
1942 |
CAknAppUi *appUi = (CAknAppUi*)(iDisplay.CoeEnv()->EikAppUi()); |
|
1943 |
TInt appUiHeight(appUi->ClientRect().Height()); |
|
1944 |
MSwtShell & shell = iSplitInputView->GetShell(); |
|
1945 |
TInt shellHeight(shell.Control()->GetWidgetSize().iHeight); |
|
1946 |
TRect rect(iSplitInputView->VisibleRect()); |
|
1947 |
TInt y(-rect.iTl.iY + (appUiHeight - rect.Height()) / 2); |
|
1948 |
if (y < (appUiHeight - shellHeight)) |
|
1949 |
y = appUiHeight - shellHeight; |
|
1950 |
||
1951 |
if (!shell.GetParentShell()) |
|
1952 |
{ |
|
1953 |
if (y > 0) |
|
1954 |
y = 0; |
|
1955 |
} |
|
1956 |
else |
|
1957 |
{ |
|
1958 |
if (y > iSplitInputShellPos.iY) |
|
1959 |
y = iSplitInputShellPos.iY; |
|
1960 |
||
1961 |
} |
|
1962 |
DoSetSplitInputShellPos(TPoint(iSplitInputShellPos.iX, y)); |
|
1963 |
} |
|
1964 |
||
1965 |
// --------------------------------------------------------------------------- |
|
1966 |
// CSwtUiUtils::HandleFreeRamEventL |
|
1967 |
// From MSwtUiUtils |
|
1968 |
// --------------------------------------------------------------------------- |
|
1969 |
// |
|
1970 |
void CSwtUiUtils::HandleFreeRamEventL(TInt aEventType) |
|
1971 |
{ |
|
1972 |
const TInt count = iShells.Count(); |
|
1973 |
for (TInt i = count - 1; i >= 0; --i) |
|
1974 |
{ |
|
1975 |
MSwtShell* shell = iShells[i]; |
|
1976 |
FreeBrowserRamL(shell->Composite(), aEventType); |
|
1977 |
} |
|
1978 |
} |
|
1979 |
||
1980 |
// --------------------------------------------------------------------------- |
|
1981 |
// CSwtUiUtils::HandleStatusPaneSizeChange |
|
1982 |
// From MEikStatusPaneObserver |
|
1983 |
// --------------------------------------------------------------------------- |
|
1984 |
// |
|
1985 |
void CSwtUiUtils::HandleStatusPaneSizeChange() |
|
1986 |
{ |
|
1987 |
const TInt count = iShells.Count(); |
|
1988 |
for (TInt i = 0; i < count; ++i) |
|
1989 |
{ |
|
1990 |
iShells[i]->HandleStatusPaneSizeChange(); |
|
1991 |
} |
|
1992 |
} |
|
1993 |
||
1994 |
// --------------------------------------------------------------------------- |
|
1995 |
// CSwtUiUtils::CountFadedComponents |
|
1996 |
// From MAknFadedComponent |
|
1997 |
// --------------------------------------------------------------------------- |
|
1998 |
// |
|
1999 |
TInt CSwtUiUtils::CountFadedComponents() |
|
2000 |
{ |
|
2001 |
TInt res(0); |
|
2002 |
if (CanBeFaded(iActiveShell)) |
|
2003 |
{ |
|
2004 |
res = 2; // Cba + Shell |
|
2005 |
const RSwtControlArray* children = iActiveShell->Composite()->Children(); |
|
2006 |
if (children) |
|
2007 |
{ |
|
2008 |
TInt count = children->Count(); |
|
2009 |
TInt j(0); |
|
2010 |
for (TInt i = 0; i < count; i++) |
|
2011 |
{ |
|
2012 |
MSwtControl* child = (*children)[i]; |
|
2013 |
if (child->IsShell()) |
|
2014 |
{ |
|
2015 |
j++; |
|
2016 |
} |
|
2017 |
} |
|
2018 |
res += j; |
|
2019 |
} |
|
2020 |
} |
|
2021 |
return res; |
|
2022 |
} |
|
2023 |
||
2024 |
// --------------------------------------------------------------------------- |
|
2025 |
// CSwtUiUtils::FadedComponent |
|
2026 |
// From MAknFadedComponent |
|
2027 |
// --------------------------------------------------------------------------- |
|
2028 |
// |
|
2029 |
CCoeControl* CSwtUiUtils::FadedComponent(TInt aIndex) |
|
2030 |
{ |
|
2031 |
if (CanBeFaded(iActiveShell)) |
|
2032 |
{ |
|
2033 |
if (aIndex == 0) |
|
2034 |
{ |
|
2035 |
return iCba; |
|
2036 |
} |
|
2037 |
else if (aIndex == 1) |
|
2038 |
{ |
|
2039 |
return &iActiveShell->Control()->CoeControl(); |
|
2040 |
} |
|
2041 |
else |
|
2042 |
{ |
|
2043 |
const RSwtControlArray* children = iActiveShell->Composite()->Children(); |
|
2044 |
if (children) |
|
2045 |
{ |
|
2046 |
TInt count = children->Count(); |
|
2047 |
for (TInt i = 0, j = 0; i < count; i++) |
|
2048 |
{ |
|
2049 |
MSwtControl* child = (*children)[i]; |
|
2050 |
if (child->IsShell()) |
|
2051 |
{ |
|
2052 |
if (aIndex - 2 == j) |
|
2053 |
{ |
|
2054 |
return &child->CoeControl(); |
|
2055 |
} |
|
2056 |
j++; |
|
2057 |
} |
|
2058 |
} |
|
2059 |
} |
|
2060 |
} |
|
2061 |
} |
|
2062 |
||
2063 |
// Shouldnt happen |
|
2064 |
return NULL; |
|
2065 |
} |
|
2066 |
||
2067 |
// --------------------------------------------------------------------------- |
|
2068 |
// CSwtUiUtils::SetShellFade |
|
2069 |
// --------------------------------------------------------------------------- |
|
2070 |
// |
|
2071 |
void CSwtUiUtils::SetShellFade(MSwtShell* aShell, TBool aStatus) |
|
2072 |
{ |
|
2073 |
if (CanBeFaded(aShell)) |
|
2074 |
{ |
|
2075 |
if (aStatus) |
|
2076 |
{ |
|
2077 |
iFadingShell = aShell; |
|
2078 |
} |
|
2079 |
iFader.FadeBehindPopup(this, &aShell->Control()->CoeControl(), aStatus); |
|
2080 |
if (!aStatus) |
|
2081 |
{ |
|
2082 |
iFadingShell = NULL; |
|
2083 |
} |
|
2084 |
} |
|
2085 |
} |
|
2086 |
||
2087 |
// --------------------------------------------------------------------------- |
|
2088 |
// CSwtUiUtils::CanBeFaded |
|
2089 |
// --------------------------------------------------------------------------- |
|
2090 |
// |
|
2091 |
TBool CSwtUiUtils::CanBeFaded(MSwtShell* aShell) const |
|
2092 |
{ |
|
2093 |
return (aShell && aShell->GetParentShell() && IsApplicationModal(*aShell)); |
|
2094 |
} |
|
2095 |
||
2096 |
// --------------------------------------------------------------------------- |
|
2097 |
// CSwtUiUtils::RegisterFixScreenOrientation |
|
2098 |
// --------------------------------------------------------------------------- |
|
2099 |
// |
|
2100 |
void CSwtUiUtils::RegisterFixScreenOrientation() |
|
2101 |
{ |
|
2102 |
iFixScreenOrientationApplicantsCount++; |
|
2103 |
||
2104 |
// Store the old setting for the first applicant only |
|
2105 |
if (iFixScreenOrientationApplicantsCount == 1) |
|
2106 |
{ |
|
2107 |
iOldUiOrientation = iAvkonAppUi->Orientation(); |
|
2108 |
iRestoreOrientation = |
|
2109 |
(iOldUiOrientation == CAknAppUiBase::EAppUiOrientationUnspecified); |
|
2110 |
||
2111 |
// Fix the orientation when was set to unspecified only |
|
2112 |
if (iRestoreOrientation) |
|
2113 |
{ |
|
2114 |
TRAP_IGNORE(iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape)); |
|
2115 |
} |
|
2116 |
} |
|
2117 |
} |
|
2118 |
||
2119 |
void CSwtUiUtils::UnRegisterFixScreenOrientation() |
|
2120 |
{ |
|
2121 |
if (iFixScreenOrientationApplicantsCount > 0) |
|
2122 |
{ |
|
2123 |
iFixScreenOrientationApplicantsCount--; |
|
2124 |
||
2125 |
if (iFixScreenOrientationApplicantsCount == 0 && iRestoreOrientation) |
|
2126 |
{ |
|
2127 |
TRAP_IGNORE(iAvkonAppUi->SetOrientationL(iOldUiOrientation)); |
|
2128 |
iRestoreOrientation = EFalse; |
|
2129 |
} |
|
2130 |
} |
|
2131 |
} |
|
2132 |
||
2133 |
TBool CSwtUiUtils::IsScreenOrientationFixed() const |
|
2134 |
{ |
|
2135 |
return iFixScreenOrientationApplicantsCount > 0; |
|
2136 |
} |
|
2137 |