28 #include <aknbutton.h> |
28 #include <aknbutton.h> |
29 #include <vwsdef.h> |
29 #include <vwsdef.h> |
30 #include <aknview.h> |
30 #include <aknview.h> |
31 #include <apgwgnam.h> |
31 #include <apgwgnam.h> |
32 #include <aknlayoutscalable_avkon.cdl.h> |
32 #include <aknlayoutscalable_avkon.cdl.h> |
33 |
33 #include <akntransitionutils.h> |
34 #include <AknTasHook.h> // for testability hooks |
34 #include <AknTasHook.h> // for testability hooks |
35 #include <touchfeedback.h> |
35 #include <touchfeedback.h> |
|
36 #include <gfxtranseffect/gfxtranseffect.h> |
|
37 #include <akntranseffect.h> |
|
38 #include <akntransitionutils.h> |
36 const TInt KWindowPosition = 1000; // window's position |
39 const TInt KWindowPosition = 1000; // window's position |
37 |
40 |
38 // ============================ MEMBER FUNCTIONS =============================== |
41 // ============================ MEMBER FUNCTIONS =============================== |
39 |
42 |
40 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
41 // CAknPreviewPopUp::NewL |
44 // CAknPreviewPopUp::NewL |
42 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
43 // |
46 // |
44 #if defined( RD_SCALABLE_UI_V2 ) || defined( RD_PREVIEW_POPUP ) |
|
45 CAknPreviewPopUp* CAknPreviewPopUp::NewL( CCoeControl& aContent, |
47 CAknPreviewPopUp* CAknPreviewPopUp::NewL( CCoeControl& aContent, |
46 CAknPreviewPopUpController& aController, |
48 CAknPreviewPopUpController& aController, |
47 const TInt aStyle ) |
49 const TInt aStyle ) |
48 { |
50 { |
49 CAknPreviewPopUp* self = new ( ELeave ) CAknPreviewPopUp( aContent, |
51 CAknPreviewPopUp* self = new ( ELeave ) CAknPreviewPopUp( aContent, |
66 : iContent( aContent ), |
68 : iContent( aContent ), |
67 iController( aController ), |
69 iController( aController ), |
68 iFlags( aStyle ), |
70 iFlags( aStyle ), |
69 iAllowUpEvent(EFalse) |
71 iAllowUpEvent(EFalse) |
70 { |
72 { |
|
73 GfxTransEffect::Register( this, KGfxPreviewPopupControlUid ); |
71 } |
74 } |
72 |
75 |
73 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
74 // CAknPreviewPopUp::~CAknPreviewPopUp |
77 // CAknPreviewPopUp::~CAknPreviewPopUp |
75 // ----------------------------------------------------------------------------- |
78 // ----------------------------------------------------------------------------- |
76 // |
79 // |
77 CAknPreviewPopUp::~CAknPreviewPopUp() |
80 CAknPreviewPopUp::~CAknPreviewPopUp() |
78 { |
81 { |
|
82 if( iIsDeleted ) |
|
83 { |
|
84 *iIsDeleted = ETrue ; |
|
85 iIsDeleted = 0 ; |
|
86 } |
|
87 |
|
88 if ( IsVisible() ) |
|
89 { |
|
90 iCloseMenu = ETrue; |
|
91 iController.HidePopUp(); |
|
92 } |
|
93 |
79 AKNTASHOOK_REMOVE(); |
94 AKNTASHOOK_REMOVE(); |
|
95 |
|
96 GfxTransEffect::Deregister( this ); |
|
97 |
80 if ( CapturesPointer() ) |
98 if ( CapturesPointer() ) |
81 { |
99 { |
82 SetPointerCapture( EFalse ); |
100 SetPointerCapture( EFalse ); |
83 } |
101 } |
84 |
102 |
112 |
130 |
113 TRect nullRect( 0,0,0,0 ); |
131 TRect nullRect( 0,0,0,0 ); |
114 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
132 iBgContext = CAknsFrameBackgroundControlContext::NewL( |
115 iFrameId, nullRect, nullRect, EFalse ); |
133 iFrameId, nullRect, nullRect, EFalse ); |
116 |
134 |
|
135 CreateWindowL(); |
|
136 EnableWindowTransparency(); |
|
137 |
|
138 TInt stackPriority = ECoeStackPriorityCba; |
|
139 |
117 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
140 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
118 { |
141 { |
119 |
|
120 CreateWindowL(); |
|
121 |
|
122 // try to enable window transparency |
|
123 if( CAknEnv::Static()->TransparencyEnabled() ) |
|
124 { |
|
125 Window().SetRequiredDisplayMode( EColor16MA ); |
|
126 if ( Window().SetTransparencyAlphaChannel() == KErrNone ) |
|
127 { |
|
128 |
|
129 Window().SetBackgroundColor( ~0 ); |
|
130 } |
|
131 } |
|
132 |
|
133 iAvkonAppUi->AddToStackL( this, ECoeStackPriorityCba, |
|
134 ECoeStackFlagRefusesAllKeys | |
|
135 ECoeStackFlagRefusesFocus ); |
|
136 |
|
137 Window().SetPointerGrab( ETrue ); |
142 Window().SetPointerGrab( ETrue ); |
138 SetGloballyCapturing( ETrue ); |
143 SetGloballyCapturing( ETrue ); |
139 //fix for TSW error PTPA-7HNA25 |
|
140 Window().SetOrdinalPosition(KWindowPosition); |
144 Window().SetOrdinalPosition(KWindowPosition); |
141 } |
145 } |
142 else |
146 else |
143 { |
147 { |
144 CreateWindowL(); |
148 stackPriority = ECoeStackPriorityDefault; |
145 |
|
146 // try to enable window transparency |
|
147 if( CAknEnv::Static()->TransparencyEnabled() ) |
|
148 { |
|
149 Window().SetRequiredDisplayMode( EColor16MA ); |
|
150 if ( Window().SetTransparencyAlphaChannel() == KErrNone ) |
|
151 { |
|
152 |
|
153 Window().SetBackgroundColor( ~0 ); |
|
154 } |
|
155 } |
|
156 |
|
157 iAvkonAppUi->AddToStackL( this, ECoeStackPriorityDefault, |
|
158 ECoeStackFlagRefusesAllKeys | |
|
159 ECoeStackFlagRefusesFocus ); |
|
160 |
|
161 Window().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
149 Window().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
162 } |
150 } |
163 |
151 |
|
152 iAvkonAppUi->AddToStackL( this, stackPriority, |
|
153 ECoeStackFlagRefusesAllKeys | |
|
154 ECoeStackFlagRefusesFocus ); |
|
155 |
164 EnableDragEvents(); |
156 EnableDragEvents(); |
165 |
|
166 SetComponentsToInheritVisibility( ETrue ); |
157 SetComponentsToInheritVisibility( ETrue ); |
167 |
|
168 |
158 |
169 iContent.SetBackground( this ); |
159 iContent.SetBackground( this ); |
170 iContent.SetContainerWindowL( *this ); |
160 iContent.SetContainerWindowL( *this ); |
171 iContent.ActivateL(); |
161 iContent.ActivateL(); |
172 |
162 |
192 // |
181 // |
193 void CAknPreviewPopUp::Show() |
182 void CAknPreviewPopUp::Show() |
194 { |
183 { |
195 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
184 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
196 { |
185 { |
197 //fix for TSW error PTPA-7HNA25 |
|
198 Window().SetOrdinalPosition( 0 ); |
186 Window().SetOrdinalPosition( 0 ); |
199 iAvkonAppUi->UpdateStackedControlFlags( this, NULL, |
187 iAvkonAppUi->UpdateStackedControlFlags( this, NULL, |
200 ECoeStackFlagRefusesAllKeys ); |
188 ECoeStackFlagRefusesAllKeys ); |
201 |
189 |
202 if ( AknLayoutUtils::PenEnabled() ) |
190 SetPointerCapture( ETrue ); |
203 { |
|
204 SetPointerCapture( ETrue ); |
|
205 } |
|
206 } |
191 } |
207 |
192 |
208 iCloseMenu = EFalse; |
193 iCloseMenu = EFalse; |
209 Window().Invalidate(); |
194 TBool useTfx = !( iFlags & CAknPreviewPopUpController::EPermanentMode |
210 MakeVisible( ETrue ); |
195 || iFlags & CAknPreviewPopUpController::EFixedMode ); |
|
196 |
|
197 if ( useTfx && GfxTransEffect::IsRegistered( this ) ) |
|
198 { |
|
199 GfxTransEffect::Begin( this, KGfxControlAppearAction ); |
|
200 MakeVisible( ETrue ); |
|
201 GfxTransEffect::SetDemarcation( this, iPosition ); |
|
202 GfxTransEffect::End( this ); |
|
203 } |
|
204 else |
|
205 { |
|
206 MakeVisible( ETrue ); |
|
207 } |
211 if( GrabbingComponent() ) |
208 if( GrabbingComponent() ) |
212 { |
209 { |
213 iCloseMenu = ETrue; |
210 iCloseMenu = ETrue; |
214 } |
211 } |
215 iController.NotifyObservers( MAknPreviewPopUpObserver::EPreviewPopUpShown ); |
212 iController.NotifyObservers( MAknPreviewPopUpObserver::EPreviewPopUpShown ); |
225 !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) ) |
222 !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) ) |
226 { |
223 { |
227 return; |
224 return; |
228 } |
225 } |
229 |
226 |
|
227 // Skip disappear transition if the popup is either permanent, fixed or |
|
228 // faded. Fading status is checked because there can't be two parallel |
|
229 // effects applied to the same window. |
|
230 TBool useTfx = !( iFlags & CAknPreviewPopUpController::EPermanentMode |
|
231 || iFlags & CAknPreviewPopUpController::EFixedMode ) |
|
232 && !Window().IsFaded(); |
|
233 |
|
234 if ( useTfx && GfxTransEffect::IsRegistered( this ) ) |
|
235 { |
|
236 GfxTransEffect::Begin( this, KGfxControlDisappearAction ); |
|
237 MakeVisible( EFalse ); |
|
238 GfxTransEffect::End( this ); |
|
239 } |
|
240 else |
|
241 { |
|
242 MakeVisible( EFalse ); |
|
243 } |
|
244 |
230 Window().ClearRedrawStore(); |
245 Window().ClearRedrawStore(); |
231 MakeVisible( EFalse ); |
|
232 |
246 |
233 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
247 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
234 { |
248 { |
235 //fix for TSW error PTPA-7HNA25 |
|
236 Window().SetOrdinalPosition( KWindowPosition ); |
249 Window().SetOrdinalPosition( KWindowPosition ); |
237 iAvkonAppUi->UpdateStackedControlFlags( this, |
250 iAvkonAppUi->UpdateStackedControlFlags( this, |
238 ECoeStackFlagRefusesAllKeys, |
251 ECoeStackFlagRefusesAllKeys, |
239 ECoeStackFlagRefusesAllKeys ); |
252 ECoeStackFlagRefusesAllKeys ); |
240 } |
253 } |
401 |
414 |
402 AknsDrawUtils::Background( skin, cc, this, aGc, aRect ); |
415 AknsDrawUtils::Background( skin, cc, this, aGc, aRect ); |
403 } |
416 } |
404 } |
417 } |
405 |
418 |
406 // ----------------------------------------------------------------------------- |
|
407 // CAknPreviewPopUp::MakeVisible |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 void CAknPreviewPopUp::MakeVisible( TBool aVisible ) |
|
411 { |
|
412 if ( aVisible != IsVisible() ) |
|
413 { |
|
414 CCoeControl::MakeVisible( aVisible ); |
|
415 } |
|
416 } |
|
417 |
419 |
418 // ----------------------------------------------------------------------------- |
420 // ----------------------------------------------------------------------------- |
419 // CAknPreviewPopUp::CountComponentControls |
421 // CAknPreviewPopUp::CountComponentControls |
420 // ----------------------------------------------------------------------------- |
422 // ----------------------------------------------------------------------------- |
421 // |
423 // |
521 // ----------------------------------------------------------------------------- |
523 // ----------------------------------------------------------------------------- |
522 // CAknPreviewPopUp::HandlePointerEventL |
524 // CAknPreviewPopUp::HandlePointerEventL |
523 // ----------------------------------------------------------------------------- |
525 // ----------------------------------------------------------------------------- |
524 // |
526 // |
525 void CAknPreviewPopUp::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
527 void CAknPreviewPopUp::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
526 { |
528 { |
|
529 TBool isDelete = EFalse; |
|
530 iIsDeleted = &isDelete; |
|
531 |
527 if ( AknLayoutUtils::PenEnabled() ) |
532 if ( AknLayoutUtils::PenEnabled() ) |
528 { |
533 { |
529 iCloseMenu = EFalse; |
534 iCloseMenu = EFalse; |
530 if ( aPointerEvent.iType == TPointerEvent::EButton1Up && !IsVisible() ) |
535 if ( aPointerEvent.iType == TPointerEvent::EButton1Up && !IsVisible() ) |
531 { |
536 { |
532 SetPointerCapture( EFalse ); |
537 SetPointerCapture( EFalse ); |
533 } |
538 } |
534 |
539 |
535 CAknTouchPane* touchPane = iAvkonAppUi->TouchPane(); |
|
536 |
|
537 // redirect pointer event to content |
540 // redirect pointer event to content |
538 if ( Rect().Contains( aPointerEvent.iPosition ) && IsVisible() ) |
541 if ( Rect().Contains( aPointerEvent.iPosition ) && IsVisible() ) |
539 { |
542 { |
540 iAllowUpEvent = ETrue; |
543 iAllowUpEvent = ETrue; |
|
544 CleanupStack::PushL( TCleanupItem( CleanLocalRef, this ) ); |
541 CCoeControl::HandlePointerEventL( aPointerEvent ); |
545 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
546 CleanupStack::Pop(); |
|
547 if( isDelete ) |
|
548 { |
|
549 return; |
|
550 } |
542 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) && aPointerEvent.iType == TPointerEvent::EButton1Up && IsVisible() ) |
551 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) && aPointerEvent.iType == TPointerEvent::EButton1Up && IsVisible() ) |
543 { |
552 { |
544 // if pointer up is already redirected to the content, but the popup is still visible, |
553 // if pointer up is already redirected to the content, but the popup is still visible, |
545 // then the original timeout has already happened and we need to reset the timer. |
554 // then the original timeout has already happened and we need to reset the timer. |
546 // TSW Error EJZG-7JR3PC. |
555 // TSW Error EJZG-7JR3PC. |
547 iController.ResetTimer(); |
556 iController.ResetTimer(); |
548 } |
557 } |
549 } |
558 } |
550 else |
559 else |
551 { |
560 { |
552 if ( touchPane ) |
|
553 { |
|
554 if ( touchPane->IsVisible() ) |
|
555 { |
|
556 // touchpane is a window-owning control -> Rect() cannot be used |
|
557 TRect touchPaneRect( touchPane->Position(), touchPane->Size() ); |
|
558 |
|
559 if ( touchPaneRect.Contains( aPointerEvent.iParentPosition ) ) |
|
560 { |
|
561 TPointerEvent pointerEvent( aPointerEvent ); |
|
562 |
|
563 // make event's coordinates touch pane relative |
|
564 pointerEvent.iPosition = aPointerEvent.iParentPosition - |
|
565 touchPaneRect.iTl; |
|
566 |
|
567 static_cast<CCoeControl*>( touchPane )->HandlePointerEventL( |
|
568 pointerEvent ); |
|
569 } |
|
570 } |
|
571 } |
|
572 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) && |
561 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) && |
573 aPointerEvent.iType != TPointerEvent::EDrag && |
562 aPointerEvent.iType != TPointerEvent::EDrag && |
574 aPointerEvent.iType != TPointerEvent::EButtonRepeat ) |
563 aPointerEvent.iType != TPointerEvent::EButtonRepeat ) |
575 { |
564 { |
576 |
565 |
583 // All other events outside popup's rect (mainly down) |
572 // All other events outside popup's rect (mainly down) |
584 // hides the popup |
573 // hides the popup |
585 |
574 |
586 if ( aPointerEvent.iType != TPointerEvent::EButton1Up ) |
575 if ( aPointerEvent.iType != TPointerEvent::EButton1Up ) |
587 { |
576 { |
|
577 // popup will be hiden when EButton1Down comes. |
588 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
578 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
589 if ( feedback ) |
579 if ( feedback ) |
590 { |
580 { |
591 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
581 TTouchLogicalFeedback feedbackType = ETouchFeedbackPopUp; |
|
582 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
|
583 { |
|
584 feedbackType = ETouchFeedbackOptionsMenuClosed; |
|
585 } |
|
586 feedback->InstantFeedback( feedbackType ); |
592 } |
587 } |
593 iCloseMenu = ETrue; |
588 iCloseMenu = ETrue; |
594 iController.HidePopUp(); |
589 iController.HidePopUp(); |
595 } |
590 } |
596 else if ( IsVisible() ) |
591 else if ( IsVisible() ) |
610 ETouchFeedbackVibra, |
605 ETouchFeedbackVibra, |
611 aPointerEvent ); |
606 aPointerEvent ); |
612 } |
607 } |
613 else |
608 else |
614 { |
609 { |
|
610 // popup will be hiden when EButton1Down comes. |
|
611 TTouchLogicalFeedback feedbackType = ETouchFeedbackPopUp; |
|
612 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
|
613 { |
|
614 feedbackType = ETouchFeedbackOptionsMenuClosed; |
|
615 } |
615 feedback->InstantFeedback( this, |
616 feedback->InstantFeedback( this, |
616 ETouchFeedbackPopUp, |
617 feedbackType, |
617 aPointerEvent ); |
618 aPointerEvent ); |
618 } |
619 } |
619 } |
620 } |
620 iCloseMenu = ETrue; |
621 iCloseMenu = ETrue; |
621 iController.HidePopUp(); |
622 iController.HidePopUp(); |
622 } |
623 } |
623 } |
624 } |
624 |
625 |
625 // If EDontClose flag is on, also button up is forwarded for base class |
626 // If EDontClose flag is on, also button up is forwarded for base class |
626 if ( iFlags & CAknPreviewPopUpController::EDontClose ) |
627 if ( iFlags & CAknPreviewPopUpController::EDontClose ) |
627 { |
628 { |
628 if ( aPointerEvent.iType == TPointerEvent::EDrag || |
629 if ( aPointerEvent.iType == TPointerEvent::EDrag || |
629 aPointerEvent.iType == TPointerEvent::EButtonRepeat || |
630 aPointerEvent.iType == TPointerEvent::EButtonRepeat || |
630 (aPointerEvent.iType == TPointerEvent::EButton1Up && iAllowUpEvent ) ) |
631 (aPointerEvent.iType == TPointerEvent::EButton1Up && iAllowUpEvent ) ) |
631 { |
632 { |
|
633 CleanupStack::PushL( TCleanupItem( CleanLocalRef, this ) ); |
632 CCoeControl::HandlePointerEventL( aPointerEvent ); |
634 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
635 CleanupStack::Pop(); |
|
636 if( isDelete ) |
|
637 { |
|
638 return; |
|
639 } |
633 } |
640 } |
634 } |
641 } |
635 else |
642 else |
636 { |
643 { |
637 if ( aPointerEvent.iType == TPointerEvent::EDrag || |
644 if ( aPointerEvent.iType == TPointerEvent::EDrag || |
638 aPointerEvent.iType == TPointerEvent::EButtonRepeat ) |
645 aPointerEvent.iType == TPointerEvent::EButtonRepeat ) |
639 { |
646 { |
|
647 CleanupStack::PushL( TCleanupItem( CleanLocalRef, this ) ); |
640 CCoeControl::HandlePointerEventL( aPointerEvent ); |
648 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
649 CleanupStack::Pop(); |
|
650 if( isDelete ) |
|
651 { |
|
652 return; |
|
653 } |
641 } |
654 } |
642 } |
655 } |
643 |
656 |
644 } |
657 } |
645 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
658 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
646 { |
659 { |
647 iAllowUpEvent = EFalse; |
660 iAllowUpEvent = EFalse; |
648 } |
661 } |
649 } |
662 } |
|
663 |
|
664 iIsDeleted = NULL; |
650 } |
665 } |
651 |
666 |
652 // ----------------------------------------------------------------------------- |
667 // ----------------------------------------------------------------------------- |
653 // CAknPreviewPopUp::OfferKeyEventL |
668 // CAknPreviewPopUp::OfferKeyEventL |
654 // ----------------------------------------------------------------------------- |
669 // ----------------------------------------------------------------------------- |
655 // |
670 // |
656 TKeyResponse CAknPreviewPopUp::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, |
671 TKeyResponse CAknPreviewPopUp::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, |
657 TEventCode /*aType*/ ) |
672 TEventCode aType ) |
658 { |
673 { |
|
674 TKeyResponse ret ( EKeyWasNotConsumed ); |
|
675 |
659 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
676 if ( !( iFlags & CAknPreviewPopUpController::EPermanentMode ) ) |
660 { |
677 { |
661 iCloseMenu = ETrue; |
678 if ( !( iFlags & CAknPreviewPopUpController::EConsumeKeys ) ) |
662 iController.HidePopUp(); |
679 { |
|
680 iCloseMenu = ETrue; |
|
681 iController.HidePopUp(); |
|
682 } |
|
683 else |
|
684 { |
|
685 if ( aType == EEventKey || aType == EEventKeyUp ) |
|
686 { |
|
687 iCloseMenu = ETrue; |
|
688 iController.HidePopUp(); |
|
689 |
|
690 ret = EKeyWasConsumed; |
|
691 } |
|
692 } |
663 } |
693 } |
664 |
694 |
665 if ( CapturesPointer() ) |
695 if ( CapturesPointer() ) |
666 { |
696 { |
667 SetPointerCapture( EFalse ); |
697 SetPointerCapture( EFalse ); |
668 } |
698 } |
669 |
699 |
670 return EKeyWasNotConsumed; |
700 return ret; |
671 } |
701 } |
672 |
702 |
673 // ----------------------------------------------------------------------------- |
703 // ----------------------------------------------------------------------------- |
674 // CAknPreviewPopUp::MopSupplyObject |
704 // CAknPreviewPopUp::MopSupplyObject |
675 // ----------------------------------------------------------------------------- |
705 // ----------------------------------------------------------------------------- |
695 // CAknPreviewPopUp::Draw |
725 // CAknPreviewPopUp::Draw |
696 // ----------------------------------------------------------------------------- |
726 // ----------------------------------------------------------------------------- |
697 // |
727 // |
698 void CAknPreviewPopUp::Draw( const TRect& aRect ) const |
728 void CAknPreviewPopUp::Draw( const TRect& aRect ) const |
699 { |
729 { |
700 if( CAknEnv::Static()->TransparencyEnabled() ) |
730 CWindowGc& gc = SystemGc(); |
701 { |
731 |
702 |
732 TRegionFix<4> region; |
703 CWindowGc& gc = SystemGc(); |
733 region.AddRect( Rect() ); |
704 |
734 region.SubRect( iContent.Rect() ); |
705 TRegionFix< 4 > region; |
735 gc.SetClippingRegion( region ); |
706 region.AddRect( Rect() ); |
736 |
707 region.SubRect( iContent.Rect() ); |
737 DrawBackground( gc, aRect ); |
708 gc.SetClippingRegion( region ); |
738 |
709 |
739 gc.CancelClippingRegion(); |
710 DrawBackground( gc, aRect ); |
|
711 |
|
712 gc.CancelClippingRegion(); |
|
713 } |
|
714 else |
|
715 { |
|
716 CWindowGc& gc = SystemGc(); |
|
717 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
718 |
|
719 if ( !AknsDrawUtils::Background( skin, iBgContext, gc, aRect ) ) |
|
720 { |
|
721 gc.Clear( aRect ); |
|
722 } |
|
723 |
|
724 if ( HasHeading() ) |
|
725 { |
|
726 gc.SetClippingRect( aRect ); |
|
727 |
|
728 // heading graphics |
|
729 TAknLayoutRect layoutRect; |
|
730 layoutRect.LayoutRect( Rect(), |
|
731 TAknWindowComponentLayout::Compose( |
|
732 AknLayoutScalable_Avkon::heading_preview_pane(), |
|
733 AknLayoutScalable_Avkon::bg_popup_heading_pane_cp2( 1 ) ).LayoutLine() ); |
|
734 |
|
735 TRect outerRect( layoutRect.Rect() ); |
|
736 |
|
737 layoutRect.LayoutRect( outerRect, |
|
738 AknLayoutScalable_Avkon::bg_popup_heading_pane_g1() ); |
|
739 |
|
740 // There's no error checking since if skinned drawing fails heading |
|
741 // text will be drawn on top of the background. |
|
742 AknsDrawUtils::DrawFrame( skin, gc, outerRect, layoutRect.Rect(), |
|
743 KAknsIIDQsnFrPopupHeading, KAknsIIDDefault ); |
|
744 |
|
745 // heading text |
|
746 TAknLayoutText textLayout; |
|
747 textLayout.LayoutText( Rect(), |
|
748 TAknWindowComponentLayout::ComposeText( |
|
749 AknLayoutScalable_Avkon::heading_preview_pane(), |
|
750 AknLayoutScalable_Avkon::heading_preview_pane_t1( 1 ) ).LayoutLine() ); |
|
751 |
|
752 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
753 |
|
754 TRgb color( textLayout.Color() ); |
|
755 |
|
756 if ( iFlags & CAknPreviewPopUpController::ELayoutSubMenu ) |
|
757 { |
|
758 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
759 EAknsCIQsnTextColorsCG55 ); |
|
760 } |
|
761 else |
|
762 { |
|
763 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
764 EAknsCIQsnTextColorsCG19 ); |
|
765 } |
|
766 |
|
767 textLayout.DrawText( gc, *iHeadingText, ETrue, color ); |
|
768 |
|
769 gc.CancelClippingRect(); |
|
770 } |
|
771 } |
|
772 } |
740 } |
773 |
741 |
774 // ----------------------------------------------------------------------------- |
742 // ----------------------------------------------------------------------------- |
775 // CAknPreviewPopUp::CenterLayout |
743 // CAknPreviewPopUp::CenterLayout |
776 // ----------------------------------------------------------------------------- |
744 // ----------------------------------------------------------------------------- |