|
1 /* |
|
2 * Copyright (c) 2002-2008 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: EIKON Status Pane model and layouts. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikspmod.h> |
|
20 #include <barsread.h> |
|
21 #include <eikenv.h> |
|
22 #include <eikcoctl.rsg> |
|
23 #include <AknSgcc.h> |
|
24 #include <aknenv.h> |
|
25 #include <aknlayout.cdl.h> |
|
26 #include <AknUtils.h> |
|
27 #include <AknLayout.lag> |
|
28 #include <applayout.cdl.h> |
|
29 |
|
30 #include <aknlayoutscalable_avkon.cdl.h> |
|
31 #include "layoutmetadata.cdl.h" |
|
32 |
|
33 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, TAknWindowComponentLayout aLine2) |
|
34 { |
|
35 return TAknWindowComponentLayout::Compose(aLine1, aLine2); |
|
36 } |
|
37 |
|
38 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, TAknTextComponentLayout aLine2) |
|
39 { |
|
40 return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); |
|
41 } |
|
42 |
|
43 const TInt KStatusPaneSetInitGranularity = 4; |
|
44 const TInt KEikSpanePositionMask = 3; |
|
45 |
|
46 |
|
47 inline TBool TEikStatusPaneInit::Initialized() { return iFlags & KEikStatusPaneInitInitializedBit; } |
|
48 inline void TEikStatusPaneInit::SetInitialized() { iFlags |= KEikStatusPaneInitInitializedBit; } |
|
49 |
|
50 inline CEikStatusPaneLayoutTree::TDirection CEikStatusPaneLayoutTree::Direction() { return (iFlags & KEikStatusPaneDirectionBit) ? EVertical : EHorizontal; } |
|
51 inline TInt CEikStatusPaneLayoutTree::Size() { return iSize; } |
|
52 inline TBool CEikStatusPaneLayoutTree::Stretchable() { return iFlags & EEikStatusPaneIsStretchable; } |
|
53 |
|
54 |
|
55 TEikStatusPaneInit::TEikStatusPaneInit() |
|
56 : iControlId(0), iControlResource(0), iFlags(0) |
|
57 { |
|
58 } |
|
59 |
|
60 TEikStatusPaneInit::TEikStatusPaneInit(const TEikStatusPaneInit& aCopy) |
|
61 { |
|
62 *this = aCopy; |
|
63 } |
|
64 |
|
65 TEikStatusPaneInit& TEikStatusPaneInit::operator=(const TEikStatusPaneInit& aCopy) |
|
66 { |
|
67 // Don't copy id or flags - these will have been set when this structure was first loaded |
|
68 if (aCopy.iControlId) |
|
69 { |
|
70 iControlId = aCopy.iControlId; |
|
71 iControlResource = aCopy.iControlResource; |
|
72 } |
|
73 |
|
74 return *this; |
|
75 } |
|
76 |
|
77 void TEikStatusPaneInit::LoadDefaults(TResourceReader& aResource) |
|
78 { |
|
79 iId = TUid::Uid(aResource.ReadInt32()); |
|
80 iFlags = aResource.ReadUint16(); |
|
81 iControlId = aResource.ReadUint16(); |
|
82 iControlResource = aResource.ReadUint32(); |
|
83 } |
|
84 |
|
85 |
|
86 |
|
87 CEikStatusPaneSetInit* CEikStatusPaneSetInit::NewL() |
|
88 { |
|
89 CEikStatusPaneSetInit* self = new(ELeave) CEikStatusPaneSetInit(); |
|
90 return self; |
|
91 } |
|
92 |
|
93 CEikStatusPaneSetInit::~CEikStatusPaneSetInit() |
|
94 { |
|
95 } |
|
96 |
|
97 void CEikStatusPaneSetInit::LoadDefaultsL(TResourceReader& aResource) |
|
98 { |
|
99 const TBool initialized = (Count() != 0); |
|
100 const TInt count=aResource.ReadInt16(); |
|
101 |
|
102 for (TInt ii=0;ii<count;++ii) |
|
103 { |
|
104 TEikStatusPaneInit init; |
|
105 init.LoadDefaults(aResource); |
|
106 if ( init.ControlResourceId() ) |
|
107 { |
|
108 if (initialized) |
|
109 { |
|
110 FindL(init.Id()) = init; |
|
111 } |
|
112 else |
|
113 { |
|
114 AppendL(init); |
|
115 } |
|
116 } |
|
117 } |
|
118 } |
|
119 |
|
120 CEikStatusPaneSetInit::CEikStatusPaneSetInit() |
|
121 : CArrayFixFlat<TEikStatusPaneInit>(KStatusPaneSetInitGranularity) |
|
122 { |
|
123 } |
|
124 |
|
125 TEikStatusPaneInit& CEikStatusPaneSetInit::FindL(const TPaneId& aPaneId) |
|
126 { |
|
127 for (TInt i=0; i<Count(); i++) |
|
128 { |
|
129 if (At(i).Id() == aPaneId) |
|
130 return At(i); |
|
131 } |
|
132 |
|
133 User::Leave(KErrNotFound); |
|
134 return At(0); // will never get here |
|
135 } |
|
136 |
|
137 CEikStatusPaneLayoutTree::~CEikStatusPaneLayoutTree() |
|
138 { |
|
139 if (iSubPanes) |
|
140 iSubPanes->ResetAndDestroy(); |
|
141 delete iSubPanes; |
|
142 } |
|
143 |
|
144 CEikStatusPaneLayoutTree* CEikStatusPaneLayoutTree::NewL(CEikStatusPaneLayout* aLayout, TResourceReader& aResource, TDirection aDefaultDirection) |
|
145 { |
|
146 CEikStatusPaneLayoutTree* self = new(ELeave) CEikStatusPaneLayoutTree(aLayout, aDefaultDirection); |
|
147 CleanupStack::PushL(self); |
|
148 self->ConstructL(aResource); |
|
149 CleanupStack::Pop(); |
|
150 return self; |
|
151 } |
|
152 |
|
153 CEikStatusPaneLayoutTree* CEikStatusPaneLayoutTree::Find(const TPaneId& aPaneId) |
|
154 { |
|
155 if (iId == aPaneId) |
|
156 return this; |
|
157 else if (iSubPanes) |
|
158 { |
|
159 for (TInt i=0; i<iSubPanes->Count(); i++) |
|
160 { |
|
161 CEikStatusPaneLayoutTree* pane = iSubPanes->At(i)->Find(aPaneId); |
|
162 if (pane) |
|
163 return pane; |
|
164 } |
|
165 } |
|
166 |
|
167 return NULL; |
|
168 } |
|
169 |
|
170 CEikStatusPaneLayoutTree::CEikStatusPaneLayoutTree(CEikStatusPaneLayout* aLayout, TDirection aDefaultDirection) |
|
171 : iLayout(aLayout) |
|
172 { |
|
173 SetDirection(aDefaultDirection); |
|
174 } |
|
175 |
|
176 void CEikStatusPaneLayoutTree::ConstructL(TResourceReader& aResource) |
|
177 { |
|
178 iId.iUid = aResource.ReadInt32(); |
|
179 |
|
180 TDirection dir = Direction(); |
|
181 iFlags = aResource.ReadUint16(); |
|
182 SetDirection(dir); |
|
183 |
|
184 iSize = aResource.ReadUint16(); |
|
185 |
|
186 TDirection subDir = Direction() == EVertical ? EHorizontal : EVertical; // Change direction for sub panes |
|
187 |
|
188 const TInt count=aResource.ReadInt16(); |
|
189 if (count > 0) |
|
190 { |
|
191 iSubPanes = new(ELeave) CSubPaneArray(count); |
|
192 for (TInt ii=0;ii<count;++ii) |
|
193 { |
|
194 CEikStatusPaneLayoutTree* pane = CEikStatusPaneLayoutTree::NewL(iLayout, aResource, subDir); |
|
195 CleanupStack::PushL(pane); |
|
196 iSubPanes->AppendL(pane); |
|
197 CleanupStack::Pop(); // pane |
|
198 } |
|
199 } |
|
200 } |
|
201 |
|
202 void CEikStatusPaneLayoutTree::Layout() |
|
203 { |
|
204 if (!iSubPanes) |
|
205 return; |
|
206 |
|
207 TInt unallocedSize = Direction()==EHorizontal ? iRect.Width() : iRect.Height(); |
|
208 TInt stretchSize = 0; |
|
209 |
|
210 TInt count = iSubPanes->Count(); |
|
211 TInt i; |
|
212 for (i=0; i<count; i++) |
|
213 { |
|
214 CEikStatusPaneLayoutTree* subPane = iSubPanes->At(i); |
|
215 |
|
216 TInt size = subPane->Size(); |
|
217 |
|
218 if (subPane->Stretchable()) |
|
219 stretchSize += size; |
|
220 else |
|
221 unallocedSize -= size; |
|
222 } |
|
223 |
|
224 TPoint pos( iRect.iTl ); |
|
225 |
|
226 for (i=0; i<count; i++) |
|
227 { |
|
228 CEikStatusPaneLayoutTree* subPane = iSubPanes->At(i); |
|
229 |
|
230 TInt size( subPane->Size() ); |
|
231 |
|
232 if (size > 0 && subPane->Stretchable() && stretchSize != 0) |
|
233 { |
|
234 TInt oldSize = size; |
|
235 size = (size * unallocedSize) / stretchSize; |
|
236 unallocedSize -= size; |
|
237 stretchSize -= oldSize; |
|
238 } |
|
239 |
|
240 TSize subSize( iRect.Size() ); |
|
241 if (Direction()==EHorizontal) |
|
242 subSize.iWidth = size; |
|
243 else |
|
244 subSize.iHeight = size; |
|
245 subPane->SetRect(TRect(pos,subSize)); |
|
246 |
|
247 if (Direction()==EHorizontal) |
|
248 pos.iX += size; |
|
249 else |
|
250 pos.iY += size; |
|
251 } |
|
252 } |
|
253 |
|
254 void CEikStatusPaneLayoutTree::SetDirection(TDirection aDirection) |
|
255 { |
|
256 if (aDirection == EVertical) |
|
257 iFlags |= KEikStatusPaneDirectionBit; |
|
258 else |
|
259 iFlags &= ~KEikStatusPaneDirectionBit; |
|
260 } |
|
261 |
|
262 void CEikStatusPaneLayoutTree::SetStretchable(TBool aStretchable) |
|
263 { |
|
264 if (aStretchable) |
|
265 iFlags |= EEikStatusPaneIsStretchable; |
|
266 else |
|
267 iFlags &= ~EEikStatusPaneIsStretchable; |
|
268 } |
|
269 |
|
270 void CEikStatusPaneLayoutTree::SetRect(const TRect& aRect) |
|
271 { |
|
272 iRect = aRect; |
|
273 Layout(); |
|
274 } |
|
275 |
|
276 void CEikStatusPaneLayoutTree::AcceptL(MEikStatusPaneLayoutTreeVisitor* aVisitor) |
|
277 { |
|
278 if (iId.iUid != 0) |
|
279 aVisitor->VisitL(this); |
|
280 |
|
281 if (iSubPanes) |
|
282 { |
|
283 for (TInt i=0; i<iSubPanes->Count(); i++) |
|
284 { |
|
285 iSubPanes->At(i)->AcceptL(aVisitor); |
|
286 } |
|
287 } |
|
288 } |
|
289 |
|
290 void CEikStatusPaneLayoutTree::SetAknLayoutUsed(TBool aAknLayoutUsed) |
|
291 { |
|
292 if (aAknLayoutUsed) |
|
293 { |
|
294 iFlags |= EEikStatusPaneLayoutAknLafDefined; |
|
295 } |
|
296 else |
|
297 { |
|
298 iFlags &= ~EEikStatusPaneLayoutAknLafDefined; |
|
299 } |
|
300 } |
|
301 |
|
302 TBool CEikStatusPaneLayoutTree::AknLayoutUsed() |
|
303 { |
|
304 if ( iFlags & EEikStatusPaneLayoutAknLafDefined ) |
|
305 { |
|
306 return ETrue; |
|
307 } |
|
308 else |
|
309 { |
|
310 return EFalse; |
|
311 } |
|
312 } |
|
313 |
|
314 |
|
315 void CEikStatusPaneLayoutTree::Layout(TInt aLayoutId) |
|
316 { |
|
317 if (!AknLayoutUsed()) |
|
318 { |
|
319 Layout(); |
|
320 } |
|
321 else |
|
322 { |
|
323 TRect rectFromAknLayout( AknLayoutRect(aLayoutId, iId) ); |
|
324 if (rectFromAknLayout.Size() != TSize(0,0)) |
|
325 { |
|
326 iRect = rectFromAknLayout; |
|
327 } |
|
328 |
|
329 if (!iSubPanes) |
|
330 return; |
|
331 |
|
332 TInt count = iSubPanes->Count(); |
|
333 TInt i; |
|
334 for (i=0; i<count; i++) |
|
335 { |
|
336 CEikStatusPaneLayoutTree* subPane = iSubPanes->At(i); |
|
337 subPane->SetAknLayoutUsed(ETrue); |
|
338 subPane->Layout(aLayoutId); |
|
339 } |
|
340 } |
|
341 } |
|
342 |
|
343 TRect CEikStatusPaneLayoutTree::AknLayoutRect(TInt aLayoutId, TPaneId aPaneId) |
|
344 { |
|
345 const TBool idleIndicatorsInLandscapeAreVertical = EFalse; |
|
346 |
|
347 // Note that small digital clock cannot be shown in such displays that have smaller aspect ratio than 4:3. |
|
348 #ifndef __SERIES60_31__ |
|
349 TBool smallDigitalClockInStacon = ETrue; |
|
350 TBool smallDigitalClockInLandscapeFlatSpUsual = ETrue; |
|
351 TBool smallDigitalClockInLandscapeFlatSpIdle = ETrue; |
|
352 #else |
|
353 TBool smallDigitalClockInStacon = EFalse; |
|
354 TBool smallDigitalClockInLandscapeFlatSpUsual = EFalse; |
|
355 TBool smallDigitalClockInLandscapeFlatSpIdle = EFalse; |
|
356 #endif |
|
357 |
|
358 TRect paneRect; // initialises to (0,0,0,0); |
|
359 TRect parentRect; // initialises to (0,0,0,0); |
|
360 TAknWindowLineLayout layout; |
|
361 Mem::FillZ(&layout, sizeof(layout)); |
|
362 |
|
363 const TRect& screenRect = iLayout->iScreenRect; |
|
364 const TRect& mainPaneRect = iLayout->iMainPaneRect; |
|
365 const TRect& usualStatusPaneRect = iLayout->iUsualStatusPaneRect; |
|
366 const TRect& applicationWindowRect = iLayout->iApplicationWindowRect; |
|
367 |
|
368 const AknLayout::CInstance& aknLayout = iLayout->iAknLayout; |
|
369 const AknLayoutScalable_Avkon::CInstance& aknLayoutScalable_Avkon = iLayout->iAknLayoutScalable_Avkon; |
|
370 |
|
371 switch (aLayoutId) |
|
372 { |
|
373 case R_AVKON_STATUS_PANE_LAYOUT_USUAL: |
|
374 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED: |
|
375 { |
|
376 parentRect = usualStatusPaneRect; |
|
377 switch(aPaneId.iUid) |
|
378 { |
|
379 case EEikStatusPaneUidNavi: |
|
380 { |
|
381 layout = aknLayoutScalable_Avkon.navi_pane(0).LayoutLine(); |
|
382 break; |
|
383 } |
|
384 case EEikStatusPaneUidSignal: |
|
385 { |
|
386 layout = aknLayoutScalable_Avkon.signal_pane(0).LayoutLine(); |
|
387 break; |
|
388 } |
|
389 case EEikStatusPaneUidContext: |
|
390 { |
|
391 layout = aknLayoutScalable_Avkon.context_pane(0).LayoutLine(); |
|
392 break; |
|
393 } |
|
394 case EEikStatusPaneUidTitle: |
|
395 { |
|
396 layout = aknLayoutScalable_Avkon.title_pane(0).LayoutLine(); |
|
397 break; |
|
398 } |
|
399 case EEikStatusPaneUidIndic: |
|
400 { |
|
401 layout = aknLayoutScalable_Avkon.uni_indicator_pane(0).LayoutLine(); |
|
402 break; |
|
403 } |
|
404 case EEikStatusPaneUidBattery: |
|
405 { |
|
406 layout = aknLayoutScalable_Avkon.battery_pane(0).LayoutLine(); |
|
407 break; |
|
408 } |
|
409 } |
|
410 break; |
|
411 } |
|
412 |
|
413 case R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT: |
|
414 case R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT: |
|
415 { |
|
416 // Final check for small digital clock, shown only in resolutions having aspect |
|
417 // ratio equal or wider than qvga because otherwise there is no space for it. |
|
418 if (smallDigitalClockInStacon) |
|
419 { |
|
420 TReal aspectRatio = TReal(screenRect.Width()) / TReal(screenRect.Height()); |
|
421 if (aspectRatio < 1.33) |
|
422 smallDigitalClockInStacon = EFalse; |
|
423 } |
|
424 |
|
425 |
|
426 TInt variety = 0; |
|
427 TInt clockVariety = 1; |
|
428 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT) |
|
429 { |
|
430 // softkeys left |
|
431 variety = 1; |
|
432 clockVariety = 3; |
|
433 } |
|
434 |
|
435 const TRect layout1Rect( iLayout->iStaconLayout1Rect ); |
|
436 const TRect layout2Rect( iLayout->iStaconLayout2Rect ); |
|
437 |
|
438 switch(aPaneId.iUid) |
|
439 { |
|
440 case EEikStatusPaneUidNavi: |
|
441 { |
|
442 // If clock is shown, then use different variety for navipane |
|
443 if (smallDigitalClockInStacon) |
|
444 variety +=2; |
|
445 |
|
446 parentRect = layout2Rect; |
|
447 layout = aknLayoutScalable_Avkon.navi_pane_stacon(variety).LayoutLine(); |
|
448 break; |
|
449 } |
|
450 case EEikStatusPaneUidSignal: |
|
451 { |
|
452 parentRect = layout1Rect; |
|
453 layout = aknLayoutScalable_Avkon.signal_pane_stacon(variety).LayoutLine(); |
|
454 break; |
|
455 } |
|
456 case EEikStatusPaneUidTitle: |
|
457 { |
|
458 parentRect = layout1Rect; |
|
459 if (smallDigitalClockInStacon) |
|
460 { |
|
461 TInt titleVariety = 4; |
|
462 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT) |
|
463 { |
|
464 titleVariety = 5; |
|
465 } |
|
466 layout = aknLayoutScalable_Avkon.title_pane_stacon(titleVariety).LayoutLine(); |
|
467 } |
|
468 else |
|
469 { |
|
470 layout = aknLayoutScalable_Avkon.title_pane_stacon(variety).LayoutLine(); |
|
471 } |
|
472 break; |
|
473 } |
|
474 case EEikStatusPaneUidIndic: |
|
475 { |
|
476 if (smallDigitalClockInStacon) |
|
477 { |
|
478 TInt indicatorVariety = 1; |
|
479 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT) |
|
480 { |
|
481 indicatorVariety = 5; |
|
482 } |
|
483 parentRect = layout1Rect; |
|
484 layout = aknLayoutScalable_Avkon.indicator_nsta_pane_cp2(indicatorVariety).LayoutLine(); |
|
485 } |
|
486 else |
|
487 { |
|
488 parentRect = layout1Rect; |
|
489 layout = aknLayoutScalable_Avkon.uni_indicator_pane_stacon(variety).LayoutLine(); |
|
490 } |
|
491 break; |
|
492 } |
|
493 case EEikStatusPaneUidBattery: |
|
494 { |
|
495 parentRect = layout2Rect; |
|
496 layout = aknLayoutScalable_Avkon.battery_pane_stacon(variety).LayoutLine(); |
|
497 break; |
|
498 } |
|
499 case EEikStatusPaneUidDigitalClock: |
|
500 { |
|
501 if (smallDigitalClockInStacon) |
|
502 { |
|
503 parentRect = layout2Rect; |
|
504 layout = aknLayoutScalable_Avkon.clock_nsta_pane_cp2(clockVariety).LayoutLine(); |
|
505 } |
|
506 break; |
|
507 } |
|
508 } |
|
509 break; |
|
510 } |
|
511 |
|
512 case R_AVKON_STATUS_PANE_LAYOUT_SMALL: |
|
513 { |
|
514 switch(aPaneId.iUid) |
|
515 { |
|
516 // In this layout navi pane gets the whole small status pane area. |
|
517 case EEikStatusPaneUidNavi: |
|
518 { |
|
519 paneRect = iLayout->iSmallStatusPaneRect; |
|
520 break; |
|
521 } |
|
522 } |
|
523 break; |
|
524 } |
|
525 |
|
526 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE: |
|
527 case R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED: |
|
528 { |
|
529 parentRect = iLayout->iSmallStatusPaneRect; |
|
530 switch(aPaneId.iUid) |
|
531 { |
|
532 case EEikStatusPaneUidNavi: |
|
533 { |
|
534 // avkon LAF doesn't provide this directly, some calculations are needed. |
|
535 paneRect = parentRect; |
|
536 TAknWindowLineLayout smallStatusSignalLayout( |
|
537 AknLayoutScalable_Avkon::status_small_pane_g2(0).LayoutLine() ); |
|
538 TAknLayoutRect smallStatusSignalLayoutRect; |
|
539 smallStatusSignalLayoutRect.LayoutRect(parentRect, smallStatusSignalLayout); |
|
540 TRect smallStatusSignalRect( smallStatusSignalLayoutRect.Rect() ); |
|
541 |
|
542 if (AknLayoutUtils::LayoutMirrored()) |
|
543 { |
|
544 paneRect.iBr.iX -= smallStatusSignalRect.Width(); |
|
545 } |
|
546 else |
|
547 { |
|
548 paneRect.iTl.iX += smallStatusSignalRect.Width(); |
|
549 } |
|
550 |
|
551 break; |
|
552 } |
|
553 case EEikStatusPaneUidSignal: |
|
554 { |
|
555 layout = AknLayoutScalable_Avkon::status_small_pane_g2(0).LayoutLine(); |
|
556 // Adjustment needed for BSK LSC for navi pane and signal pane to be the same height |
|
557 layout.iH = parentRect.Height(); |
|
558 break; |
|
559 } |
|
560 } |
|
561 break; |
|
562 } |
|
563 |
|
564 case R_AVKON_STATUS_PANE_LAYOUT_IDLE: |
|
565 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED: |
|
566 { |
|
567 // by default "idle" statuspane values have "usual" statuspane as parent in LAF |
|
568 parentRect = usualStatusPaneRect; |
|
569 switch(aPaneId.iUid) |
|
570 { |
|
571 case EEikStatusPaneUidNavi: |
|
572 { |
|
573 layout = aknLayout.navi_pane(1); |
|
574 break; |
|
575 } |
|
576 case EEikStatusPaneUidSignal: |
|
577 { |
|
578 layout = aknLayout.signal_pane(parentRect); |
|
579 break; |
|
580 } |
|
581 |
|
582 case EEikStatusPaneUidBattery: |
|
583 { |
|
584 layout = aknLayout.battery_pane(parentRect); |
|
585 break; |
|
586 } |
|
587 case EEikStatusPaneUidTitle: |
|
588 { |
|
589 layout = aknLayout.title_pane(1); |
|
590 break; |
|
591 } |
|
592 case EEikStatusPaneUidIndic: |
|
593 { |
|
594 // Exceptionally mainpane as parent |
|
595 parentRect = mainPaneRect; |
|
596 layout = aknLayout.indicator_pane(); |
|
597 break; |
|
598 } |
|
599 case EEikStatusPaneUidClock: |
|
600 { |
|
601 // Exceptionally idle statuspane as parent |
|
602 TAknWindowLineLayout idleStatusPaneLayout( aknLayout.status_pane(applicationWindowRect, 1) ); |
|
603 TAknLayoutRect idleStatusPaneLayoutRect; |
|
604 idleStatusPaneLayoutRect.LayoutRect(applicationWindowRect, idleStatusPaneLayout); |
|
605 parentRect = idleStatusPaneLayoutRect.Rect(); |
|
606 layout = aknLayout.context_pane(parentRect, 1); |
|
607 break; |
|
608 } |
|
609 } |
|
610 break; |
|
611 } |
|
612 |
|
613 case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE: |
|
614 case R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE_MIRRORED: |
|
615 { |
|
616 switch(aPaneId.iUid) |
|
617 { |
|
618 case EEikStatusPaneUidBattery: |
|
619 { |
|
620 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
621 { |
|
622 TAknLayoutRect layoutRect; |
|
623 TAknWindowComponentLayout parentLayout = aknLayoutScalable_Avkon.area_top_pane(8); |
|
624 layoutRect.LayoutRect(screenRect, parentLayout.LayoutLine()); |
|
625 parentRect = layoutRect.Rect(); |
|
626 layout = aknLayoutScalable_Avkon.battery_pane(2).LayoutLine(); |
|
627 } |
|
628 else |
|
629 { |
|
630 parentRect = usualStatusPaneRect; |
|
631 layout = aknLayout.battery_pane(parentRect); |
|
632 } |
|
633 break; |
|
634 } |
|
635 } |
|
636 break; |
|
637 } |
|
638 |
|
639 case R_AVKON_STATUS_PANE_LAYOUT_VT: |
|
640 case R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED: |
|
641 { |
|
642 parentRect = usualStatusPaneRect; |
|
643 switch(aPaneId.iUid) |
|
644 { |
|
645 case EEikStatusPaneUidNavi: |
|
646 { |
|
647 layout = aknLayout.navi_pane(1); |
|
648 break; |
|
649 } |
|
650 case EEikStatusPaneUidSignal: |
|
651 { |
|
652 layout = aknLayout.signal_pane(parentRect); |
|
653 break; |
|
654 } |
|
655 case EEikStatusPaneUidBattery: |
|
656 { |
|
657 layout = aknLayout.battery_pane(parentRect); |
|
658 break; |
|
659 } |
|
660 case EEikStatusPaneUidContext: |
|
661 { |
|
662 // note, uses idle version of context pane but needs to |
|
663 // have usual statuspane as parent to provide correct height. |
|
664 layout = aknLayout.context_pane(parentRect, 1); |
|
665 break; |
|
666 } |
|
667 case EEikStatusPaneUidTitle: |
|
668 { |
|
669 // LAF does not anymore define this. We calculate. |
|
670 RRegion titleRegion; |
|
671 layout = aknLayout.title_pane(1); // Idle titlepane |
|
672 |
|
673 TAknLayoutRect LayoutRect; |
|
674 LayoutRect.LayoutRect(parentRect, layout); |
|
675 paneRect = LayoutRect.Rect(); |
|
676 |
|
677 layout = aknLayout.uni_indicator_pane(parentRect); |
|
678 LayoutRect.LayoutRect(parentRect, layout); |
|
679 TRect indicatorRect( LayoutRect.Rect() ); |
|
680 |
|
681 // Title and indicator overlaps, reduce indicator area. |
|
682 titleRegion.AddRect(paneRect); |
|
683 titleRegion.SubRect(indicatorRect); |
|
684 |
|
685 paneRect = titleRegion.BoundingRect(); |
|
686 titleRegion.Close(); |
|
687 break; |
|
688 } |
|
689 case EEikStatusPaneUidIndic: |
|
690 { |
|
691 layout = aknLayout.uni_indicator_pane(parentRect); |
|
692 break; |
|
693 } |
|
694 } |
|
695 break; |
|
696 } |
|
697 |
|
698 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_WITH_BATTERY_PANE: |
|
699 { |
|
700 parentRect = usualStatusPaneRect; |
|
701 switch(aPaneId.iUid) |
|
702 { |
|
703 case EEikStatusPaneUidNavi: |
|
704 { |
|
705 layout = aknLayout.navi_pane(0); |
|
706 break; |
|
707 } |
|
708 case EEikStatusPaneUidSignal: |
|
709 { |
|
710 layout = aknLayout.signal_pane(parentRect); |
|
711 break; |
|
712 } |
|
713 case EEikStatusPaneUidContext: |
|
714 { |
|
715 layout = aknLayout.context_pane(parentRect, 0); |
|
716 break; |
|
717 } |
|
718 case EEikStatusPaneUidTitle: |
|
719 { |
|
720 layout = aknLayout.title_pane(0); |
|
721 break; |
|
722 } |
|
723 case EEikStatusPaneUidIndic: |
|
724 { |
|
725 layout = aknLayout.uni_indicator_pane(parentRect); |
|
726 break; |
|
727 } |
|
728 case EEikStatusPaneUidBattery: |
|
729 { |
|
730 layout = aknLayout.battery_pane(parentRect); |
|
731 break; |
|
732 } |
|
733 } |
|
734 break; |
|
735 } |
|
736 |
|
737 case R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT: |
|
738 case R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT: |
|
739 { |
|
740 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
741 { |
|
742 |
|
743 // Final check for small digital clock, shown only in resolutions having aspect |
|
744 // ratio equal or wider than qvga because otherwise there is no space for it. |
|
745 if (smallDigitalClockInStacon) |
|
746 { |
|
747 TReal aspectRatio = TReal(screenRect.Width()) / TReal(screenRect.Height()); |
|
748 if (aspectRatio < 1.33) |
|
749 smallDigitalClockInStacon = EFalse; |
|
750 } |
|
751 |
|
752 TInt variety = 0; |
|
753 TInt clockVariety = 1; |
|
754 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT) |
|
755 { |
|
756 variety = 1; // softkeys left |
|
757 clockVariety = 3; |
|
758 } |
|
759 |
|
760 const TRect layout1Rect( iLayout->iStaconLayout1Rect ); |
|
761 const TRect layout2Rect( iLayout->iStaconLayout2Rect ); |
|
762 |
|
763 switch(aPaneId.iUid) |
|
764 { |
|
765 case EEikStatusPaneUidNavi: |
|
766 { |
|
767 // If clock is shown, then use different variety for navipane |
|
768 if (smallDigitalClockInStacon) |
|
769 variety +=2; |
|
770 |
|
771 parentRect = layout2Rect; |
|
772 layout = aknLayoutScalable_Avkon.navi_pane_stacon(variety).LayoutLine(); |
|
773 break; |
|
774 } |
|
775 case EEikStatusPaneUidSignal: |
|
776 { |
|
777 parentRect = layout1Rect; |
|
778 layout = aknLayoutScalable_Avkon.signal_pane_stacon(variety).LayoutLine(); |
|
779 break; |
|
780 } |
|
781 case EEikStatusPaneUidTitle: |
|
782 { |
|
783 if (smallDigitalClockInStacon) |
|
784 { |
|
785 parentRect = layout1Rect; |
|
786 TInt titleVariety = 4; |
|
787 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT) |
|
788 { |
|
789 titleVariety = 5; |
|
790 } |
|
791 layout = aknLayoutScalable_Avkon.title_pane_stacon(titleVariety).LayoutLine(); |
|
792 } |
|
793 else |
|
794 { |
|
795 // LAF does not provide yet variety for idle titlepane so we strecth the |
|
796 // titlepane here to cover universal indicators too which is not used in this |
|
797 // layout. |
|
798 layout = aknLayoutScalable_Avkon.title_pane_stacon(variety).LayoutLine(); |
|
799 TAknLayoutRect LayoutRect; |
|
800 LayoutRect.LayoutRect(parentRect, layout); |
|
801 paneRect = LayoutRect.Rect(); |
|
802 |
|
803 TRect tmpParentRect( layout1Rect ); |
|
804 TAknWindowLineLayout tmpLayout( aknLayoutScalable_Avkon.uni_indicator_pane_stacon(variety).LayoutLine() ); |
|
805 TAknLayoutRect tmpLayoutRect; |
|
806 tmpLayoutRect.LayoutRect(tmpParentRect, tmpLayout); |
|
807 TRect tmpRect( tmpLayoutRect.Rect() ); |
|
808 |
|
809 paneRect.BoundingRect(tmpRect); |
|
810 } |
|
811 break; |
|
812 } |
|
813 case EEikStatusPaneUidIndic: |
|
814 { |
|
815 if (smallDigitalClockInStacon) |
|
816 { |
|
817 TInt indicatorVariety = 1; |
|
818 if (aLayoutId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT) |
|
819 { |
|
820 indicatorVariety = 5; |
|
821 } |
|
822 parentRect = layout1Rect; |
|
823 layout = aknLayoutScalable_Avkon.indicator_nsta_pane_cp2(indicatorVariety).LayoutLine(); |
|
824 } |
|
825 else |
|
826 { |
|
827 // Exceptionally mainpane as parent |
|
828 parentRect = mainPaneRect; |
|
829 if (idleIndicatorsInLandscapeAreVertical) |
|
830 layout = aknLayoutScalable_Avkon.indicator_pane(3).LayoutLine(); // Vertical status indicators |
|
831 else |
|
832 layout = aknLayoutScalable_Avkon.indicator_pane(1).LayoutLine(); // Horizontal status indicators, always in right side exept in A&H |
|
833 } |
|
834 |
|
835 break; |
|
836 } |
|
837 case EEikStatusPaneUidBattery: |
|
838 { |
|
839 parentRect = layout2Rect; |
|
840 layout = aknLayoutScalable_Avkon.battery_pane_stacon(variety).LayoutLine(); |
|
841 break; |
|
842 } |
|
843 case EEikStatusPaneUidEmpty: |
|
844 { |
|
845 if (smallDigitalClockInStacon) |
|
846 { |
|
847 parentRect = layout2Rect; |
|
848 layout = aknLayoutScalable_Avkon.clock_nsta_pane_cp2(clockVariety).LayoutLine(); |
|
849 } |
|
850 break; |
|
851 } |
|
852 } |
|
853 } |
|
854 break; |
|
855 } |
|
856 |
|
857 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT: |
|
858 { |
|
859 TAknWindowComponentLayout parentLayout; |
|
860 |
|
861 TBool landscapeOrientation( |
|
862 Layout_Meta_Data::IsLandscapeOrientation() ); |
|
863 |
|
864 // Is bottom softkey touch landscape layout in use. |
|
865 TBool touchLsc( landscapeOrientation && |
|
866 Layout_Meta_Data::IsPenEnabled() ); |
|
867 |
|
868 if ( landscapeOrientation ) |
|
869 { |
|
870 if ( touchLsc ) |
|
871 { |
|
872 parentLayout = aknLayoutScalable_Avkon.area_top_pane( 2 ); |
|
873 } |
|
874 else |
|
875 { |
|
876 parentLayout = aknLayoutScalable_Avkon.area_top_pane( 8 ); |
|
877 } |
|
878 } |
|
879 else |
|
880 { |
|
881 parentLayout = aknLayoutScalable_Avkon.area_top_pane(6); |
|
882 smallDigitalClockInLandscapeFlatSpUsual = EFalse; |
|
883 } |
|
884 |
|
885 TAknLayoutRect layoutRect; |
|
886 layoutRect.LayoutRect(screenRect, parentLayout.LayoutLine()); |
|
887 parentRect = layoutRect.Rect(); |
|
888 switch(aPaneId.iUid) |
|
889 { |
|
890 case EEikStatusPaneUidNavi: |
|
891 { |
|
892 layout = |
|
893 aknLayoutScalable_Avkon.navi_pane( |
|
894 touchLsc ? 9 : 2 ).LayoutLine(); |
|
895 |
|
896 break; |
|
897 } |
|
898 case EEikStatusPaneUidSignal: |
|
899 { |
|
900 layout = aknLayoutScalable_Avkon.signal_pane( touchLsc ? 14 : 2 ).LayoutLine(); |
|
901 break; |
|
902 } |
|
903 case EEikStatusPaneUidTitle: |
|
904 { |
|
905 if ( touchLsc ) |
|
906 { |
|
907 layout = aknLayoutScalable_Avkon.title_pane( 11 ).LayoutLine(); |
|
908 } |
|
909 else if ( landscapeOrientation && |
|
910 smallDigitalClockInLandscapeFlatSpUsual ) |
|
911 { |
|
912 // LAF does not provide yet variety for titlepane in this case so we strecth the |
|
913 // titlepane here to cover universal indicators too which is not used in this |
|
914 // layout. |
|
915 layout = aknLayoutScalable_Avkon.title_pane(2).LayoutLine(); |
|
916 TAknLayoutRect LayoutRect; |
|
917 LayoutRect.LayoutRect(parentRect, layout); |
|
918 paneRect = LayoutRect.Rect(); |
|
919 |
|
920 TAknWindowLineLayout tmpLayout( aknLayoutScalable_Avkon.uni_indicator_pane(1).LayoutLine() ); |
|
921 TAknLayoutRect tmpLayoutRect; |
|
922 tmpLayoutRect.LayoutRect(parentRect, tmpLayout); |
|
923 TRect tmpRect( tmpLayoutRect.Rect() ); |
|
924 |
|
925 paneRect.BoundingRect(tmpRect); |
|
926 } |
|
927 else |
|
928 { |
|
929 layout = aknLayoutScalable_Avkon.title_pane(2).LayoutLine(); |
|
930 } |
|
931 break; |
|
932 } |
|
933 case EEikStatusPaneUidIndic: |
|
934 { |
|
935 if ( landscapeOrientation && |
|
936 smallDigitalClockInLandscapeFlatSpUsual ) |
|
937 { |
|
938 // Indicators are located in control pane area. |
|
939 TAknWindowComponentLayout bottomArea( |
|
940 AknLayoutScalable_Avkon::area_bottom_pane( touchLsc ? 2 : 6 ) ); |
|
941 TAknWindowComponentLayout controlPane( |
|
942 AknLayoutScalable_Avkon::control_pane() ); |
|
943 TAknWindowComponentLayout nstaClockIndicPane( |
|
944 AknLayoutScalable_Avkon::nsta_clock_indic_pane() ); |
|
945 TAknWindowComponentLayout indicatorNstaPane( |
|
946 AknLayoutScalable_Avkon::indicator_nsta_pane_cp() ); |
|
947 indicatorNstaPane = |
|
948 DoCompose( bottomArea, |
|
949 DoCompose( controlPane, |
|
950 DoCompose( nstaClockIndicPane, |
|
951 indicatorNstaPane ) ) ); |
|
952 layout = indicatorNstaPane.LayoutLine(); |
|
953 parentRect = applicationWindowRect; |
|
954 } |
|
955 else |
|
956 { |
|
957 layout = aknLayoutScalable_Avkon.uni_indicator_pane(1).LayoutLine(); |
|
958 } |
|
959 break; |
|
960 } |
|
961 case EEikStatusPaneUidBattery: |
|
962 { |
|
963 layout = aknLayoutScalable_Avkon.battery_pane( touchLsc ? 14 : 2 ).LayoutLine(); |
|
964 break; |
|
965 } |
|
966 case EEikStatusPaneUidDigitalClock: |
|
967 { |
|
968 if (smallDigitalClockInLandscapeFlatSpUsual) |
|
969 { |
|
970 TAknWindowComponentLayout bottomArea( |
|
971 aknLayoutScalable_Avkon.area_bottom_pane( touchLsc ? 2 : 6 ) ); |
|
972 TAknWindowComponentLayout controlPane( |
|
973 aknLayoutScalable_Avkon.control_pane() ); |
|
974 TAknWindowComponentLayout nstaClockIndicPane( |
|
975 aknLayoutScalable_Avkon.nsta_clock_indic_pane() ); |
|
976 TAknWindowComponentLayout clockNstaPane( |
|
977 aknLayoutScalable_Avkon.clock_nsta_pane_cp() ); |
|
978 clockNstaPane = DoCompose( |
|
979 bottomArea, |
|
980 DoCompose( |
|
981 controlPane, |
|
982 DoCompose( |
|
983 nstaClockIndicPane, clockNstaPane ) ) ); |
|
984 layout = clockNstaPane.LayoutLine(); |
|
985 parentRect = applicationWindowRect; |
|
986 } |
|
987 else |
|
988 { |
|
989 paneRect = TRect(0,0,0,1); |
|
990 } |
|
991 break; |
|
992 } |
|
993 } |
|
994 break; |
|
995 } |
|
996 |
|
997 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT: |
|
998 { |
|
999 TBool landscapeOrientation( |
|
1000 Layout_Meta_Data::IsLandscapeOrientation() ); |
|
1001 |
|
1002 // Is bottom softkey touch landscape layout in use. |
|
1003 TBool touchLsc( landscapeOrientation && |
|
1004 Layout_Meta_Data::IsPenEnabled() ); |
|
1005 |
|
1006 TAknWindowComponentLayout parentLayout; |
|
1007 |
|
1008 if ( landscapeOrientation ) |
|
1009 { |
|
1010 if ( touchLsc ) |
|
1011 { |
|
1012 parentLayout = aknLayoutScalable_Avkon.area_top_pane( 2 ); |
|
1013 } |
|
1014 else |
|
1015 { |
|
1016 parentLayout = aknLayoutScalable_Avkon.area_top_pane( 8 ); |
|
1017 } |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 parentLayout = aknLayoutScalable_Avkon.area_top_pane( 6 ); |
|
1022 smallDigitalClockInLandscapeFlatSpIdle = EFalse; |
|
1023 } |
|
1024 |
|
1025 TAknLayoutRect layoutRect; |
|
1026 layoutRect.LayoutRect( screenRect, parentLayout.LayoutLine() ); |
|
1027 parentRect = layoutRect.Rect(); |
|
1028 |
|
1029 switch ( aPaneId.iUid ) |
|
1030 { |
|
1031 case EEikStatusPaneUidNavi: |
|
1032 { |
|
1033 layout = |
|
1034 aknLayoutScalable_Avkon.navi_pane( |
|
1035 touchLsc ? 9 : 2 ).LayoutLine(); |
|
1036 break; |
|
1037 } |
|
1038 case EEikStatusPaneUidSignal: |
|
1039 { |
|
1040 layout = aknLayoutScalable_Avkon.signal_pane( touchLsc ? 14 : 2 ).LayoutLine(); |
|
1041 break; |
|
1042 } |
|
1043 case EEikStatusPaneUidTitle: |
|
1044 { |
|
1045 // LAF does not provide yet variety for idle title pane so |
|
1046 // we strecth the title pane here to cover universal |
|
1047 // indicators too which is not used in this layout. |
|
1048 if ( touchLsc ) |
|
1049 { |
|
1050 layout = aknLayoutScalable_Avkon.title_pane( 11 ).LayoutLine(); |
|
1051 } |
|
1052 else if ( landscapeOrientation ) |
|
1053 { |
|
1054 layout = aknLayoutScalable_Avkon.title_pane( 2 ).LayoutLine(); |
|
1055 TAknLayoutRect LayoutRect; |
|
1056 LayoutRect.LayoutRect( parentRect, layout ); |
|
1057 paneRect = LayoutRect.Rect(); |
|
1058 |
|
1059 TAknWindowLineLayout tmpLayout( |
|
1060 aknLayoutScalable_Avkon.uni_indicator_pane( 1 ).LayoutLine() ); |
|
1061 TAknLayoutRect tmpLayoutRect; |
|
1062 tmpLayoutRect.LayoutRect( parentRect, tmpLayout ); |
|
1063 TRect tmpRect( tmpLayoutRect.Rect() ); |
|
1064 |
|
1065 paneRect.BoundingRect( tmpRect ); |
|
1066 } |
|
1067 else |
|
1068 { |
|
1069 layout = aknLayoutScalable_Avkon.title_pane( 2 ).LayoutLine(); |
|
1070 } |
|
1071 break; |
|
1072 } |
|
1073 case EEikStatusPaneUidIndic: |
|
1074 { |
|
1075 // Exceptionally mainpane as parent. |
|
1076 // Note that this is main_pane for flat statuspane. |
|
1077 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1078 { |
|
1079 if ( smallDigitalClockInLandscapeFlatSpIdle ) |
|
1080 { |
|
1081 // Indicators are located in control pane area. |
|
1082 TAknWindowComponentLayout bottomArea( |
|
1083 aknLayoutScalable_Avkon.area_bottom_pane( touchLsc ? 2 : 6 ) ); |
|
1084 TAknWindowComponentLayout controlPane( |
|
1085 aknLayoutScalable_Avkon.control_pane() ); |
|
1086 TAknWindowComponentLayout nstaClockIndicPane( |
|
1087 aknLayoutScalable_Avkon.nsta_clock_indic_pane() ); |
|
1088 TAknWindowComponentLayout indicatorNstaPane( |
|
1089 aknLayoutScalable_Avkon.indicator_nsta_pane_cp() ); |
|
1090 indicatorNstaPane = |
|
1091 DoCompose( bottomArea, |
|
1092 DoCompose( controlPane, |
|
1093 DoCompose( nstaClockIndicPane, |
|
1094 indicatorNstaPane ) ) ); |
|
1095 layout = indicatorNstaPane.LayoutLine(); |
|
1096 parentRect = applicationWindowRect; |
|
1097 } |
|
1098 else |
|
1099 { |
|
1100 // Exceptionally mainpane as parent |
|
1101 parentRect = mainPaneRect; |
|
1102 if ( idleIndicatorsInLandscapeAreVertical ) |
|
1103 { |
|
1104 // Vertical status indicators |
|
1105 layout = aknLayoutScalable_Avkon.indicator_pane( 3 ).LayoutLine(); |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 // Horizontal status indicators |
|
1110 layout = aknLayoutScalable_Avkon.indicator_pane( 1 ).LayoutLine(); |
|
1111 } |
|
1112 } |
|
1113 } |
|
1114 else |
|
1115 { |
|
1116 layout = aknLayoutScalable_Avkon.uni_indicator_pane( 1 ).LayoutLine(); |
|
1117 } |
|
1118 |
|
1119 break; |
|
1120 } |
|
1121 case EEikStatusPaneUidDigitalClock: |
|
1122 { |
|
1123 if ( smallDigitalClockInLandscapeFlatSpIdle ) |
|
1124 { |
|
1125 TAknWindowComponentLayout bottomArea( |
|
1126 aknLayoutScalable_Avkon.area_bottom_pane( touchLsc ? 2 : 6 ) ); |
|
1127 TAknWindowComponentLayout controlPane( |
|
1128 aknLayoutScalable_Avkon.control_pane() ); |
|
1129 TAknWindowComponentLayout nstaClockIndicPane( |
|
1130 aknLayoutScalable_Avkon.nsta_clock_indic_pane() ); |
|
1131 TAknWindowComponentLayout clockNstaPane( |
|
1132 aknLayoutScalable_Avkon.clock_nsta_pane_cp() ); |
|
1133 clockNstaPane = DoCompose( |
|
1134 bottomArea, |
|
1135 DoCompose( |
|
1136 controlPane, |
|
1137 DoCompose( |
|
1138 nstaClockIndicPane, clockNstaPane ) ) ); |
|
1139 layout = clockNstaPane.LayoutLine(); |
|
1140 parentRect = applicationWindowRect; |
|
1141 } |
|
1142 else |
|
1143 { |
|
1144 paneRect = TRect(0,0,0,1); |
|
1145 } |
|
1146 |
|
1147 break; |
|
1148 } |
|
1149 case EEikStatusPaneUidBattery: |
|
1150 { |
|
1151 layout = aknLayoutScalable_Avkon.battery_pane( touchLsc ? 14 : 2 ).LayoutLine(); |
|
1152 break; |
|
1153 } |
|
1154 } |
|
1155 break; |
|
1156 } |
|
1157 |
|
1158 case R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT: |
|
1159 { |
|
1160 // For now we use classic statuspane |
|
1161 parentRect = usualStatusPaneRect; |
|
1162 |
|
1163 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1164 { |
|
1165 switch(aPaneId.iUid) |
|
1166 { |
|
1167 case EEikStatusPaneUidNavi: |
|
1168 { |
|
1169 layout = aknLayoutScalable_Avkon.navi_pane(7).LayoutLine(); // wide navi pane layout |
|
1170 break; |
|
1171 } |
|
1172 case EEikStatusPaneUidSignal: |
|
1173 { |
|
1174 layout = aknLayoutScalable_Avkon.signal_pane(7).LayoutLine(); |
|
1175 break; |
|
1176 } |
|
1177 case EEikStatusPaneUidTitle: |
|
1178 { |
|
1179 layout = aknLayoutScalable_Avkon.title_pane(7).LayoutLine(); |
|
1180 break; |
|
1181 } |
|
1182 case EEikStatusPaneUidIndic: |
|
1183 { |
|
1184 layout = aknLayoutScalable_Avkon.indicator_nsta_pane().LayoutLine(); |
|
1185 break; |
|
1186 } |
|
1187 case EEikStatusPaneUidBattery: |
|
1188 { |
|
1189 layout = aknLayoutScalable_Avkon.battery_pane(7).LayoutLine(); |
|
1190 break; |
|
1191 } |
|
1192 case EEikStatusPaneUidDigitalClock: |
|
1193 { |
|
1194 layout = aknLayoutScalable_Avkon.clock_nsta_pane().LayoutLine(); |
|
1195 break; |
|
1196 } |
|
1197 case EEikStatusPaneUidEmpty: |
|
1198 { |
|
1199 layout = aknLayoutScalable_Avkon.aid_fill_nsta(2).LayoutLine(); // fill for wide navi pane |
|
1200 TAknLayoutRect LayoutRect; |
|
1201 LayoutRect.LayoutRect(parentRect, layout); |
|
1202 paneRect = LayoutRect.Rect(); |
|
1203 |
|
1204 TAknWindowLineLayout tmpLayout( aknLayoutScalable_Avkon.aid_fill_nsta_2(1).LayoutLine() ); |
|
1205 TAknLayoutRect tmpLayoutRect; |
|
1206 tmpLayoutRect.LayoutRect(parentRect, tmpLayout); |
|
1207 TRect tmpRect( tmpLayoutRect.Rect() ); |
|
1208 |
|
1209 paneRect.BoundingRect(tmpRect); |
|
1210 break; |
|
1211 } |
|
1212 } |
|
1213 } |
|
1214 break; |
|
1215 } |
|
1216 case R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT: |
|
1217 { |
|
1218 // For now we use classic statuspane |
|
1219 parentRect = usualStatusPaneRect; |
|
1220 |
|
1221 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1222 { |
|
1223 switch(aPaneId.iUid) |
|
1224 { |
|
1225 case EEikStatusPaneUidNavi: |
|
1226 { |
|
1227 layout = aknLayoutScalable_Avkon.navi_pane(6).LayoutLine(); |
|
1228 break; |
|
1229 } |
|
1230 case EEikStatusPaneUidSignal: |
|
1231 { |
|
1232 layout = aknLayoutScalable_Avkon.signal_pane(8).LayoutLine(); |
|
1233 break; |
|
1234 } |
|
1235 case EEikStatusPaneUidTitle: |
|
1236 { |
|
1237 layout = aknLayoutScalable_Avkon.title_pane(8).LayoutLine(); |
|
1238 break; |
|
1239 } |
|
1240 case EEikStatusPaneUidIndic: |
|
1241 { |
|
1242 layout = aknLayoutScalable_Avkon.indicator_nsta_pane(1).LayoutLine(); |
|
1243 break; |
|
1244 } |
|
1245 case EEikStatusPaneUidBattery: |
|
1246 { |
|
1247 layout = aknLayoutScalable_Avkon.battery_pane(8).LayoutLine(); |
|
1248 break; |
|
1249 } |
|
1250 case EEikStatusPaneUidClock: |
|
1251 { |
|
1252 layout = aknLayoutScalable_Avkon.popup_clock_digital_window().LayoutLine(); |
|
1253 break; |
|
1254 } |
|
1255 case EEikStatusPaneUidEmpty: |
|
1256 { |
|
1257 layout = aknLayoutScalable_Avkon.aid_fill_nsta(1).LayoutLine(); |
|
1258 break; |
|
1259 } |
|
1260 } |
|
1261 } |
|
1262 break; |
|
1263 } |
|
1264 |
|
1265 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL: |
|
1266 case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE: |
|
1267 { |
|
1268 if ( Layout_Meta_Data::IsLandscapeOrientation() ) // only usable in landscape |
|
1269 { |
|
1270 TAknLayoutRect layout1ParentRect; |
|
1271 layout1ParentRect.LayoutRect( |
|
1272 iLayout->iApplicationWindowRect, |
|
1273 iLayout->iAknLayoutScalable_Avkon.area_top_pane( 8 ).LayoutLine() ); |
|
1274 TAknLayoutRect layout1Rect; |
|
1275 layout1Rect.LayoutRect( |
|
1276 layout1ParentRect.Rect(), |
|
1277 iLayout->iAknLayoutScalable_Avkon.status_pane( 1 ).LayoutLine() ); |
|
1278 parentRect = layout1Rect.Rect(); |
|
1279 |
|
1280 switch ( aPaneId.iUid ) |
|
1281 { |
|
1282 case EEikStatusPaneUidNavi: |
|
1283 { |
|
1284 layout = |
|
1285 aknLayoutScalable_Avkon.navi_pane( 8 ).LayoutLine(); |
|
1286 break; |
|
1287 } |
|
1288 case EEikStatusPaneUidSignal: |
|
1289 { |
|
1290 layout = |
|
1291 aknLayoutScalable_Avkon.signal_pane( 10 ).LayoutLine(); |
|
1292 break; |
|
1293 } |
|
1294 case EEikStatusPaneUidTitle: |
|
1295 { |
|
1296 layout = |
|
1297 aknLayoutScalable_Avkon.title_pane( 10 ).LayoutLine(); |
|
1298 break; |
|
1299 } |
|
1300 case EEikStatusPaneUidIndic: |
|
1301 { |
|
1302 if ( TLocale().TimeFormat() == ETime12 ) |
|
1303 { |
|
1304 layout = |
|
1305 aknLayoutScalable_Avkon.indicator_nsta_pane( 3 ).LayoutLine(); |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 layout = |
|
1310 aknLayoutScalable_Avkon.indicator_nsta_pane_cp_24( 3 ).LayoutLine(); |
|
1311 } |
|
1312 break; |
|
1313 } |
|
1314 case EEikStatusPaneUidBattery: |
|
1315 { |
|
1316 layout = |
|
1317 aknLayoutScalable_Avkon.battery_pane( 10 ).LayoutLine(); |
|
1318 break; |
|
1319 } |
|
1320 case EEikStatusPaneUidDigitalClock: |
|
1321 { |
|
1322 if ( TLocale().TimeFormat() == ETime12 ) |
|
1323 { |
|
1324 layout = |
|
1325 aknLayoutScalable_Avkon.clock_nsta_pane( 2 ).LayoutLine(); |
|
1326 } |
|
1327 else |
|
1328 { |
|
1329 layout = |
|
1330 aknLayoutScalable_Avkon.clock_nsta_pane_cp_24( 2 ).LayoutLine(); |
|
1331 } |
|
1332 break; |
|
1333 } |
|
1334 case EEikStatusPaneUidEmpty: |
|
1335 { |
|
1336 TAknLayoutRect LayoutRect; |
|
1337 LayoutRect.LayoutRect( |
|
1338 parentRect, |
|
1339 aknLayoutScalable_Avkon.aid_fill_nsta( 3 ).LayoutLine() ); |
|
1340 paneRect = LayoutRect.Rect(); |
|
1341 |
|
1342 TAknLayoutRect tmpLayoutRect; |
|
1343 tmpLayoutRect.LayoutRect( |
|
1344 parentRect, |
|
1345 aknLayoutScalable_Avkon.aid_fill_nsta_2( 2 ).LayoutLine() ); |
|
1346 TRect tmpRect( tmpLayoutRect.Rect() ); |
|
1347 |
|
1348 paneRect.BoundingRect( tmpRect ); |
|
1349 |
|
1350 |
|
1351 paneRect = parentRect; |
|
1352 break; |
|
1353 } |
|
1354 } |
|
1355 } |
|
1356 break; |
|
1357 } |
|
1358 |
|
1359 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT: // fallthrough |
|
1360 case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: |
|
1361 { |
|
1362 if ( Layout_Meta_Data::IsLandscapeOrientation() ) // only usable in landscape |
|
1363 { |
|
1364 TAknLayoutRect layout1ParentRect; |
|
1365 layout1ParentRect.LayoutRect( |
|
1366 iLayout->iApplicationWindowRect, |
|
1367 iLayout->iAknLayoutScalable_Avkon.area_top_pane( 19 ).LayoutLine() ); |
|
1368 TAknLayoutRect layout1Rect; |
|
1369 layout1Rect.LayoutRect( |
|
1370 layout1ParentRect.Rect(), |
|
1371 iLayout->iAknLayoutScalable_Avkon.status_pane( 4 ).LayoutLine() ); |
|
1372 parentRect = layout1Rect.Rect(); |
|
1373 |
|
1374 switch ( aPaneId.iUid ) |
|
1375 { |
|
1376 case EEikStatusPaneUidNavi: |
|
1377 { |
|
1378 layout = |
|
1379 aknLayoutScalable_Avkon.navi_pane( 9 ).LayoutLine(); |
|
1380 break; |
|
1381 } |
|
1382 case EEikStatusPaneUidSignal: |
|
1383 { |
|
1384 layout = |
|
1385 aknLayoutScalable_Avkon.signal_pane( 11 ).LayoutLine(); |
|
1386 break; |
|
1387 } |
|
1388 case EEikStatusPaneUidTitle: |
|
1389 { |
|
1390 layout = |
|
1391 aknLayoutScalable_Avkon.title_pane( 11 ).LayoutLine(); |
|
1392 break; |
|
1393 } |
|
1394 case EEikStatusPaneUidIndic: |
|
1395 { |
|
1396 layout = |
|
1397 aknLayoutScalable_Avkon.uni_indicator_pane( 3 ).LayoutLine(); |
|
1398 break; |
|
1399 } |
|
1400 case EEikStatusPaneUidBattery: |
|
1401 { |
|
1402 layout = |
|
1403 aknLayoutScalable_Avkon.battery_pane( 11 ).LayoutLine(); |
|
1404 break; |
|
1405 } |
|
1406 } |
|
1407 } |
|
1408 break; |
|
1409 } |
|
1410 case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS: // fallthrough |
|
1411 case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS: |
|
1412 { |
|
1413 if ( Layout_Meta_Data::IsLandscapeOrientation() ) // only usable in landscape |
|
1414 { |
|
1415 TAknLayoutRect layout1ParentRect; |
|
1416 layout1ParentRect.LayoutRect( |
|
1417 iLayout->iApplicationWindowRect, |
|
1418 iLayout->iAknLayoutScalable_Avkon.area_top_pane( 20 ).LayoutLine() ); |
|
1419 TAknLayoutRect layout1Rect; |
|
1420 layout1Rect.LayoutRect( |
|
1421 layout1ParentRect.Rect(), |
|
1422 iLayout->iAknLayoutScalable_Avkon.status_pane( 5 ).LayoutLine() ); |
|
1423 parentRect = layout1Rect.Rect(); |
|
1424 |
|
1425 switch ( aPaneId.iUid ) |
|
1426 { |
|
1427 case EEikStatusPaneUidNavi: |
|
1428 { |
|
1429 layout = |
|
1430 aknLayoutScalable_Avkon.navi_pane( 11 ).LayoutLine(); |
|
1431 break; |
|
1432 } |
|
1433 case EEikStatusPaneUidSignal: |
|
1434 { |
|
1435 layout = |
|
1436 aknLayoutScalable_Avkon.signal_pane( 13 ).LayoutLine(); |
|
1437 break; |
|
1438 } |
|
1439 case EEikStatusPaneUidTitle: |
|
1440 { |
|
1441 layout = |
|
1442 aknLayoutScalable_Avkon.title_pane( 13 ).LayoutLine(); |
|
1443 break; |
|
1444 } |
|
1445 case EEikStatusPaneUidIndic: |
|
1446 { |
|
1447 layout = |
|
1448 aknLayoutScalable_Avkon.uni_indicator_pane( 5 ).LayoutLine(); |
|
1449 break; |
|
1450 } |
|
1451 case EEikStatusPaneUidBattery: |
|
1452 { |
|
1453 layout = |
|
1454 aknLayoutScalable_Avkon.battery_pane( 13 ).LayoutLine(); |
|
1455 break; |
|
1456 } |
|
1457 case EEikStatusPaneUidDigitalClock: |
|
1458 { |
|
1459 if ( TLocale().TimeFormat() == ETime12 ) |
|
1460 { |
|
1461 layout = |
|
1462 aknLayoutScalable_Avkon.clock_nsta_pane( 3 ).LayoutLine(); |
|
1463 } |
|
1464 else |
|
1465 { |
|
1466 layout = |
|
1467 aknLayoutScalable_Avkon.clock_nsta_pane_cp_24( 11 ).LayoutLine(); |
|
1468 } |
|
1469 break; |
|
1470 } |
|
1471 } |
|
1472 } |
|
1473 break; |
|
1474 } |
|
1475 } // end of switch(aLayoutId) |
|
1476 |
|
1477 if ( paneRect.IsEmpty() && layout.iW != 0 && layout.iH != 0 ) |
|
1478 { |
|
1479 TAknLayoutRect LayoutRect; |
|
1480 LayoutRect.LayoutRect( parentRect, layout ); |
|
1481 paneRect = LayoutRect.Rect(); |
|
1482 } |
|
1483 |
|
1484 #ifdef __DEBUG |
|
1485 if ( paneRect == TRect( 0, 0, 0, 0 ) ) |
|
1486 { |
|
1487 RDebug::Print(_L("CEikStatusPaneLayoutTree::GetRectFromAknLayout, Perhaps an unknown paneID = %d",aPaneId)); |
|
1488 RDebug::Print(_L("CEikStatusPaneLayoutTree::GetRectFromAknLayout, LayoutId = %d",aLayoutId)); |
|
1489 } |
|
1490 #endif |
|
1491 |
|
1492 return paneRect; |
|
1493 } |
|
1494 |
|
1495 CEikStatusPaneLayout* CEikStatusPaneLayout::NewL(TResourceReader& aResource, const TRect& aScreenRect) |
|
1496 { |
|
1497 CEikStatusPaneLayout* self = new(ELeave) CEikStatusPaneLayout(); |
|
1498 CleanupStack::PushL(self); |
|
1499 self->ConstructL(aResource, aScreenRect, 0); |
|
1500 CleanupStack::Pop(); |
|
1501 return self; |
|
1502 } |
|
1503 |
|
1504 CEikStatusPaneLayout* CEikStatusPaneLayout::NewL(TResourceReader& aResource, const TRect& aScreenRect, TInt aLayoutId) |
|
1505 { |
|
1506 CEikStatusPaneLayout* self = new(ELeave) CEikStatusPaneLayout(); |
|
1507 CleanupStack::PushL(self); |
|
1508 self->ConstructL(aResource, aScreenRect, aLayoutId); |
|
1509 CleanupStack::Pop(); |
|
1510 return self; |
|
1511 } |
|
1512 |
|
1513 CEikStatusPaneLayout::~CEikStatusPaneLayout() |
|
1514 { |
|
1515 delete iRoot; |
|
1516 } |
|
1517 |
|
1518 |
|
1519 CEikStatusPaneLayout::CEikStatusPaneLayout() |
|
1520 : iAknLayout(AknLayout::CustomisationInstance()), |
|
1521 iAknLayoutScalable_Avkon(AknLayoutScalable_Avkon::CustomisationInstance()) |
|
1522 { |
|
1523 } |
|
1524 |
|
1525 void CEikStatusPaneLayout::ConstructL(TResourceReader& aResource, const TRect& aScreenRect, TInt aLayoutId) |
|
1526 { |
|
1527 TInt position = aResource.ReadUint16(); |
|
1528 |
|
1529 CEikStatusPaneLayoutTree::TDirection dir = CEikStatusPaneLayoutTree::EHorizontal; |
|
1530 if (position & EEikStatusPaneLayoutVertical) |
|
1531 dir = CEikStatusPaneLayoutTree::EVertical; |
|
1532 |
|
1533 iRoot = CEikStatusPaneLayoutTree::NewL(this, aResource, dir); |
|
1534 |
|
1535 TRect rect( aScreenRect ); |
|
1536 TInt size( iRoot->Size() ); |
|
1537 |
|
1538 TAknWindowComponentLayout applicationWindow( AknLayoutScalable_Avkon::application_window( 0 ) ); |
|
1539 TAknWindowComponentLayout topArea( AknLayoutScalable_Avkon::area_top_pane( 1 ) ); |
|
1540 TAknWindowComponentLayout statusPane( AknLayoutScalable_Avkon::status_pane( 0 ) ); |
|
1541 statusPane = DoCompose( applicationWindow, DoCompose( topArea, statusPane ) ); |
|
1542 TAknLayoutRect statusPaneLayoutRect; |
|
1543 |
|
1544 switch (position & KEikSpanePositionMask) |
|
1545 { |
|
1546 case EEikStatusPanePositionTop: |
|
1547 statusPaneLayoutRect.LayoutRect( rect, statusPane.LayoutLine() ); |
|
1548 rect = statusPaneLayoutRect.Rect(); |
|
1549 break; |
|
1550 |
|
1551 case EEikStatusPanePositionBottom: |
|
1552 rect.iTl.iY = rect.iBr.iY - size; |
|
1553 break; |
|
1554 |
|
1555 case EEikStatusPanePositionLeft: |
|
1556 rect.iBr.iX = rect.iTl.iX + size; |
|
1557 break; |
|
1558 |
|
1559 case EEikStatusPanePositionRight: |
|
1560 default: |
|
1561 rect.iTl.iX = rect.iBr.iX - size; |
|
1562 break; |
|
1563 } |
|
1564 |
|
1565 // Make sure the flag is never used if scalabale ui is not available. |
|
1566 if (position & EEikStatusPaneLayoutAknLafDefined) |
|
1567 { |
|
1568 iRoot->SetAknLayoutUsed(ETrue); |
|
1569 AknLayoutRefresh(aLayoutId); |
|
1570 } |
|
1571 |
|
1572 if (!AknLayoutUsed()) |
|
1573 { |
|
1574 iRoot->SetRect(rect); |
|
1575 } |
|
1576 } |
|
1577 |
|
1578 void CEikStatusPaneLayout::AknLayoutRefresh(TInt aLayoutResourceId) |
|
1579 { |
|
1580 // If layout has been defined by the AknLayout, |
|
1581 // then re-define the layout. |
|
1582 if (AknLayoutUsed()) |
|
1583 { |
|
1584 UpdateLayoutData(aLayoutResourceId); |
|
1585 iRoot->Layout(aLayoutResourceId); |
|
1586 } |
|
1587 } |
|
1588 |
|
1589 TBool CEikStatusPaneLayout::AknLayoutUsed() |
|
1590 { |
|
1591 if (iRoot) |
|
1592 { |
|
1593 return iRoot->AknLayoutUsed(); |
|
1594 } |
|
1595 else |
|
1596 { |
|
1597 return EFalse; |
|
1598 } |
|
1599 } |
|
1600 |
|
1601 void CEikStatusPaneLayout::UpdateLayoutData(TInt aLayoutResId) |
|
1602 { |
|
1603 // screen |
|
1604 TAknWindowLineLayout screenLayout( AknLayout::screen() ); |
|
1605 iScreenRect = screenLayout.Rect(); |
|
1606 |
|
1607 // application window |
|
1608 TAknWindowLineLayout applicationWindowLayout( |
|
1609 iAknLayoutScalable_Avkon.application_window( 0 ).LayoutLine() ); |
|
1610 TAknLayoutRect applicationWindowLayoutRect; |
|
1611 applicationWindowLayoutRect.LayoutRect(iScreenRect, applicationWindowLayout); |
|
1612 iApplicationWindowRect = applicationWindowLayoutRect.Rect(); |
|
1613 |
|
1614 // Main pane |
|
1615 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
1616 TInt mainPaneVariety = landscape ? 4 : 3; |
|
1617 TAknWindowLineLayout mainPaneLayout( iAknLayoutScalable_Avkon.main_pane(mainPaneVariety).LayoutLine() ); |
|
1618 TAknLayoutRect mainPaneLayoutRect; |
|
1619 mainPaneLayoutRect.LayoutRect(iApplicationWindowRect, mainPaneLayout); |
|
1620 iMainPaneRect = mainPaneLayoutRect.Rect(); |
|
1621 |
|
1622 // statuspane, usual |
|
1623 TAknWindowComponentLayout topArea( iAknLayoutScalable_Avkon.area_top_pane( 0 ) ); |
|
1624 TAknWindowComponentLayout statusPaneLayout( iAknLayoutScalable_Avkon.status_pane( 0 ) ); |
|
1625 TAknWindowComponentLayout statusPane( |
|
1626 DoCompose( applicationWindowLayout, DoCompose( topArea, statusPaneLayout ).LayoutLine() ) ); |
|
1627 |
|
1628 TAknLayoutRect statusPaneLayoutRect; |
|
1629 statusPaneLayoutRect.LayoutRect( iScreenRect, statusPane.LayoutLine() ); |
|
1630 iUsualStatusPaneRect = statusPaneLayoutRect.Rect(); |
|
1631 |
|
1632 // statuspane, small |
|
1633 TAknWindowLineLayout topAreaLayout; |
|
1634 if ( AknLayoutUtils::CbaLocation() == AknLayoutUtils::EAknCbaLocationBottom && |
|
1635 Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1636 { |
|
1637 // Landscape with bottom softkeys is the only landscape mode |
|
1638 // in which small status pane can be shown. |
|
1639 topAreaLayout = AknLayoutScalable_Avkon::area_top_pane( 2 ).LayoutLine(); |
|
1640 } |
|
1641 else |
|
1642 { |
|
1643 topAreaLayout = AknLayoutScalable_Avkon::area_top_pane( 1 ).LayoutLine(); |
|
1644 } |
|
1645 TAknLayoutRect topAreaLayoutRect; |
|
1646 topAreaLayoutRect.LayoutRect( iApplicationWindowRect, topAreaLayout ); |
|
1647 |
|
1648 // The small status pane fills the whole top area. |
|
1649 iSmallStatusPaneRect = topAreaLayoutRect.Rect(); |
|
1650 |
|
1651 if (aLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT || |
|
1652 aLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT || |
|
1653 aLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT || |
|
1654 aLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT) |
|
1655 { |
|
1656 TAknWindowComponentLayout layout1parent( iAknLayoutScalable_Avkon.area_top_pane(2) ); |
|
1657 TAknWindowComponentLayout layout1( iAknLayoutScalable_Avkon.stacon_top_pane() ); |
|
1658 TAknLayoutRect layout1ParentRect; |
|
1659 layout1ParentRect.LayoutRect(iScreenRect, layout1parent.LayoutLine()); |
|
1660 TAknLayoutRect layout1Rect; |
|
1661 layout1Rect.LayoutRect(layout1ParentRect.Rect(), layout1.LayoutLine()); |
|
1662 iStaconLayout1Rect = layout1Rect.Rect(); |
|
1663 |
|
1664 TAknWindowComponentLayout layout2parent( iAknLayoutScalable_Avkon.area_bottom_pane(2) ); |
|
1665 TAknWindowComponentLayout layout2( iAknLayoutScalable_Avkon.stacon_bottom_pane() ); |
|
1666 TAknLayoutRect layout2ParentRect; |
|
1667 layout2ParentRect.LayoutRect(iScreenRect, layout2parent.LayoutLine()); |
|
1668 TAknLayoutRect layout2Rect; |
|
1669 layout2Rect.LayoutRect(layout2ParentRect.Rect(), layout2.LayoutLine()); |
|
1670 iStaconLayout2Rect = layout2Rect.Rect(); |
|
1671 } |
|
1672 } |
|
1673 |
|
1674 TRect CEikStatusPaneLayout::AknLayoutRect(TInt aLayoutResourceId, TPaneId aPaneId) |
|
1675 { |
|
1676 return iRoot->AknLayoutRect(aLayoutResourceId, aPaneId); |
|
1677 } |
|
1678 |
|
1679 |
|
1680 EXPORT_C CEikStatusPaneModelBase::~CEikStatusPaneModelBase() |
|
1681 { |
|
1682 delete iPanes; |
|
1683 if (iLayouts) |
|
1684 iLayouts->ResetAndDestroy(); |
|
1685 delete iLayouts; |
|
1686 delete iLegalIds; |
|
1687 } |
|
1688 |
|
1689 EXPORT_C void CEikStatusPaneModelBase::SetLayoutL(TInt aLayoutResId, TBool /*aChangeStatusPaneNow*/) |
|
1690 { |
|
1691 TInt layoutResId = AVKONENV->StatusPaneResIdForCurrentLayout(aLayoutResId); |
|
1692 if (!IsLegalId(layoutResId)) |
|
1693 User::Leave(KErrNotFound); |
|
1694 |
|
1695 CEikStatusPaneLayout* layout = Layout(layoutResId); |
|
1696 if (layout == NULL) |
|
1697 layout = LoadLayoutL(layoutResId); |
|
1698 |
|
1699 iCurrentResId = layoutResId; |
|
1700 iCurrentLayout = layout; |
|
1701 } |
|
1702 |
|
1703 EXPORT_C CEikStatusPaneModelBase::CEikStatusPaneModelBase(CEikonEnv& aEikEnv) |
|
1704 : iEikEnv(aEikEnv) |
|
1705 { |
|
1706 } |
|
1707 |
|
1708 EXPORT_C void CEikStatusPaneModelBase::BaseConstructL(TInt aCoreResId) |
|
1709 { |
|
1710 TResourceReader res; |
|
1711 iEikEnv.CreateResourceReaderLC(res, aCoreResId); |
|
1712 |
|
1713 iPanes = CEikStatusPaneSetInit::NewL(); |
|
1714 iPanes->LoadDefaultsL(res); |
|
1715 |
|
1716 iCurrentResId = AVKONENV->StatusPaneResIdForCurrentLayout(res.ReadUint32()); |
|
1717 |
|
1718 const TInt layoutCount=res.ReadInt16(); |
|
1719 iLegalIds = new(ELeave) CIdSet(layoutCount); |
|
1720 for (TInt ii=0; ii<layoutCount; ++ii) |
|
1721 { |
|
1722 const TInt layoutRes=res.ReadInt32(); |
|
1723 iLegalIds->AppendL(layoutRes); |
|
1724 } |
|
1725 |
|
1726 CleanupStack::PopAndDestroy(); // res |
|
1727 } |
|
1728 |
|
1729 TBool CEikStatusPaneModelBase::IsLegalId(TInt aLayoutResId) const |
|
1730 { |
|
1731 for (TInt i=0; i<iLegalIds->Count(); i++) |
|
1732 { |
|
1733 if (iLegalIds->At(i) == aLayoutResId) |
|
1734 return ETrue; |
|
1735 } |
|
1736 return EFalse; |
|
1737 } |
|
1738 |
|
1739 CEikStatusPaneLayout* CEikStatusPaneModelBase::Layout(TInt aLayoutResId) |
|
1740 { |
|
1741 for (TInt i=0; i<iLayouts->Count(); i++) |
|
1742 { |
|
1743 if (iLayouts->At(i)->iResId == aLayoutResId) |
|
1744 return iLayouts->At(i)->iLayout; |
|
1745 } |
|
1746 return NULL; |
|
1747 } |
|
1748 |
|
1749 EXPORT_C CEikStatusPaneLayout* CEikStatusPaneModelBase::LoadLayoutL(TInt aLayoutResId) |
|
1750 { |
|
1751 TResourceReader res; |
|
1752 iEikEnv.CreateResourceReaderLC(res, aLayoutResId); |
|
1753 |
|
1754 TRect rect(TPoint(0,0),TSize(AKN_LAYOUT_WINDOW_screen.iW,AKN_LAYOUT_WINDOW_screen.iH)); |
|
1755 CEikStatusPaneLayout* layout = CEikStatusPaneLayout::NewL(res, rect, aLayoutResId); |
|
1756 |
|
1757 CleanupStack::PushL(layout); |
|
1758 CheckLayoutL(layout); |
|
1759 |
|
1760 CIdLayoutPair* pair = new(ELeave) CIdLayoutPair(aLayoutResId, layout); |
|
1761 CleanupStack::Pop(); // layout |
|
1762 CleanupStack::PushL(pair); |
|
1763 |
|
1764 iLayouts->AppendL(pair); |
|
1765 CleanupStack::Pop(); // pair |
|
1766 |
|
1767 CleanupStack::PopAndDestroy(); // res |
|
1768 |
|
1769 return layout; |
|
1770 } |
|
1771 |
|
1772 void CEikStatusPaneModelBase::CheckLayoutL(CEikStatusPaneLayout* aLayout) |
|
1773 { |
|
1774 TLayoutChecker checker(iPanes); |
|
1775 aLayout->AcceptL(&checker); |
|
1776 } |
|
1777 |
|
1778 EXPORT_C void CEikStatusPaneModelBase::Reserved_1() |
|
1779 { |
|
1780 } |
|
1781 |
|
1782 EXPORT_C TInt CEikStatusPaneModelBase::CurrentLayoutResId() const |
|
1783 { |
|
1784 return iCurrentResId; |
|
1785 } |
|
1786 |
|
1787 void CEikStatusPaneModelBase::AknLayoutRefresh() |
|
1788 { |
|
1789 for (TInt i=0; i<iLayouts->Count(); i++) |
|
1790 { |
|
1791 if (iLayouts->At(i)) |
|
1792 { |
|
1793 iLayouts->At(i)->iLayout->AknLayoutRefresh(iLayouts->At(i)->iResId); |
|
1794 } |
|
1795 } |
|
1796 } |
|
1797 |
|
1798 TBool CEikStatusPaneModelBase::AknLayoutUsed(TInt aLayoutId) |
|
1799 { |
|
1800 for (TInt i=0; i<iLayouts->Count(); i++) |
|
1801 { |
|
1802 if (iLayouts->At(i) && iLayouts->At(i)->iResId == aLayoutId) |
|
1803 { |
|
1804 return iLayouts->At(i)->iLayout->AknLayoutUsed(); |
|
1805 } |
|
1806 } |
|
1807 return EFalse; |
|
1808 } |
|
1809 |
|
1810 |
|
1811 CEikStatusPaneModelBase::TLayoutChecker::TLayoutChecker(CEikStatusPaneSetInit* aPanes) |
|
1812 : iPanes(aPanes) |
|
1813 { |
|
1814 } |
|
1815 |
|
1816 void CEikStatusPaneModelBase::TLayoutChecker::VisitL(CEikStatusPaneLayoutTree* aNode) |
|
1817 { |
|
1818 iPanes->FindL(aNode->Id()); |
|
1819 } |
|
1820 |
|
1821 |
|
1822 CEikStatusPaneModelBase::CIdLayoutPair::CIdLayoutPair(TInt aResId, CEikStatusPaneLayout* aLayout) |
|
1823 : iResId(aResId), iLayout(aLayout) |
|
1824 { |
|
1825 } |
|
1826 |
|
1827 CEikStatusPaneModelBase::CIdLayoutPair::~CIdLayoutPair() |
|
1828 { |
|
1829 delete iLayout; |
|
1830 } |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 CEikAppStatusPaneModel* CEikAppStatusPaneModel::NewL(CEikonEnv& aEikEnv, TInt aCoreResId, TInt aAppResId, TBool aChangeStatusPaneNow) |
|
1836 { |
|
1837 CEikAppStatusPaneModel* self = new(ELeave) CEikAppStatusPaneModel(aEikEnv); |
|
1838 CleanupStack::PushL(self); |
|
1839 self->ConstructL(aCoreResId, aAppResId, aChangeStatusPaneNow); |
|
1840 CleanupStack::Pop(); |
|
1841 return self; |
|
1842 } |
|
1843 |
|
1844 CEikAppStatusPaneModel::~CEikAppStatusPaneModel() |
|
1845 { |
|
1846 } |
|
1847 |
|
1848 void CEikAppStatusPaneModel::SetLayoutL(TInt aLayoutResId, TBool aChangeStatusPaneNow) |
|
1849 { |
|
1850 CEikStatusPaneModelBase::SetLayoutL(aLayoutResId, aChangeStatusPaneNow); |
|
1851 CAknSgcClient::HandleChangeL(); |
|
1852 } |
|
1853 |
|
1854 void CEikAppStatusPaneModel::SetLayoutL(TInt aLayoutResId, TBool aChangeStatusPaneNow, TBool aNotfiyServerSide) |
|
1855 { |
|
1856 CEikStatusPaneModelBase::SetLayoutL(aLayoutResId, aChangeStatusPaneNow); |
|
1857 if (aNotfiyServerSide) |
|
1858 CAknSgcClient::HandleChangeL(); |
|
1859 } |
|
1860 |
|
1861 |
|
1862 CEikAppStatusPaneModel::CEikAppStatusPaneModel(CEikonEnv& aEikEnv) |
|
1863 : CEikStatusPaneModelBase(aEikEnv) |
|
1864 { |
|
1865 } |
|
1866 |
|
1867 void CEikAppStatusPaneModel::ConstructL(TInt aCoreResId, TInt aAppResId, TBool aChangeStatusPaneNow) |
|
1868 { |
|
1869 BaseConstructL(aCoreResId); |
|
1870 |
|
1871 iLayouts = new(ELeave) CLayoutIdSet(1); |
|
1872 |
|
1873 if (aAppResId != EEikStatusPaneUseDefaults && |
|
1874 aAppResId > EEikStatusPaneLayoutAknLafDefined) |
|
1875 { |
|
1876 TResourceReader res; |
|
1877 iEikEnv.CreateResourceReaderLC(res, aAppResId); |
|
1878 |
|
1879 TInt defaultLayout = res.ReadUint32(); |
|
1880 if (defaultLayout != EEikStatusPaneUseDefaults && |
|
1881 defaultLayout > EEikStatusPaneLayoutAknLafDefined) |
|
1882 { |
|
1883 if (IsLegalId(defaultLayout)) |
|
1884 { |
|
1885 iCurrentResId = defaultLayout; |
|
1886 } |
|
1887 else |
|
1888 { |
|
1889 User::Leave(KErrNotFound); |
|
1890 } |
|
1891 } |
|
1892 |
|
1893 PaneInits()->LoadDefaultsL(res); |
|
1894 |
|
1895 CleanupStack::PopAndDestroy(); // res |
|
1896 } |
|
1897 |
|
1898 SetLayoutL(iCurrentResId,aChangeStatusPaneNow); |
|
1899 } |
|
1900 |
|
1901 void CEikAppStatusPaneModel::ApplyCurrentLayoutL() |
|
1902 { |
|
1903 } |
|
1904 |