|
1 /* |
|
2 * Copyright (c) 2002 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: Layout calculations for PreviewPane. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //debug |
|
20 #include "calendarui_debug.h" |
|
21 |
|
22 #include "calenpreviewlayoutmanager.h" |
|
23 |
|
24 #include "calenpreviewlabel.h" |
|
25 |
|
26 #include "calenpreview.h" |
|
27 |
|
28 #include <AknsUtils.h> |
|
29 #include <eiklabel.h> |
|
30 |
|
31 #include <layoutmetadata.cdl.h> |
|
32 #include <aknlayoutscalable_apps.cdl.h> |
|
33 #include <aknlayoutscalable_avkon.cdl.h> |
|
34 |
|
35 const TInt KPopupMaxEntries = 4; |
|
36 |
|
37 CCalenPreviewLayoutManager* CCalenPreviewLayoutManager::NewL(CCalenPreview* aPreview) |
|
38 { |
|
39 TRACE_ENTRY_POINT; |
|
40 CCalenPreviewLayoutManager* self = |
|
41 new (ELeave) CCalenPreviewLayoutManager(aPreview); |
|
42 |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 |
|
47 TRACE_EXIT_POINT; |
|
48 return self; |
|
49 } |
|
50 |
|
51 CCalenPreviewLayoutManager::CCalenPreviewLayoutManager(CCalenPreview* aPreview) |
|
52 : iContainer(NULL) , iPreview(aPreview) |
|
53 { |
|
54 TRACE_ENTRY_POINT; |
|
55 TRACE_EXIT_POINT; |
|
56 } |
|
57 |
|
58 CCalenPreviewLayoutManager::~CCalenPreviewLayoutManager() |
|
59 { |
|
60 TRACE_ENTRY_POINT; |
|
61 TRACE_EXIT_POINT; |
|
62 } |
|
63 |
|
64 void CCalenPreviewLayoutManager::UpdateLayoutData() |
|
65 { |
|
66 TRACE_ENTRY_POINT; |
|
67 if( UsePreview() ) |
|
68 { |
|
69 TAknLayoutRect list_fp_cale_pane; |
|
70 TAknLayoutRect popup_fixed_preview_cale_window; |
|
71 TAknLayoutText list_single_fp_cale_pane; |
|
72 TAknTextLineLayout textLine; |
|
73 |
|
74 popup_fixed_preview_cale_window.LayoutRect( |
|
75 ApplicationWindow(), |
|
76 AknLayoutScalable_Apps::popup_fixed_preview_cale_window(Orientation()).LayoutLine() ); |
|
77 |
|
78 TAknLayoutScalableParameterLimits list_single_fp_cale_pane_limits = |
|
79 AknLayoutScalable_Apps::list_single_fp_cale_pane_ParamLimits(); |
|
80 |
|
81 iLinesUsed = LineCount(); |
|
82 |
|
83 list_fp_cale_pane.LayoutRect( |
|
84 popup_fixed_preview_cale_window.Rect(), |
|
85 AknLayoutScalable_Apps::list_fp_cale_pane(0).LayoutLine() ); |
|
86 |
|
87 list_single_fp_cale_pane.LayoutText( |
|
88 list_fp_cale_pane.Rect(), |
|
89 AknLayoutScalable_Apps::list_single_fp_cale_pane_t(0, 0).LayoutLine() ); |
|
90 |
|
91 textLine = |
|
92 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(1).LayoutLine(); |
|
93 iFirstLine.LayoutText( list_single_fp_cale_pane.TextRect(), textLine ); |
|
94 |
|
95 textLine = |
|
96 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(2).LayoutLine(); |
|
97 iMiddleLine.LayoutText( list_single_fp_cale_pane.TextRect(), textLine ); |
|
98 |
|
99 textLine = |
|
100 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(3).LayoutLine(); |
|
101 iLastLine.LayoutText( list_single_fp_cale_pane.TextRect(), textLine ); |
|
102 |
|
103 textLine = |
|
104 AknLayoutScalable_Apps::popup_fixed_preview_cale_window_t1(0).LayoutLine(); |
|
105 iTitleLine.LayoutText( popup_fixed_preview_cale_window.Rect(), textLine ); |
|
106 |
|
107 textLine = |
|
108 AknLayoutScalable_Apps::popup_fixed_preview_cale_window_t2(0).LayoutLine(); |
|
109 iEmptyLine.LayoutText( popup_fixed_preview_cale_window.Rect(), textLine ); |
|
110 |
|
111 textLine = |
|
112 AknLayoutScalable_Apps::list_single_fp_cale_pane_t1(0).LayoutLine(); |
|
113 iPluginLine.LayoutText( list_single_fp_cale_pane.TextRect(), textLine ); |
|
114 } |
|
115 else |
|
116 { |
|
117 TAknLayoutRect popup_cale_events_window; |
|
118 TAknTextLineLayout textLine; |
|
119 |
|
120 popup_cale_events_window.LayoutRect( |
|
121 StatusPane(), |
|
122 AknLayoutScalable_Apps::popup_cale_events_window(0).LayoutLine() ); |
|
123 |
|
124 textLine = |
|
125 AknLayoutScalable_Apps::popup_cale_events_window_t1(0).LayoutLine(); |
|
126 iFirstLine.LayoutText( popup_cale_events_window.Rect(), textLine ); |
|
127 |
|
128 iMiddleLine = iFirstLine; |
|
129 iLastLine = iFirstLine; |
|
130 iEmptyLine = iFirstLine; |
|
131 iPluginLine = iFirstLine; |
|
132 iTitleLine = iFirstLine; |
|
133 } |
|
134 TRACE_EXIT_POINT; |
|
135 } |
|
136 |
|
137 void CCalenPreviewLayoutManager::ConstructL() |
|
138 { |
|
139 TRACE_ENTRY_POINT; |
|
140 TRACE_EXIT_POINT; |
|
141 } |
|
142 |
|
143 TSize CCalenPreviewLayoutManager::MinimumSize() |
|
144 { |
|
145 TRACE_ENTRY_POINT; |
|
146 TSize asize; |
|
147 |
|
148 if(iLinesUsed > KPopupMaxEntries) |
|
149 { |
|
150 iLinesUsed = iContainer->CountComponentControls(); |
|
151 } |
|
152 |
|
153 if( UsePreview() ) |
|
154 { |
|
155 TAknLayoutRect popup_fixed_preview_cale_window; |
|
156 |
|
157 popup_fixed_preview_cale_window.LayoutRect( |
|
158 ApplicationWindow(), |
|
159 AknLayoutScalable_Apps::popup_fixed_preview_cale_window(Orientation()).LayoutLine() ); |
|
160 |
|
161 asize = popup_fixed_preview_cale_window.Rect().Size(); |
|
162 } |
|
163 else if( iLinesUsed ) |
|
164 { |
|
165 TAknLayoutRect popup_cale_events_window; |
|
166 |
|
167 popup_cale_events_window.LayoutRect( |
|
168 StatusPane(), |
|
169 AknLayoutScalable_Apps::popup_cale_events_window(iLinesUsed-1).LayoutLine() ); |
|
170 |
|
171 asize = popup_cale_events_window.Rect().Size(); |
|
172 } |
|
173 else |
|
174 { |
|
175 asize.iWidth = 0; |
|
176 asize.iHeight = 0; |
|
177 } |
|
178 |
|
179 if( iLinesUsed ) |
|
180 { |
|
181 TAknWindowComponentLayout temp = |
|
182 AknLayoutScalable_Avkon::bg_popup_preview_window_pane_g1(); |
|
183 |
|
184 asize.iWidth -= temp.LayoutLine().il + temp.LayoutLine().ir; |
|
185 asize.iHeight -= temp.LayoutLine().it + temp.LayoutLine().ib; |
|
186 } |
|
187 |
|
188 TRACE_EXIT_POINT; |
|
189 return asize; |
|
190 } |
|
191 |
|
192 // Public member functions inherited from MCoeLayoutManager |
|
193 |
|
194 void CCalenPreviewLayoutManager::AttachL(CCoeControl &aCompoundControl) |
|
195 { |
|
196 TRACE_ENTRY_POINT; |
|
197 iContainer = &aCompoundControl; |
|
198 UpdateLayoutData(); |
|
199 TRACE_EXIT_POINT; |
|
200 } |
|
201 TBool CCalenPreviewLayoutManager::CanAttach() const |
|
202 { |
|
203 TRACE_ENTRY_POINT; |
|
204 TBool ret(ETrue); |
|
205 if( iContainer ) |
|
206 ret = EFalse; |
|
207 TRACE_EXIT_POINT; |
|
208 return ret; |
|
209 } |
|
210 void CCalenPreviewLayoutManager::Detach(CCoeControl &aCompoundControl) |
|
211 { |
|
212 TRACE_ENTRY_POINT; |
|
213 if( iContainer == &aCompoundControl ) |
|
214 { |
|
215 iContainer = NULL; |
|
216 delete this; |
|
217 } |
|
218 TRACE_EXIT_POINT; |
|
219 } |
|
220 |
|
221 TSize CCalenPreviewLayoutManager::CalcMinimumSize( |
|
222 const CCoeControl &aCompoundControl) const |
|
223 { |
|
224 TRACE_ENTRY_POINT; |
|
225 TSize ret(0,0); |
|
226 if(iContainer != NULL && |
|
227 iContainer == &aCompoundControl) |
|
228 { |
|
229 ret = iContainer->Rect().Size(); |
|
230 } |
|
231 TRACE_EXIT_POINT; |
|
232 return ret; |
|
233 } |
|
234 |
|
235 void CCalenPreviewLayoutManager::PerformLayout() |
|
236 { |
|
237 TRACE_ENTRY_POINT; |
|
238 if(UsePreview()) |
|
239 PerformPreviewLayout(); |
|
240 else |
|
241 PerformPopupLayout(); |
|
242 TRACE_EXIT_POINT; |
|
243 } |
|
244 |
|
245 TInt CCalenPreviewLayoutManager::CalcTextBaselineOffset( |
|
246 const CCoeControl& /*aCompoundControl*/, |
|
247 const TSize& /*aSize*/) const |
|
248 { |
|
249 TRACE_ENTRY_POINT; |
|
250 TRACE_EXIT_POINT; |
|
251 return 0; |
|
252 } |
|
253 |
|
254 void CCalenPreviewLayoutManager::SetTextBaselineSpacing( |
|
255 TInt /*aBaselineSpacing*/) |
|
256 { |
|
257 TRACE_ENTRY_POINT; |
|
258 TRACE_EXIT_POINT; |
|
259 } |
|
260 |
|
261 TInt CCalenPreviewLayoutManager::TextBaselineSpacing() const |
|
262 { |
|
263 TRACE_ENTRY_POINT; |
|
264 TRACE_EXIT_POINT; |
|
265 return 0; |
|
266 } |
|
267 |
|
268 void CCalenPreviewLayoutManager::HandleAddedControlL( |
|
269 const CCoeControl& /*aCompoundControl*/, |
|
270 const CCoeControl& /*aAddedControl*/) |
|
271 { |
|
272 TRACE_ENTRY_POINT; |
|
273 TRACE_EXIT_POINT; |
|
274 } |
|
275 |
|
276 void CCalenPreviewLayoutManager::HandleRemovedControl( |
|
277 const CCoeControl& /*aCompoundControl*/, |
|
278 const CCoeControl& /*aRemovedControl*/) |
|
279 { |
|
280 TRACE_ENTRY_POINT; |
|
281 TRACE_EXIT_POINT; |
|
282 } |
|
283 |
|
284 TInt CCalenPreviewLayoutManager::HandleControlReplaced( |
|
285 const CCoeControl& /*aOldControl*/, |
|
286 const CCoeControl& /*aNewControl*/) |
|
287 { |
|
288 TRACE_ENTRY_POINT; |
|
289 TRACE_EXIT_POINT; |
|
290 return 0; |
|
291 } |
|
292 |
|
293 // New public member functions |
|
294 |
|
295 void CCalenPreviewLayoutManager::SetLinesUsed(TInt aUsedLines) |
|
296 { |
|
297 TRACE_ENTRY_POINT; |
|
298 if(!UsePreview() && aUsedLines <= KPopupMaxEntries) |
|
299 { |
|
300 if( aUsedLines > iContainer->CountComponentControls()) |
|
301 iLinesUsed = iContainer->CountComponentControls(); |
|
302 else |
|
303 iLinesUsed = aUsedLines; |
|
304 } |
|
305 TRACE_EXIT_POINT; |
|
306 } |
|
307 |
|
308 TInt CCalenPreviewLayoutManager::FirstLineWidth() const |
|
309 { |
|
310 TRACE_ENTRY_POINT; |
|
311 TRACE_EXIT_POINT; |
|
312 return iFirstLine.TextRect().Width(); |
|
313 } |
|
314 |
|
315 TInt CCalenPreviewLayoutManager::TitleLineWidth() const |
|
316 { |
|
317 TRACE_ENTRY_POINT; |
|
318 TRACE_EXIT_POINT; |
|
319 return iTitleLine.TextRect().Width(); |
|
320 } |
|
321 |
|
322 TInt CCalenPreviewLayoutManager::MiddleLineWidth() const |
|
323 { |
|
324 TRACE_ENTRY_POINT; |
|
325 TRACE_EXIT_POINT; |
|
326 return iMiddleLine.TextRect().Width(); |
|
327 } |
|
328 |
|
329 TInt CCalenPreviewLayoutManager::LastLineWidth() const |
|
330 { |
|
331 TRACE_ENTRY_POINT; |
|
332 TRACE_EXIT_POINT; |
|
333 return iLastLine.TextRect().Width(); |
|
334 } |
|
335 |
|
336 TInt CCalenPreviewLayoutManager::PluginLineWidth() const |
|
337 { |
|
338 TRACE_ENTRY_POINT; |
|
339 TRACE_EXIT_POINT; |
|
340 return iPluginLine.TextRect().Width(); |
|
341 } |
|
342 |
|
343 TInt CCalenPreviewLayoutManager::EmptyLineWidth() const |
|
344 { |
|
345 TRACE_ENTRY_POINT; |
|
346 TRACE_EXIT_POINT; |
|
347 return iEmptyLine.TextRect().Width(); |
|
348 } |
|
349 |
|
350 const CFont* CCalenPreviewLayoutManager::LineFont() const |
|
351 { |
|
352 TRACE_ENTRY_POINT; |
|
353 TRACE_EXIT_POINT; |
|
354 return iFirstLine.Font(); |
|
355 } |
|
356 |
|
357 const CFont* CCalenPreviewLayoutManager::TitleFont() const |
|
358 { |
|
359 TRACE_ENTRY_POINT; |
|
360 TRACE_EXIT_POINT; |
|
361 return iFirstLine.Font(); |
|
362 } |
|
363 |
|
364 const CFont* CCalenPreviewLayoutManager::PluginFont() const |
|
365 { |
|
366 TRACE_ENTRY_POINT; |
|
367 TRACE_EXIT_POINT; |
|
368 return iPluginLine.Font(); |
|
369 } |
|
370 |
|
371 void CCalenPreviewLayoutManager::SetContainerLayout() |
|
372 { |
|
373 TRACE_ENTRY_POINT; |
|
374 if(iContainer) |
|
375 { |
|
376 UpdateLayoutData(); |
|
377 if(UsePreview()) |
|
378 { |
|
379 AknLayoutUtils::LayoutControl( |
|
380 iContainer, |
|
381 ApplicationWindow(), |
|
382 AknLayoutScalable_Apps::popup_fixed_preview_cale_window(Orientation()).LayoutLine() ); |
|
383 } |
|
384 else |
|
385 { |
|
386 AknLayoutUtils::LayoutControl( |
|
387 iContainer, |
|
388 StatusPane(), |
|
389 AknLayoutScalable_Apps::popup_cale_events_window(iLinesUsed-1).LayoutLine()); |
|
390 } |
|
391 } |
|
392 TRACE_EXIT_POINT; |
|
393 } |
|
394 |
|
395 TRect CCalenPreviewLayoutManager::StatusPane() |
|
396 { |
|
397 TRACE_ENTRY_POINT; |
|
398 TRect statusPaneRect; |
|
399 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
400 statusPaneRect ); |
|
401 TSize screenSize; |
|
402 AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, screenSize ); |
|
403 TRect screenRect( screenSize ); |
|
404 TAknLayoutRect statusPane; |
|
405 statusPane.LayoutRect( screenRect, AknLayoutScalable_Avkon::status_pane( 0 ).LayoutLine() ); |
|
406 statusPaneRect.SetWidth(statusPane.Rect().Width()); |
|
407 |
|
408 TRACE_EXIT_POINT; |
|
409 return statusPaneRect; |
|
410 } |
|
411 |
|
412 TRect CCalenPreviewLayoutManager::ApplicationWindow() |
|
413 { |
|
414 TRACE_ENTRY_POINT; |
|
415 TRect screenRect; |
|
416 TAknLayoutRect application_window; |
|
417 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, |
|
418 screenRect ); |
|
419 application_window.LayoutRect( |
|
420 screenRect, |
|
421 AknLayoutScalable_Apps::application_window().LayoutLine() ); |
|
422 TRACE_EXIT_POINT; |
|
423 return application_window.Rect(); |
|
424 } |
|
425 |
|
426 void CCalenPreviewLayoutManager::PerformPopupLayout() |
|
427 { |
|
428 TRACE_ENTRY_POINT; |
|
429 // Perform layout for popup pane |
|
430 TAknLayoutRect popup_cale_events_window_g2; |
|
431 TInt limit( iContainer->CountComponentControls() ); |
|
432 TRect rect( iContainer->Rect() ); |
|
433 |
|
434 //>> Temporary fix |
|
435 TAknWindowComponentLayout temp = |
|
436 AknLayoutScalable_Avkon::bg_popup_preview_window_pane_g1(); |
|
437 rect.iTl.iX -= temp.LayoutLine().il; rect.iTl.iY -= temp.LayoutLine().it; |
|
438 rect.iBr.iX += temp.LayoutLine().ir; rect.iBr.iY += temp.LayoutLine().ib; |
|
439 //<< |
|
440 |
|
441 for(TInt i = 0; i < limit; i++) |
|
442 { |
|
443 |
|
444 |
|
445 CCalenPreviewLabel* line = |
|
446 static_cast<CCalenPreviewLabel*>(iContainer->ComponentControl(i)); |
|
447 |
|
448 switch( i%KPopupMaxEntries ) |
|
449 { |
|
450 case 0: |
|
451 AknLayoutUtils::LayoutLabel( |
|
452 line, rect, |
|
453 AknLayoutScalable_Apps::popup_cale_events_window_t1(KPopupMaxEntries).LayoutLine()); |
|
454 break; |
|
455 case 1: |
|
456 AknLayoutUtils::LayoutLabel( |
|
457 line, rect, |
|
458 AknLayoutScalable_Apps::popup_cale_events_window_t2(KPopupMaxEntries).LayoutLine()); |
|
459 break; |
|
460 case 2: |
|
461 AknLayoutUtils::LayoutLabel( |
|
462 line, rect, |
|
463 AknLayoutScalable_Apps::popup_cale_events_window_t3(KPopupMaxEntries).LayoutLine()); |
|
464 break; |
|
465 case 3: |
|
466 AknLayoutUtils::LayoutLabel( |
|
467 line, rect, |
|
468 AknLayoutScalable_Apps::popup_cale_events_window_t4(KPopupMaxEntries).LayoutLine()); |
|
469 // icon |
|
470 popup_cale_events_window_g2.LayoutRect( |
|
471 rect, |
|
472 AknLayoutScalable_Apps::popup_cale_events_window_g2(KPopupMaxEntries).LayoutLine() ); |
|
473 line->SetMoreIconLayout(popup_cale_events_window_g2); |
|
474 break; |
|
475 } |
|
476 |
|
477 // Text color skinning |
|
478 TRgb textColor(KRgbBlack); |
|
479 line->GetColor(EColorLabelText, textColor); |
|
480 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), textColor, |
|
481 KAknsIIDQsnTextColors, |
|
482 EAknsCIQsnTextColorsCG20); |
|
483 |
|
484 PIM_TRAPD_HANDLE( |
|
485 AknLayoutUtils::OverrideControlColorL(*line, EColorLabelText, |
|
486 textColor)); |
|
487 } |
|
488 TRACE_EXIT_POINT; |
|
489 } |
|
490 |
|
491 |
|
492 void CCalenPreviewLayoutManager::PerformPreviewLayout() |
|
493 { |
|
494 TRACE_ENTRY_POINT; |
|
495 |
|
496 // Perform layout for preview pane |
|
497 TRect rect( iContainer->Rect() ); |
|
498 TAknLayoutScalableParameterLimits list_single_fp_cale_pane_limits = |
|
499 AknLayoutScalable_Apps::list_single_fp_cale_pane_ParamLimits(); |
|
500 TInt limit( list_single_fp_cale_pane_limits.LastRow()); |
|
501 TInt componentCount( iContainer->CountComponentControls()); |
|
502 |
|
503 //>> Temporary fix |
|
504 TAknWindowComponentLayout temp = |
|
505 AknLayoutScalable_Avkon::bg_popup_preview_window_pane_g1(); |
|
506 rect.iTl.iX -= temp.LayoutLine().il; rect.iTl.iY -= temp.LayoutLine().it; |
|
507 rect.iBr.iX += temp.LayoutLine().ir; rect.iBr.iY += temp.LayoutLine().ib; |
|
508 //<< |
|
509 |
|
510 for(TInt i = 0; i <= limit + 1 && i < componentCount; i++) |
|
511 { |
|
512 CCalenPreviewLabel* line = |
|
513 static_cast<CCalenPreviewLabel*>(iContainer->ComponentControl(i)); |
|
514 |
|
515 if(line->LabelType() == CCalenPreviewLabel::ECalenPreviewTitleRow) |
|
516 { |
|
517 AknLayoutUtils::LayoutLabel( |
|
518 line, rect, |
|
519 AknLayoutScalable_Apps::popup_fixed_preview_cale_window_t1(0).LayoutLine()); |
|
520 } |
|
521 else |
|
522 { |
|
523 TAknLayoutRect list_fp_cale_pane; |
|
524 list_fp_cale_pane.LayoutRect( |
|
525 rect, |
|
526 AknLayoutScalable_Apps::list_fp_cale_pane(0).LayoutLine() ); |
|
527 |
|
528 TInt iDx = 0; |
|
529 iDx = iPreview->PluginControl() ? i : i-1; |
|
530 |
|
531 TAknLayoutRect list_single_fp_cale_pane; |
|
532 list_single_fp_cale_pane.LayoutRect( |
|
533 list_fp_cale_pane.Rect(), |
|
534 AknLayoutScalable_Apps::list_single_fp_cale_pane(iDx).LayoutLine() ); |
|
535 |
|
536 |
|
537 TAknLayoutRect list_single_fp_cale_pane_g1; |
|
538 TAknLayoutRect list_single_fp_cale_pane_g2; |
|
539 |
|
540 switch (line->LabelType()) |
|
541 { |
|
542 case CCalenPreviewLabel::ECalenPreviewFirstRow: |
|
543 // icon |
|
544 list_single_fp_cale_pane_g1.LayoutRect( |
|
545 list_single_fp_cale_pane.Rect(), |
|
546 AknLayoutScalable_Apps::list_single_fp_cale_pane_g1(0).LayoutLine() ); |
|
547 line->SetIconLayout(list_single_fp_cale_pane_g1); |
|
548 // text |
|
549 AknLayoutUtils::LayoutLabel( |
|
550 line, list_single_fp_cale_pane.Rect(), |
|
551 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(1).LayoutLine()); |
|
552 break; |
|
553 case CCalenPreviewLabel::ECalenPreviewMiddleRow: |
|
554 AknLayoutUtils::LayoutLabel( |
|
555 line, list_single_fp_cale_pane.Rect(), |
|
556 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(2).LayoutLine()); |
|
557 break; |
|
558 case CCalenPreviewLabel::ECalenPreviewLastRow: |
|
559 // icon |
|
560 list_single_fp_cale_pane_g1.LayoutRect( |
|
561 list_single_fp_cale_pane.Rect(), |
|
562 AknLayoutScalable_Apps::list_single_fp_cale_pane_g1(0).LayoutLine() ); |
|
563 line->SetIconLayout(list_single_fp_cale_pane_g1); |
|
564 // text |
|
565 AknLayoutUtils::LayoutLabel( |
|
566 line, list_single_fp_cale_pane.Rect(), |
|
567 AknLayoutScalable_Apps::list_single_fp_cale_pane_t2(3).LayoutLine()); |
|
568 // icon |
|
569 list_single_fp_cale_pane_g2.LayoutRect( |
|
570 list_single_fp_cale_pane.Rect(), |
|
571 AknLayoutScalable_Apps::list_single_fp_cale_pane_g2(0).LayoutLine() ); |
|
572 line->SetMoreIconLayout(list_single_fp_cale_pane_g2); |
|
573 break; |
|
574 case CCalenPreviewLabel::ECalenPreviewEmptyRow: |
|
575 default: |
|
576 AknLayoutUtils::LayoutLabel( |
|
577 line, rect, |
|
578 AknLayoutScalable_Apps::popup_fixed_preview_cale_window_t2(0).LayoutLine()); |
|
579 break; |
|
580 } |
|
581 } |
|
582 |
|
583 // Text color skinning |
|
584 TRgb textColor(KRgbBlack); |
|
585 line->GetColor(EColorLabelText, textColor); |
|
586 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), textColor, |
|
587 KAknsIIDQsnTextColors, |
|
588 EAknsCIQsnTextColorsCG20); |
|
589 PIM_TRAPD_HANDLE( |
|
590 AknLayoutUtils::OverrideControlColorL(*line, EColorLabelText, |
|
591 textColor)); |
|
592 } |
|
593 |
|
594 if(iPreview->PluginControl()) |
|
595 { |
|
596 TRAPD(error,LayoutPluginControlL(*iPreview->PluginControl()) ); |
|
597 if(error!=KErrNone) |
|
598 { |
|
599 // Do nothing to avoid warning |
|
600 } |
|
601 TRAP(error,iPreview->AddPluginControlL()); |
|
602 if(error!=KErrNone) |
|
603 { |
|
604 // Do nothing to avoid warning |
|
605 } |
|
606 } |
|
607 |
|
608 TRACE_EXIT_POINT; |
|
609 } |
|
610 |
|
611 void CCalenPreviewLayoutManager::LayoutPluginControlL(CCoeControl& aControl) |
|
612 { |
|
613 TRACE_ENTRY_POINT; |
|
614 |
|
615 CCoeControl* line = &aControl; |
|
616 TRect rectMain( iContainer->Rect() ); |
|
617 |
|
618 //>> Temporary fix |
|
619 TAknWindowComponentLayout temp = |
|
620 AknLayoutScalable_Avkon::bg_popup_preview_window_pane_g1(); |
|
621 rectMain.iTl.iX -= temp.LayoutLine().il; rectMain.iTl.iY -= temp.LayoutLine().it; |
|
622 rectMain.iBr.iX += temp.LayoutLine().ir; rectMain.iBr.iY += temp.LayoutLine().ib; |
|
623 //<< |
|
624 |
|
625 if(line) |
|
626 { |
|
627 TAknLayoutRect list_fp_cale_pane; |
|
628 list_fp_cale_pane.LayoutRect( |
|
629 rectMain, |
|
630 AknLayoutScalable_Apps::list_fp_cale_pane(0).LayoutLine() ); |
|
631 |
|
632 TAknLayoutRect list_single_fp_cale_pane; |
|
633 list_single_fp_cale_pane.LayoutRect( |
|
634 list_fp_cale_pane.Rect(), |
|
635 AknLayoutScalable_Apps::list_single_fp_cale_pane(0).LayoutLine() ); |
|
636 |
|
637 if(!Layout_Meta_Data::IsLandscapeOrientation()) |
|
638 { |
|
639 line->SetRect(list_single_fp_cale_pane.Rect()); |
|
640 AknLayoutUtils::LayoutLabel( |
|
641 static_cast<CEikLabel*>(line), list_single_fp_cale_pane.Rect(), |
|
642 AknLayoutScalable_Apps::list_single_fp_cale_pane_t1(0).LayoutLine()); |
|
643 line ->SetRect(list_single_fp_cale_pane.Rect()); |
|
644 static_cast<CEikLabel*>(line)->SetLabelAlignment(ELayoutAlignCenter); |
|
645 } |
|
646 else |
|
647 { |
|
648 TRect rect; |
|
649 rect = list_single_fp_cale_pane.Rect(); |
|
650 rect.iBr.iY = rect.iBr.iY*2; |
|
651 line->SetRect(rect); |
|
652 rectMain = rect; |
|
653 } |
|
654 TRgb textColor(KRgbBlack); |
|
655 line->GetColor(EColorLabelText, textColor); |
|
656 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), textColor, |
|
657 KAknsIIDQsnTextColors, |
|
658 EAknsCIQsnTextColorsCG20); |
|
659 PIM_TRAPD_HANDLE( |
|
660 AknLayoutUtils::OverrideControlColorL(*line, EColorLabelText, |
|
661 textColor)); |
|
662 |
|
663 |
|
664 |
|
665 } |
|
666 |
|
667 TRACE_EXIT_POINT; |
|
668 } |
|
669 |
|
670 TBool CCalenPreviewLayoutManager::UsePreview() |
|
671 { |
|
672 TRACE_ENTRY_POINT; |
|
673 TBool previewMode(EFalse); |
|
674 TAknLayoutRect popup_fixed_preview_cale_window; |
|
675 |
|
676 popup_fixed_preview_cale_window.LayoutRect( |
|
677 ApplicationWindow(), |
|
678 AknLayoutScalable_Apps::popup_fixed_preview_cale_window(Orientation()).LayoutLine() ); |
|
679 |
|
680 if( popup_fixed_preview_cale_window.Rect().Height() && |
|
681 popup_fixed_preview_cale_window.Rect().Width() ) |
|
682 previewMode = ETrue; |
|
683 TRACE_EXIT_POINT; |
|
684 return previewMode; |
|
685 } |
|
686 |
|
687 TInt CCalenPreviewLayoutManager::LineCount() |
|
688 { |
|
689 TRACE_ENTRY_POINT; |
|
690 TInt lines(KPopupMaxEntries); |
|
691 if( UsePreview() ) |
|
692 { |
|
693 TAknLayoutScalableParameterLimits limits = |
|
694 AknLayoutScalable_Apps::list_single_fp_cale_pane_ParamLimits(); |
|
695 |
|
696 lines = limits.LastRow() + 1; |
|
697 } |
|
698 TRACE_EXIT_POINT; |
|
699 return lines; |
|
700 } |
|
701 TInt CCalenPreviewLayoutManager::Orientation() |
|
702 { |
|
703 TRACE_ENTRY_POINT; |
|
704 TInt variant(0); |
|
705 if(Layout_Meta_Data::IsLandscapeOrientation()) |
|
706 variant = 1; |
|
707 TRACE_EXIT_POINT; |
|
708 return variant; |
|
709 } |
|
710 |
|
711 TRect CCalenPreviewLayoutManager::ReducePreview(TRect aRect) |
|
712 { |
|
713 TRACE_ENTRY_POINT; |
|
714 if(!UsePreview()) |
|
715 { |
|
716 TAknLayoutRect main_pane; |
|
717 |
|
718 main_pane.LayoutRect( |
|
719 ApplicationWindow(), |
|
720 AknLayoutScalable_Apps::main_pane(Orientation() + 10).LayoutLine() ); |
|
721 |
|
722 aRect.SetWidth( main_pane.Rect().Width() ); |
|
723 aRect.SetHeight( main_pane.Rect().Height() ); |
|
724 } |
|
725 TRACE_EXIT_POINT; |
|
726 return aRect; |
|
727 } |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 //End of file |