|
1 /* |
|
2 * Copyright (c) 2002-2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <barsread.h> |
|
20 |
|
21 #include <eiklabel.h> |
|
22 #include <eikimage.h> |
|
23 #include <avkon.rsg> |
|
24 #include <avkon.hrh> |
|
25 |
|
26 #include <AknLayoutDef.h> |
|
27 #include <AknLayout.lag> |
|
28 #include <avkon.mbg> |
|
29 |
|
30 #include "AknPanic.h" |
|
31 #include "aknPopupHeadingPane.h" |
|
32 #include "akntextcontrol.h" |
|
33 #include "AknBitmapAnimation.h" |
|
34 #include "aknconsts.h" |
|
35 |
|
36 #include <AknsDrawUtils.h> |
|
37 #include <StringLoader.h> |
|
38 |
|
39 #include <AknsUtils.h> |
|
40 #include <AknIconUtils.h> |
|
41 |
|
42 #include <AknUtils.h> |
|
43 #include <aknlayoutscalable_avkon.cdl.h> |
|
44 #include <layoutmetadata.cdl.h> |
|
45 #include <aknbutton.h> |
|
46 #include "AknHeadingPaneTouchObserver.h" |
|
47 |
|
48 // ================= Extension class ======================== |
|
49 NONSHARABLE_CLASS(CAknPopupHeadingPaneExtension) : public CBase |
|
50 { |
|
51 public: |
|
52 CAknPopupHeadingPaneExtension(); |
|
53 ~CAknPopupHeadingPaneExtension(); |
|
54 |
|
55 public: // data |
|
56 TAknsItemID iFrameId; |
|
57 TAknsItemID iFrameCenterId; |
|
58 MAknHeadingPaneTouchObserver* iTouchObserver; |
|
59 }; |
|
60 |
|
61 CAknPopupHeadingPaneExtension::CAknPopupHeadingPaneExtension() |
|
62 { |
|
63 } |
|
64 |
|
65 CAknPopupHeadingPaneExtension::~CAknPopupHeadingPaneExtension() |
|
66 { |
|
67 } |
|
68 |
|
69 |
|
70 |
|
71 class CAknPopupHeadingAttributes: public CBase, public MCoeControlObserver |
|
72 { |
|
73 public: |
|
74 void SetEnableCloseButton(); |
|
75 TBool IsEnableCloseButton() const; |
|
76 static TInt CallBackByOneShot(TAny* aThisPtr); |
|
77 |
|
78 public: // from MCoeControlObserver |
|
79 virtual void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType); |
|
80 public: |
|
81 CAknPopupHeadingPane::THeadingPaneLayout iLayout; |
|
82 CCoeBrushAndPenContext* iBrushAndPenContext; |
|
83 CAknTextControl* iPage; |
|
84 CAknButton* iCloseButton; |
|
85 CAsyncCallBack* iAsyncOneShot; |
|
86 |
|
87 TInt iCurrentPage; |
|
88 TInt iMaxPage; |
|
89 TBool iEnableCloseButton; |
|
90 |
|
91 ~CAknPopupHeadingAttributes() |
|
92 { |
|
93 if (iAsyncOneShot) |
|
94 { |
|
95 iAsyncOneShot->Cancel(); |
|
96 delete iAsyncOneShot; |
|
97 iAsyncOneShot = NULL; |
|
98 } |
|
99 delete iBrushAndPenContext; |
|
100 delete iPage; |
|
101 delete iCloseButton; |
|
102 } |
|
103 }; |
|
104 |
|
105 void CAknPopupHeadingAttributes::SetEnableCloseButton() |
|
106 { |
|
107 CAknEnv* env = CAknEnv::Static(); |
|
108 TBool japaneseUi = (env && env->IsFeatureLanguage(KFeatureIdJapanese))? |
|
109 ETrue : EFalse; |
|
110 if (AknLayoutUtils::PenEnabled() && japaneseUi) |
|
111 { |
|
112 iEnableCloseButton = ETrue; |
|
113 } |
|
114 else |
|
115 { |
|
116 iEnableCloseButton = EFalse; |
|
117 } |
|
118 } |
|
119 |
|
120 TBool CAknPopupHeadingAttributes::IsEnableCloseButton() const |
|
121 { |
|
122 return iEnableCloseButton; |
|
123 } |
|
124 |
|
125 /** |
|
126 * Call back function: |
|
127 */ |
|
128 TInt CAknPopupHeadingAttributes::CallBackByOneShot(TAny* /*aThisPtr*/) |
|
129 { |
|
130 // Simulate RSK down key event |
|
131 TKeyEvent key; |
|
132 key.iCode = EKeyCBA2; // = EKeyDevice1 |
|
133 // Special flag that implies the simulated key event is sent by this call back function |
|
134 key.iModifiers = EModifierKeyboardExtend; |
|
135 key.iScanCode = EStdKeyDevice1; |
|
136 key.iRepeats = 0; |
|
137 TRAP_IGNORE( CCoeEnv::Static()->SimulateKeyEventL(key, EEventKey) ); |
|
138 return KErrNone; |
|
139 } |
|
140 void CAknPopupHeadingAttributes::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType) |
|
141 { |
|
142 if (aControl == iCloseButton) |
|
143 { |
|
144 // Handle the event sent by Close button control |
|
145 switch (aEventType) |
|
146 { |
|
147 case MCoeControlObserver::EEventRequestExit: |
|
148 { |
|
149 if (!iAsyncOneShot) |
|
150 { |
|
151 iAsyncOneShot = new (ELeave) CAsyncCallBack(EPriorityHigh); |
|
152 // setting call back |
|
153 TCallBack callback(CallBackByOneShot, this); |
|
154 iAsyncOneShot->Set(callback); |
|
155 iAsyncOneShot->CallBack(); |
|
156 } |
|
157 } |
|
158 break; |
|
159 default: |
|
160 break; |
|
161 } |
|
162 } |
|
163 } |
|
164 |
|
165 EXPORT_C CAknPopupHeadingPane::~CAknPopupHeadingPane() |
|
166 { |
|
167 AknsUtils::DeregisterControlPosition(this); |
|
168 delete iExtension; |
|
169 delete iPrompt; |
|
170 delete iHeaderImage; |
|
171 delete iAnimation; |
|
172 delete iAttributes; |
|
173 } |
|
174 |
|
175 EXPORT_C void CAknPopupHeadingPane::ConstructL(TPtrC aText) |
|
176 { |
|
177 if ( ! iAttributes ) |
|
178 { |
|
179 iAttributes = new ( ELeave ) CAknPopupHeadingAttributes; |
|
180 iAttributes->iBrushAndPenContext=CCoeBrushAndPenContext::NewL(); |
|
181 iAttributes->iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
182 SetControlContext(iAttributes->iBrushAndPenContext); |
|
183 } |
|
184 |
|
185 if (!iPrompt) |
|
186 { |
|
187 iPrompt = CAknTextControl::NewL(); |
|
188 iPrompt->SetContainerWindowL(*this); |
|
189 } |
|
190 |
|
191 if (!iAttributes->iPage) |
|
192 { |
|
193 iAttributes->iPage = CAknTextControl::NewL(); |
|
194 iAttributes->iPage->SetContainerWindowL(*this); |
|
195 iAttributes->iPage->MakeVisible(EFalse); |
|
196 } |
|
197 |
|
198 if (!iAttributes->iCloseButton) |
|
199 { |
|
200 TResourceReader reader; |
|
201 CEikonEnv::Static()->CreateResourceReaderLC( reader, R_AVKON_SCT_HEADING_CLOSE_BUTTON ); |
|
202 iAttributes->iCloseButton = CAknButton::NewL(reader); |
|
203 iAttributes->iCloseButton->SetContainerWindowL(*this); |
|
204 iAttributes->iCloseButton->SetObserver(iAttributes); |
|
205 iAttributes->iCloseButton->SetRequestExit( ETrue ); |
|
206 iAttributes->iCloseButton->MakeVisible(EFalse); |
|
207 CleanupStack::PopAndDestroy(); //reader buffer |
|
208 iAttributes->SetEnableCloseButton(); |
|
209 } |
|
210 |
|
211 if ( !iExtension ) |
|
212 { |
|
213 iExtension = new (ELeave) CAknPopupHeadingPaneExtension; |
|
214 } |
|
215 |
|
216 iExtension->iFrameId = KAknsIIDQsnFrPopupHeading; |
|
217 iExtension->iFrameCenterId = KAknsIIDQsnFrPopupHeadingCenter; |
|
218 |
|
219 |
|
220 SetTextL(aText); |
|
221 SetNonFocusing(); |
|
222 iAttributes->iLayout = EQueryHeadingPane; // QueryHeadingPane by default |
|
223 } |
|
224 |
|
225 EXPORT_C void CAknPopupHeadingPane::ConstructFromResourceL(TResourceReader &aReader) |
|
226 { |
|
227 if ( ! iAttributes ) |
|
228 { |
|
229 iAttributes = new ( ELeave ) CAknPopupHeadingAttributes; |
|
230 iAttributes->iBrushAndPenContext=CCoeBrushAndPenContext::NewL(); |
|
231 iAttributes->iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
232 SetControlContext(iAttributes->iBrushAndPenContext); |
|
233 } |
|
234 |
|
235 if (!iPrompt) |
|
236 { |
|
237 iPrompt = CAknTextControl::NewL(); |
|
238 iPrompt->SetContainerWindowL(*this); |
|
239 } |
|
240 |
|
241 if (!iAttributes->iPage) |
|
242 { |
|
243 iAttributes->iPage = CAknTextControl::NewL(); |
|
244 iAttributes->iPage->SetContainerWindowL(*this); |
|
245 iAttributes->iPage->MakeVisible(EFalse); |
|
246 } |
|
247 |
|
248 if (!iAttributes->iCloseButton) |
|
249 { |
|
250 TResourceReader reader; |
|
251 CEikonEnv::Static()->CreateResourceReaderLC( reader, R_AVKON_SCT_HEADING_CLOSE_BUTTON ); |
|
252 iAttributes->iCloseButton = CAknButton::NewL(reader); |
|
253 iAttributes->iCloseButton->SetContainerWindowL(*this); |
|
254 iAttributes->iCloseButton->MakeVisible(EFalse); |
|
255 iAttributes->iCloseButton->SetObserver(iAttributes); |
|
256 iAttributes->iCloseButton->SetRequestExit( ETrue ); |
|
257 CleanupStack::PopAndDestroy(); //reader buffer |
|
258 iAttributes->SetEnableCloseButton(); |
|
259 } |
|
260 |
|
261 SetTextL(aReader.ReadTPtrC()); |
|
262 |
|
263 HBufC* bitmapFile = aReader.ReadHBufCL(); // bmp filename |
|
264 TInt bitmapId = aReader.ReadInt16(); // bmp id |
|
265 TInt maskId = aReader.ReadInt16(); // bmp mask id |
|
266 if (bitmapFile != NULL) |
|
267 { |
|
268 CleanupStack::PushL(bitmapFile); |
|
269 iHeaderImage = new (ELeave) CEikImage; |
|
270 iHeaderImage->SetContainerWindowL(*this); |
|
271 iHeaderImage->SetNonFocusing(); |
|
272 iHeaderImage->SetAlignment(EHCenterVCenter); |
|
273 |
|
274 if (bitmapId != -1) |
|
275 { |
|
276 CFbsBitmap* bitmap; |
|
277 if (maskId != -1) |
|
278 { |
|
279 CFbsBitmap* mask; |
|
280 AknIconUtils::CreateIconLC(bitmap, mask, *bitmapFile, bitmapId, maskId); |
|
281 TAknLayoutRect layout; |
|
282 layout.LayoutRect(Rect(), AknLayoutScalable_Avkon::heading_pane_g2()); // Icon |
|
283 User::LeaveIfError(AknIconUtils::SetSize(bitmap, layout.Rect().Size())); |
|
284 iHeaderImage->SetPicture(bitmap, mask); |
|
285 iHeaderImage->SetPictureOwnedExternally(EFalse); |
|
286 CleanupStack::Pop(2); //bitmap, mask |
|
287 } |
|
288 else |
|
289 { |
|
290 bitmap = AknIconUtils::CreateIconL(*bitmapFile, bitmapId); |
|
291 CleanupStack::PushL(bitmap); |
|
292 TAknLayoutRect layout; |
|
293 layout.LayoutRect(Rect(), AknLayoutScalable_Avkon::heading_pane_g2()); // Icon |
|
294 User::LeaveIfError(AknIconUtils::SetSize(bitmap, layout.Rect().Size())); |
|
295 iHeaderImage->SetPicture(bitmap); |
|
296 iHeaderImage->SetPictureOwnedExternally(EFalse); |
|
297 CleanupStack::Pop(); //bitmap |
|
298 } |
|
299 } |
|
300 CleanupStack::PopAndDestroy(); // bitmapFile |
|
301 } |
|
302 |
|
303 TInt animationId = aReader.ReadUint32(); |
|
304 if (animationId != 0) |
|
305 { |
|
306 if (!iAnimation) |
|
307 {// no animation previously set |
|
308 SetHeaderAnimationL(animationId); |
|
309 } |
|
310 } |
|
311 |
|
312 iHeadingLayoutRef = aReader.ReadUint32(); |
|
313 |
|
314 // extension needed for heading skinning |
|
315 if ( !iExtension ) |
|
316 { |
|
317 iExtension = new (ELeave) CAknPopupHeadingPaneExtension; |
|
318 } |
|
319 |
|
320 iExtension->iFrameId = KAknsIIDQsnFrPopupHeading; |
|
321 iExtension->iFrameCenterId = KAknsIIDQsnFrPopupHeadingCenter; |
|
322 |
|
323 SetNonFocusing(); |
|
324 } |
|
325 |
|
326 EXPORT_C void CAknPopupHeadingPane::SetTextL(TPtrC aText) |
|
327 { |
|
328 __ASSERT_DEBUG(iPrompt,Panic(EAknPanicNullPointer)); |
|
329 iPrompt->SetTextL(aText); |
|
330 |
|
331 __ASSERT_DEBUG(iAttributes->iPage,Panic(EAknPanicNullPointer)); |
|
332 // Reset page number when be more than one page |
|
333 if (iAttributes->iMaxPage > 1) |
|
334 { |
|
335 HBufC* page = PageTextL(); |
|
336 CleanupStack::PushL(page); |
|
337 iAttributes->iPage->SetTextL(*page); |
|
338 CleanupStack::PopAndDestroy(); // page |
|
339 } |
|
340 |
|
341 DoSetPromptL(); |
|
342 if (!Rect().IsEmpty()) |
|
343 { |
|
344 SizeChanged(); |
|
345 } |
|
346 } |
|
347 |
|
348 EXPORT_C void CAknPopupHeadingPane::SetHeaderImageOwnedL(CEikImage *aImage) |
|
349 { |
|
350 delete iHeaderImage; |
|
351 iHeaderImage = aImage; |
|
352 |
|
353 if ( iHeaderImage ) |
|
354 { |
|
355 iHeaderImage->SetContainerWindowL(*this); |
|
356 iHeaderImage->SetNonFocusing(); |
|
357 iHeaderImage->SetAlignment(EHCenterVCenter); |
|
358 } |
|
359 |
|
360 DoSetPromptL(); |
|
361 if (!Rect().IsEmpty()) |
|
362 { |
|
363 SizeChanged(); |
|
364 } |
|
365 } |
|
366 |
|
367 EXPORT_C void CAknPopupHeadingPane::SetHeaderImageL(CEikImage *aImage) |
|
368 { |
|
369 if ( !iHeaderImage ) |
|
370 { |
|
371 iHeaderImage = new (ELeave) CEikImage; |
|
372 iHeaderImage->SetContainerWindowL(*this); |
|
373 iHeaderImage->SetNonFocusing(); |
|
374 iHeaderImage->SetAlignment(EHCenterVCenter); |
|
375 } |
|
376 |
|
377 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); |
|
378 CleanupStack::PushL(bitmap); |
|
379 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
|
380 bitmap->Duplicate(aImage->Bitmap()->Handle()); |
|
381 mask->Duplicate(aImage->Mask()->Handle()); |
|
382 iHeaderImage->SetPicture(bitmap, mask); |
|
383 iHeaderImage->SetPictureOwnedExternally(EFalse); |
|
384 CleanupStack::Pop(); // bitmap |
|
385 |
|
386 DoSetPromptL(); |
|
387 if (!Rect().IsEmpty()) |
|
388 { |
|
389 SizeChanged(); |
|
390 } |
|
391 } |
|
392 |
|
393 EXPORT_C void CAknPopupHeadingPane::SetHeaderAnimationL( TInt aResourceId ) |
|
394 { |
|
395 if (aResourceId <= 0) |
|
396 { |
|
397 return; |
|
398 } |
|
399 |
|
400 // If header image set, delete it! |
|
401 delete iHeaderImage; |
|
402 iHeaderImage = NULL; |
|
403 |
|
404 delete iAnimation; |
|
405 iAnimation = NULL; |
|
406 iAnimation = CAknBitmapAnimation::NewL(); |
|
407 |
|
408 TResourceReader reader; |
|
409 CCoeEnv::Static()->CreateResourceReaderLC(reader,aResourceId); |
|
410 iAnimation->ConstructFromResourceL(reader); |
|
411 CleanupStack::PopAndDestroy(); //reader buffer |
|
412 |
|
413 iAnimation->SetContainerWindowL(*this); |
|
414 iAnimation->SetNonFocusing(); |
|
415 |
|
416 DoSetPromptL(); |
|
417 if (!Rect().IsEmpty()) |
|
418 { |
|
419 SizeChanged(); |
|
420 } |
|
421 } |
|
422 |
|
423 EXPORT_C void CAknPopupHeadingPane::SetLayout( THeadingPaneLayout aLayout ) |
|
424 { |
|
425 iAttributes->iLayout = aLayout; |
|
426 } |
|
427 |
|
428 void CAknPopupHeadingPane::DoSetPromptL() |
|
429 { |
|
430 __ASSERT_DEBUG(iPrompt,Panic(EAknPanicNullPointer)); |
|
431 |
|
432 CArrayFixFlat<TInt>* lineWidths = new(ELeave)CArrayFixFlat<TInt>(1); |
|
433 CleanupStack::PushL(lineWidths); |
|
434 |
|
435 TAknTextComponentLayout textLayout = AknLayoutScalable_Avkon::heading_pane_t1(0); |
|
436 if (iHeaderImage || iAnimation) |
|
437 { |
|
438 textLayout = AknLayoutScalable_Avkon::heading_pane_t1(2); |
|
439 } |
|
440 |
|
441 if (iAttributes->iPage->IsVisible()) |
|
442 { |
|
443 TInt varietyIndex = (AknLayoutUtils::PenEnabled())? 3 : 1; |
|
444 textLayout = AknLayoutScalable_Avkon::heading_pane_t1(varietyIndex); |
|
445 } |
|
446 |
|
447 TRect parentRect; |
|
448 TAknLayoutRect popupRect; |
|
449 if(!AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, parentRect)) |
|
450 { |
|
451 parentRect = iAvkonAppUi->ClientRect(); |
|
452 } |
|
453 popupRect.LayoutRect(parentRect, AknLayoutScalable_Avkon::popup_window_general(1)); |
|
454 |
|
455 TAknLayoutRect headingRect; |
|
456 TAknWindowComponentLayout headingPaneLayout; |
|
457 if (iAttributes->iLayout == EMessageQueryHeadingPane) |
|
458 { |
|
459 headingPaneLayout = AknLayoutScalable_Avkon::heading_pane_cp5(); |
|
460 } |
|
461 else |
|
462 { |
|
463 headingPaneLayout = AknLayoutScalable_Avkon::heading_pane(0); |
|
464 } |
|
465 headingRect.LayoutRect(TRect(TPoint(0,0),popupRect.Rect().Size()), headingPaneLayout); |
|
466 parentRect = headingRect.Rect(); |
|
467 |
|
468 TAknLayoutText textRect; |
|
469 textRect.LayoutText(parentRect, textLayout); |
|
470 |
|
471 lineWidths->AppendL(textRect.TextRect().Width()); |
|
472 |
|
473 const CFont* promptFont = AknLayoutUtils::FontFromId( textLayout.Font() ); |
|
474 iPrompt->ParseTextL(promptFont, lineWidths); |
|
475 |
|
476 CleanupStack::PopAndDestroy(); //lineWidths |
|
477 |
|
478 lineWidths = new(ELeave)CArrayFixFlat<TInt>(1); |
|
479 CleanupStack::PushL(lineWidths); |
|
480 |
|
481 TInt varietyIndex = (iAttributes->IsEnableCloseButton())? 1 : 0; |
|
482 textLayout = AknLayoutScalable_Avkon::heading_pane_t2(varietyIndex); |
|
483 textRect.LayoutText(parentRect, textLayout); |
|
484 |
|
485 lineWidths->AppendL(textRect.TextRect().Width()); |
|
486 const CFont* fontUsed = AknLayoutUtils::FontFromId( textLayout.Font() ); |
|
487 iAttributes->iPage->ParseTextL(fontUsed, lineWidths); |
|
488 CleanupStack::PopAndDestroy(); //lineWidths |
|
489 } |
|
490 |
|
491 |
|
492 EXPORT_C void CAknPopupHeadingPane::SizeChanged() |
|
493 { |
|
494 if (iAttributes->iLayout == EQueryHeadingPane) |
|
495 { |
|
496 LayoutQueryHeadingPane(); |
|
497 } |
|
498 else if (iAttributes->iLayout == EColourSelectionGridHeadingPane) |
|
499 { |
|
500 LayoutColourSelectionGridHeadingPane(); |
|
501 } |
|
502 else if (iAttributes->iLayout == EMessageQueryHeadingPane) |
|
503 { |
|
504 LayoutMessageQueryHeadingPane(); |
|
505 } |
|
506 else |
|
507 { |
|
508 LayoutListHeadingPane(); |
|
509 } |
|
510 |
|
511 if (iHeaderImage) |
|
512 { |
|
513 TAknLayoutRect layout; |
|
514 layout.LayoutRect(Rect(), AknLayoutScalable_Avkon::heading_pane_g2()); |
|
515 AknIconUtils::SetSize(CONST_CAST(CFbsBitmap*, iHeaderImage->Bitmap()), layout.Rect().Size()); |
|
516 } |
|
517 |
|
518 AknsUtils::RegisterControlPosition(this); |
|
519 } |
|
520 |
|
521 |
|
522 void CAknPopupHeadingPane::LayoutQueryHeadingPane() |
|
523 { |
|
524 TRect parentRect = Rect(); |
|
525 |
|
526 TAknLayoutRect headingLayoutRect; |
|
527 headingLayoutRect.LayoutRect(parentRect, AknLayoutScalable_Avkon::heading_pane(0)); |
|
528 TRect headingrect(headingLayoutRect.Rect()); |
|
529 |
|
530 iPrompt->SetRect(headingrect); |
|
531 iAttributes->iPage->SetRect(headingrect); |
|
532 |
|
533 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
534 TRgb color; |
|
535 TInt error = AknsUtils::GetCachedColor( skin, |
|
536 color, |
|
537 KAknsIIDQsnTextColors, |
|
538 EAknsCIQsnTextColorsCG19 ); |
|
539 |
|
540 |
|
541 TInt headingPaneTextIndex = 0; |
|
542 // Layout the heading text |
|
543 if (iPrompt->NumberOfLines() > 0) |
|
544 { |
|
545 if ( iHeaderImage || iAnimation ) |
|
546 { |
|
547 headingPaneTextIndex = 2; |
|
548 if ( iAnimation ) |
|
549 { |
|
550 AknLayoutUtils::LayoutControl(iAnimation, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
551 } |
|
552 else |
|
553 { |
|
554 AknLayoutUtils::LayoutImage(iHeaderImage, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
555 } |
|
556 } |
|
557 else if (iAttributes->iPage->IsVisible()) |
|
558 { |
|
559 // Page number layout needed. |
|
560 headingPaneTextIndex = (AknLayoutUtils::PenEnabled())? 3 : 1; |
|
561 } |
|
562 |
|
563 TAknTextComponentLayout headingPrompt = AknLayoutScalable_Avkon::heading_pane_t1(headingPaneTextIndex); |
|
564 |
|
565 AknLayoutUtils::LayoutLabel(iPrompt->Line(0), headingrect, headingPrompt); |
|
566 if (!error) |
|
567 { |
|
568 // Ignore error |
|
569 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iPrompt->Line(0), |
|
570 EColorLabelText, color ) ); |
|
571 } |
|
572 } |
|
573 |
|
574 // Layout page number text |
|
575 if (iAttributes->iPage->IsVisible() && iAttributes->iPage->NumberOfLines() > 0) |
|
576 { |
|
577 TInt varietyIndex = (iAttributes->IsEnableCloseButton())? 1 : 0; |
|
578 TAknTextComponentLayout headingPrompt2 = AknLayoutScalable_Avkon::heading_pane_t2(varietyIndex); |
|
579 |
|
580 AknLayoutUtils::LayoutLabel(iAttributes->iPage->Line(0), headingrect, headingPrompt2); |
|
581 if (!error) |
|
582 { |
|
583 // Ignore error |
|
584 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iAttributes->iPage->Line(0), |
|
585 EColorLabelText, color ) ); |
|
586 } |
|
587 } |
|
588 |
|
589 // Layout close button |
|
590 if (iAttributes->IsEnableCloseButton()) |
|
591 { |
|
592 TAknLayoutRect buttonLayoutRect; |
|
593 buttonLayoutRect.LayoutRect(headingrect, AknLayoutScalable_Avkon::heading_pane_g1()); |
|
594 iAttributes->iCloseButton->SetRect(buttonLayoutRect.Rect()); |
|
595 iAttributes->iCloseButton->MakeVisible(ETrue); |
|
596 } |
|
597 |
|
598 } |
|
599 |
|
600 void CAknPopupHeadingPane::LayoutListHeadingPane() |
|
601 { |
|
602 TRect headingrect = Rect(); |
|
603 iPrompt->SetRect(headingrect); |
|
604 |
|
605 if (iPrompt->NumberOfLines() > 0) |
|
606 { |
|
607 TAknTextComponentLayout textLayout = AknLayoutScalable_Avkon::heading_pane_t1(0); |
|
608 |
|
609 if (iAnimation || iHeaderImage) |
|
610 { |
|
611 textLayout = AknLayoutScalable_Avkon::heading_pane_t1(1); |
|
612 } |
|
613 |
|
614 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
615 TRgb color; |
|
616 TInt error = AknsUtils::GetCachedColor( skin, color, |
|
617 KAknsIIDQsnTextColors, |
|
618 EAknsCIQsnTextColorsCG19 ); |
|
619 |
|
620 AknLayoutUtils::LayoutLabel(iPrompt->Line(0), headingrect, textLayout); |
|
621 |
|
622 if (!error) |
|
623 { |
|
624 // Ignore error |
|
625 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( |
|
626 *iPrompt->Line(0), |
|
627 EColorLabelText, color ) ); |
|
628 } |
|
629 TAknWindowLineLayout icon( AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
630 if ( iAnimation ) |
|
631 { |
|
632 AknLayoutUtils::LayoutControl(iAnimation, headingrect, icon ); |
|
633 } |
|
634 else if ( iHeaderImage ) |
|
635 { |
|
636 TAknLayoutRect r; |
|
637 r.LayoutRect( Rect(), icon ); |
|
638 AknLayoutUtils::LayoutImage(iHeaderImage, headingrect, icon ); |
|
639 } |
|
640 } |
|
641 } |
|
642 |
|
643 void CAknPopupHeadingPane::LayoutColourSelectionGridHeadingPane() |
|
644 { |
|
645 TAknWindowLineLayout headingPaneWindowLine; |
|
646 if (iAttributes->iLayout == EColourSelectionGridHeadingPane) |
|
647 { |
|
648 headingPaneWindowLine = AknLayoutScalable_Avkon::heading_pane_cp4(); |
|
649 } |
|
650 else |
|
651 { |
|
652 headingPaneWindowLine = AknLayoutScalable_Avkon::heading_pane(1); |
|
653 } |
|
654 |
|
655 TAknLayoutRect headingLayoutRect; |
|
656 headingLayoutRect.LayoutRect(Rect(), headingPaneWindowLine); |
|
657 TRect headingrect = headingLayoutRect.Rect(); |
|
658 iPrompt->SetRect(headingrect); |
|
659 iAttributes->iPage->SetRect(headingrect); |
|
660 |
|
661 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
662 TRgb color; |
|
663 TInt error = AknsUtils::GetCachedColor( skin, |
|
664 color, |
|
665 KAknsIIDQsnTextColors, |
|
666 EAknsCIQsnTextColorsCG19 ); |
|
667 |
|
668 TInt headingPaneTextIndex = 0; |
|
669 // Layout the heading text |
|
670 if (iPrompt->NumberOfLines() > 0) |
|
671 { |
|
672 if ( iHeaderImage || iAnimation ) |
|
673 { |
|
674 headingPaneTextIndex = 2; |
|
675 if ( iAnimation ) |
|
676 { |
|
677 AknLayoutUtils::LayoutControl(iAnimation, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
678 } |
|
679 else |
|
680 { |
|
681 AknLayoutUtils::LayoutImage(iHeaderImage, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
682 } |
|
683 } |
|
684 else if (iAttributes->iPage->IsVisible()) |
|
685 { |
|
686 // Page number layout needed. |
|
687 headingPaneTextIndex = (AknLayoutUtils::PenEnabled())? 3 : 1; |
|
688 } |
|
689 |
|
690 TAknTextComponentLayout headingPrompt = AknLayoutScalable_Avkon::heading_pane_t1(headingPaneTextIndex); |
|
691 |
|
692 AknLayoutUtils::LayoutLabel(iPrompt->Line(0), headingrect, headingPrompt); |
|
693 if (!error) |
|
694 { |
|
695 // Ignore error |
|
696 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iPrompt->Line(0), |
|
697 EColorLabelText, color ) ); |
|
698 } |
|
699 } |
|
700 |
|
701 // Layout page number text |
|
702 if (iAttributes->iPage->IsVisible() && iAttributes->iPage->NumberOfLines() > 0) |
|
703 { |
|
704 TInt varietyIndex = (iAttributes->IsEnableCloseButton())? 1 : 0; |
|
705 TAknTextComponentLayout headingPrompt2 = AknLayoutScalable_Avkon::heading_pane_t2(varietyIndex); |
|
706 |
|
707 AknLayoutUtils::LayoutLabel(iAttributes->iPage->Line(0), headingrect, headingPrompt2); |
|
708 |
|
709 if (!error) |
|
710 { |
|
711 // Ignore error |
|
712 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iAttributes->iPage->Line(0), |
|
713 EColorLabelText, color ) ); |
|
714 } |
|
715 } |
|
716 |
|
717 // Layout close button |
|
718 if (iAttributes->IsEnableCloseButton()) |
|
719 { |
|
720 TAknLayoutRect buttonLayoutRect; |
|
721 buttonLayoutRect.LayoutRect(headingrect, AknLayoutScalable_Avkon::heading_pane_g1()); |
|
722 iAttributes->iCloseButton->SetRect(buttonLayoutRect.Rect()); |
|
723 iAttributes->iCloseButton->MakeVisible(ETrue); |
|
724 } |
|
725 } |
|
726 |
|
727 void CAknPopupHeadingPane::LayoutMessageQueryHeadingPane() |
|
728 { |
|
729 TRect parentRect = Rect(); |
|
730 |
|
731 TAknLayoutRect headingLayoutRect; |
|
732 headingLayoutRect.LayoutRect(parentRect, AknLayoutScalable_Avkon::heading_pane_cp5()); |
|
733 TRect headingrect(headingLayoutRect.Rect()); |
|
734 iPrompt->SetRect(headingrect); |
|
735 iAttributes->iPage->SetRect(headingrect); |
|
736 |
|
737 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
738 TRgb color; |
|
739 TInt error = AknsUtils::GetCachedColor( skin, |
|
740 color, |
|
741 KAknsIIDQsnTextColors, |
|
742 EAknsCIQsnTextColorsCG19 ); |
|
743 |
|
744 |
|
745 TInt headingPaneTextIndex = 0; |
|
746 // Layout the heading text |
|
747 if (iPrompt->NumberOfLines() > 0) |
|
748 { |
|
749 if ( iHeaderImage || iAnimation ) |
|
750 { |
|
751 headingPaneTextIndex = 2; |
|
752 if ( iAnimation ) |
|
753 { |
|
754 AknLayoutUtils::LayoutControl(iAnimation, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
755 } |
|
756 else |
|
757 { |
|
758 AknLayoutUtils::LayoutImage(iHeaderImage, headingrect, AknLayoutScalable_Avkon::heading_pane_g2() ); // Icon |
|
759 } |
|
760 } |
|
761 else if (iAttributes->iPage->IsVisible()) |
|
762 { |
|
763 // Page number layout needed. |
|
764 headingPaneTextIndex = (AknLayoutUtils::PenEnabled())? 3 : 1; |
|
765 } |
|
766 TAknTextComponentLayout headingPrompt = AknLayoutScalable_Avkon::heading_pane_t1(headingPaneTextIndex); |
|
767 |
|
768 AknLayoutUtils::LayoutLabel(iPrompt->Line(0), headingrect, headingPrompt); |
|
769 if (!error) |
|
770 { |
|
771 // Ignore error |
|
772 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iPrompt->Line(0), |
|
773 EColorLabelText, color ) ); |
|
774 } |
|
775 } |
|
776 |
|
777 // Layout page number text |
|
778 if (iAttributes->iPage->IsVisible() && iAttributes->iPage->NumberOfLines() > 0) |
|
779 { |
|
780 TInt varietyIndex = (iAttributes->IsEnableCloseButton())? 1 : 0; |
|
781 TAknTextComponentLayout headingPrompt2 = AknLayoutScalable_Avkon::heading_pane_t2(varietyIndex); |
|
782 |
|
783 AknLayoutUtils::LayoutLabel(iAttributes->iPage->Line(0), headingrect, headingPrompt2); |
|
784 |
|
785 if (!error) |
|
786 { |
|
787 // Ignore error |
|
788 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iAttributes->iPage->Line(0), |
|
789 EColorLabelText, color ) ); |
|
790 } |
|
791 } |
|
792 |
|
793 // Layout close button |
|
794 if (iAttributes->IsEnableCloseButton()) |
|
795 { |
|
796 TAknLayoutRect buttonLayoutRect; |
|
797 buttonLayoutRect.LayoutRect(headingrect, AknLayoutScalable_Avkon::heading_pane_g1()); |
|
798 iAttributes->iCloseButton->SetRect(buttonLayoutRect.Rect()); |
|
799 iAttributes->iCloseButton->MakeVisible(ETrue); |
|
800 } |
|
801 } |
|
802 |
|
803 EXPORT_C TSize CAknPopupHeadingPane::MinimumSize() |
|
804 { |
|
805 if (iPrompt->NumberOfLines() == 0) |
|
806 { |
|
807 return TSize(0,0); |
|
808 } |
|
809 |
|
810 TRect popupRect = Rect(); |
|
811 TRect mainPaneRect; |
|
812 if( iAttributes->iLayout == EColourSelectionGridHeadingPane ) |
|
813 { |
|
814 if(!AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EPopupParent, mainPaneRect)) |
|
815 { |
|
816 mainPaneRect = iAvkonAppUi->ClientRect(); |
|
817 } |
|
818 } |
|
819 else |
|
820 { |
|
821 if(!AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect)) |
|
822 { |
|
823 mainPaneRect = iAvkonAppUi->ClientRect(); |
|
824 } |
|
825 } |
|
826 |
|
827 TAknWindowComponentLayout popupWindowLayout; |
|
828 TAknLayoutRect popupLayoutRect; |
|
829 if ( iAttributes->iLayout == EColourSelectionGridHeadingPane ) |
|
830 { |
|
831 TInt colourPopupVariety = 0; |
|
832 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
833 { |
|
834 switch (AknLayoutUtils::CbaLocation()) |
|
835 { |
|
836 case AknLayoutUtils::EAknCbaLocationBottom: |
|
837 //Bottom softkeyt |
|
838 colourPopupVariety = 1; |
|
839 break; |
|
840 case AknLayoutUtils::EAknCbaLocationRight: |
|
841 //Right softkeyt |
|
842 colourPopupVariety = 2; |
|
843 break; |
|
844 case AknLayoutUtils::EAknCbaLocationLeft: |
|
845 //Left softkeyt |
|
846 colourPopupVariety = 3; |
|
847 break; |
|
848 default: |
|
849 break; |
|
850 } |
|
851 } |
|
852 popupWindowLayout = AknLayoutScalable_Avkon::popup_large_graphic_colour_window(colourPopupVariety); |
|
853 } |
|
854 else |
|
855 { |
|
856 popupWindowLayout = AknLayoutScalable_Avkon::popup_window_general(1); |
|
857 } |
|
858 popupLayoutRect.LayoutRect(mainPaneRect, popupWindowLayout); |
|
859 popupRect = TRect(TPoint(0,0), popupLayoutRect.Rect().Size()); |
|
860 |
|
861 TAknWindowComponentLayout headingPaneWindowLayout; |
|
862 if (iAttributes->iLayout == EColourSelectionGridHeadingPane) |
|
863 { |
|
864 headingPaneWindowLayout = AknLayoutScalable_Avkon::heading_pane_cp4(); |
|
865 } |
|
866 else if (iAttributes->iLayout == EMessageQueryHeadingPane) |
|
867 { |
|
868 headingPaneWindowLayout = AknLayoutScalable_Avkon::heading_pane_cp5(); |
|
869 } |
|
870 else |
|
871 { |
|
872 headingPaneWindowLayout = AknLayoutScalable_Avkon::heading_pane(0); |
|
873 } |
|
874 |
|
875 TAknLayoutRect headingPaneRect; |
|
876 headingPaneRect.LayoutRect(popupRect, headingPaneWindowLayout); |
|
877 |
|
878 TSize minimumSize; |
|
879 if (iAttributes->iLayout == EColourSelectionGridHeadingPane || |
|
880 iAttributes->iLayout == EMessageQueryHeadingPane) |
|
881 { |
|
882 minimumSize = TSize(popupRect.Width(), headingPaneRect.Rect().iBr.iY - popupRect.iTl.iY); |
|
883 } |
|
884 else |
|
885 { |
|
886 #ifndef RD_NO_DIALOG_BORDERS |
|
887 minimumSize = TSize(headingPaneRect.Rect().Width(), headingPaneRect.Rect().iTl.iY + headingPaneRect.Rect().Height()); |
|
888 #else |
|
889 minimumSize = headingPaneRect.Rect().Size(); |
|
890 #endif |
|
891 } |
|
892 |
|
893 return minimumSize; |
|
894 } |
|
895 |
|
896 EXPORT_C void CAknPopupHeadingPane::Draw(const TRect &/*aRect*/) const |
|
897 { |
|
898 TRect parentRect = Rect(); |
|
899 CWindowGc &gc = SystemGc(); |
|
900 gc.Reset(); |
|
901 |
|
902 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
903 |
|
904 TRect windowRect = parentRect; |
|
905 TAknLayoutRect headingLayoutRect; |
|
906 TAknWindowComponentLayout headingPaneLayout; |
|
907 |
|
908 if (iAttributes->iLayout == EMessageQueryHeadingPane) |
|
909 { |
|
910 headingPaneLayout = AknLayoutScalable_Avkon::heading_pane_cp5(); |
|
911 } |
|
912 else if(iAttributes->iLayout == EQueryHeadingPane) |
|
913 { |
|
914 headingPaneLayout = AknLayoutScalable_Avkon::heading_pane(0); |
|
915 } |
|
916 else if(iAttributes->iLayout == EColourSelectionGridHeadingPane) |
|
917 { |
|
918 headingPaneLayout = AknLayoutScalable_Avkon::heading_pane_cp4(); |
|
919 } |
|
920 |
|
921 headingLayoutRect.LayoutRect(parentRect, headingPaneLayout); |
|
922 windowRect = headingLayoutRect.Rect(); |
|
923 |
|
924 TAknWindowComponentLayout innerArea = AknLayoutScalable_Avkon::bg_popup_heading_pane_g1(); |
|
925 TAknLayoutRect inner; |
|
926 inner.LayoutRect(windowRect, innerArea .LayoutLine()); |
|
927 |
|
928 TRect outerRect = windowRect; |
|
929 TRect innerRect = inner.Rect(); |
|
930 |
|
931 TBool drawn(EFalse); |
|
932 |
|
933 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); // get parent's cc |
|
934 |
|
935 /* |
|
936 // with transparency on, we can't draw both background and frame |
|
937 if ( CAknEnv::Static()->TransparencyEnabled() ) |
|
938 { |
|
939 if ( iExtension ) |
|
940 { |
|
941 TRegionFix<1> dontDrawRegion; |
|
942 TRegionFix<4> drawRegion; |
|
943 dontDrawRegion.AddRect( outerRect ); |
|
944 drawRegion.AddRect( parentRect ); |
|
945 drawRegion.SubRegion( dontDrawRegion ); |
|
946 // this causes wserver flush, but only if parentRect != outerRect |
|
947 gc.SetClippingRegion( drawRegion ); |
|
948 AknsDrawUtils::Background( skin, cc, this, gc, parentRect ); |
|
949 gc.CancelClippingRegion(); |
|
950 drawn = AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
|
951 iExtension->iFrameId, |
|
952 iExtension->iFrameCenterId ); |
|
953 if ( !drawn ) |
|
954 { |
|
955 // Couldn't draw frame, draw background again without clipping |
|
956 drawn = AknsDrawUtils::Background( skin, cc, this, gc, parentRect ); |
|
957 } |
|
958 } |
|
959 else |
|
960 { |
|
961 drawn = AknsDrawUtils::Background( skin, cc, this, gc, parentRect ); |
|
962 } |
|
963 }*/ |
|
964 |
|
965 drawn = AknsDrawUtils::Background( skin, cc, this, gc, parentRect ); |
|
966 if ( iExtension ) |
|
967 { |
|
968 drawn |= AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
|
969 iExtension->iFrameId, |
|
970 iExtension->iFrameCenterId); |
|
971 } |
|
972 else |
|
973 { |
|
974 drawn = AknsDrawUtils::Background( skin, cc, this, gc, parentRect ); |
|
975 } |
|
976 |
|
977 if (!drawn) // skin drawing didn't work, so just clear the rect |
|
978 { |
|
979 gc.Clear(parentRect); |
|
980 } |
|
981 } |
|
982 |
|
983 EXPORT_C CEikLabel* CAknPopupHeadingPane::Prompt() const |
|
984 { |
|
985 return iPrompt->Line(0); |
|
986 } |
|
987 |
|
988 EXPORT_C TPtr CAknPopupHeadingPane::PromptText() const |
|
989 { |
|
990 return iPrompt->Text(); |
|
991 } |
|
992 |
|
993 CCoeControl* CAknPopupHeadingPane::ComponentControl(TInt anIndex) const |
|
994 { |
|
995 CCoeControl* controls[] = |
|
996 { |
|
997 iPrompt, |
|
998 iHeaderImage, |
|
999 iAnimation, |
|
1000 iAttributes->iPage, |
|
1001 iAttributes->iCloseButton |
|
1002 }; |
|
1003 |
|
1004 for ( TUint ii=0; ii < sizeof(controls)/sizeof(CCoeControl*); ii++) |
|
1005 if ( controls[ii] && anIndex-- == 0 ) |
|
1006 { |
|
1007 return controls[ii]; |
|
1008 } |
|
1009 return NULL; |
|
1010 } |
|
1011 |
|
1012 |
|
1013 TInt CAknPopupHeadingPane::CountComponentControls() const |
|
1014 { |
|
1015 TInt count = 0; |
|
1016 CCoeControl* controls[] = |
|
1017 { |
|
1018 iPrompt, |
|
1019 iHeaderImage, |
|
1020 iAnimation, |
|
1021 iAttributes->iPage, |
|
1022 iAttributes->iCloseButton |
|
1023 }; |
|
1024 |
|
1025 for (TUint ii=0; ii < sizeof(controls)/sizeof(CCoeControl*); ii++ ) |
|
1026 { |
|
1027 if (controls[ii]) |
|
1028 { |
|
1029 count++; |
|
1030 } |
|
1031 } |
|
1032 return count; |
|
1033 } |
|
1034 |
|
1035 void CAknPopupHeadingPane::ActivateL() |
|
1036 { |
|
1037 CCoeControl::ActivateL(); |
|
1038 if ( iAnimation ) |
|
1039 { |
|
1040 SetAnimationBackGroundFrameL(); |
|
1041 iAnimation->StartAnimationL(); |
|
1042 } |
|
1043 } |
|
1044 |
|
1045 EXPORT_C void CAknPopupHeadingPane::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
1046 { |
|
1047 CAknControl::HandlePointerEventL( aPointerEvent ); |
|
1048 if( iExtension->iTouchObserver ) |
|
1049 iExtension->iTouchObserver->HandleHeadingPanePointerEventL( this, aPointerEvent ); |
|
1050 } |
|
1051 |
|
1052 EXPORT_C void CAknPopupHeadingPane::HandleResourceChange( TInt aType ) |
|
1053 { |
|
1054 if (iAttributes->iLayout == EQueryHeadingPane) |
|
1055 { |
|
1056 LayoutQueryHeadingPane(); |
|
1057 } |
|
1058 else if (iAttributes->iLayout == EColourSelectionGridHeadingPane) |
|
1059 { |
|
1060 LayoutColourSelectionGridHeadingPane(); |
|
1061 } |
|
1062 else if (iAttributes->iLayout == EMessageQueryHeadingPane) |
|
1063 { |
|
1064 LayoutMessageQueryHeadingPane(); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 LayoutListHeadingPane(); |
|
1069 } |
|
1070 |
|
1071 TRAP_IGNORE( DoSetPromptL() ); |
|
1072 |
|
1073 CCoeControl::HandleResourceChange( aType ); |
|
1074 |
|
1075 if (aType == KEikDynamicLayoutVariantSwitch) |
|
1076 { |
|
1077 DrawDeferred(); |
|
1078 } |
|
1079 } |
|
1080 |
|
1081 EXPORT_C void* CAknPopupHeadingPane::ExtensionInterface( TUid /*aInterface*/ ) |
|
1082 { |
|
1083 return NULL; |
|
1084 } |
|
1085 |
|
1086 EXPORT_C void CAknPopupHeadingPane::StartAnimationL() |
|
1087 { |
|
1088 __ASSERT_DEBUG(iAnimation,Panic(EAknPanicNullPointer)); |
|
1089 SetAnimationBackGroundFrameL(); |
|
1090 iAnimation->StartAnimationL(); |
|
1091 } |
|
1092 |
|
1093 EXPORT_C TInt CAknPopupHeadingPane::CancelAnimation() |
|
1094 { |
|
1095 __ASSERT_DEBUG(iAnimation,Panic(EAknPanicNullPointer)); |
|
1096 return iAnimation->CancelAnimation(); |
|
1097 } |
|
1098 |
|
1099 EXPORT_C CAknPopupHeadingPane::CAknPopupHeadingPane() |
|
1100 { |
|
1101 } |
|
1102 |
|
1103 void CAknPopupHeadingPane::SetAnimationBackGroundFrameL() |
|
1104 { |
|
1105 if (iAnimation) |
|
1106 { |
|
1107 // Not set background frame, if there is only one frame in animation. |
|
1108 CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); |
|
1109 if (animClientData != NULL && animClientData->FrameArray().Count() <= 1) |
|
1110 { |
|
1111 return; |
|
1112 } |
|
1113 |
|
1114 const TDisplayMode displayMode( |
|
1115 CCoeEnv::Static()->ScreenDevice()->DisplayMode() ); |
|
1116 |
|
1117 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; |
|
1118 CleanupStack::PushL(bitmap); |
|
1119 |
|
1120 User::LeaveIfError( bitmap->Create(iAnimation->Rect().Size(), displayMode ) ); |
|
1121 |
|
1122 CFbsBitmapDevice* doubleBufferDev = CFbsBitmapDevice::NewL( bitmap ); |
|
1123 CleanupStack::PushL(doubleBufferDev); |
|
1124 |
|
1125 CFbsBitGc* doubleBufferGc = 0; |
|
1126 User::LeaveIfError( doubleBufferDev->CreateContext( doubleBufferGc ) ); |
|
1127 CleanupStack::PushL(doubleBufferGc); |
|
1128 |
|
1129 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1130 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
1131 |
|
1132 AknsDrawUtils::DrawBackground( skin, cc, this, *doubleBufferGc, |
|
1133 TPoint(0,0), iAnimation->Rect(), KAknsDrawParamDefault ); |
|
1134 |
|
1135 CleanupStack::PopAndDestroy(2); // doubleBufferGc, doubleBufferDev |
|
1136 |
|
1137 CBitmapFrameData* data = CBitmapFrameData::NewL(); |
|
1138 data->SetBitmapsOwnedExternally( EFalse ); |
|
1139 data->SetBitmap( bitmap ); |
|
1140 |
|
1141 // Set frame to animation |
|
1142 iAnimation->BitmapAnimData()->SetBackgroundFrame( data ); // gets ownership |
|
1143 |
|
1144 CleanupStack::Pop(bitmap); |
|
1145 } |
|
1146 } |
|
1147 |
|
1148 void CAknPopupHeadingPane::SetPageL(TInt aCurrent, TInt aMax) |
|
1149 { |
|
1150 if (aMax > 0 || iAttributes->iCurrentPage != aCurrent) |
|
1151 { |
|
1152 if (aMax > 0) |
|
1153 { |
|
1154 iAttributes->iMaxPage = aMax; |
|
1155 } |
|
1156 |
|
1157 iAttributes->iPage->MakeVisible(iAttributes->iMaxPage > 1? ETrue: EFalse); |
|
1158 iAttributes->iCurrentPage = aCurrent; |
|
1159 HBufC* text = PageTextL(); |
|
1160 CleanupStack::PushL(text); |
|
1161 iAttributes->iPage->SetTextL(*text); |
|
1162 DoSetPromptL(); |
|
1163 CleanupStack::PopAndDestroy(); //text |
|
1164 DrawDeferred(); |
|
1165 } |
|
1166 } |
|
1167 |
|
1168 HBufC* CAknPopupHeadingPane::PageTextL() const |
|
1169 { |
|
1170 CArrayFix<TInt>* numbers = new(ELeave)CArrayFixFlat<TInt>(2); |
|
1171 CleanupStack::PushL(numbers); |
|
1172 numbers->AppendL(iAttributes->iCurrentPage); |
|
1173 numbers->AppendL(iAttributes->iMaxPage); |
|
1174 HBufC* page = StringLoader::LoadL( |
|
1175 R_AVKON_SPECIAL_CHARACTERS_PAGE_INDICATOR, *numbers, iEikonEnv); |
|
1176 CleanupStack::PopAndDestroy(); // numbers |
|
1177 return page; |
|
1178 } |
|
1179 |
|
1180 EXPORT_C void CAknPopupHeadingPane::SetSkinFrameId(const TAknsItemID &aFrameId) |
|
1181 { |
|
1182 if (iExtension) |
|
1183 { |
|
1184 iExtension->iFrameId = aFrameId; |
|
1185 } |
|
1186 } |
|
1187 |
|
1188 EXPORT_C void CAknPopupHeadingPane::SetSkinFrameCenterId(const TAknsItemID &aFrameCenterId) |
|
1189 { |
|
1190 if (iExtension) |
|
1191 { |
|
1192 iExtension->iFrameCenterId = aFrameCenterId; |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 void CAknPopupHeadingPane::SetTouchObserver( MAknHeadingPaneTouchObserver* aTouchObserver ) |
|
1197 { |
|
1198 iExtension->iTouchObserver = aTouchObserver; |
|
1199 } |
|
1200 |
|
1201 // End of File |