24 #include <eiklabel.h> |
24 #include <eiklabel.h> |
25 #include <eiksoftkeyimage.h> |
25 #include <eiksoftkeyimage.h> |
26 #include <eiksoftkeypostingtransparency.h> |
26 #include <eiksoftkeypostingtransparency.h> |
27 #include <eikbtgpc.h> |
27 #include <eikbtgpc.h> |
28 #include <aknappui.h> |
28 #include <aknappui.h> |
|
29 #include <eikappui.h> |
|
30 #include <eikapp.h> |
29 #include <AknUtils.h> // LayoutUtils |
31 #include <AknUtils.h> // LayoutUtils |
30 #include <aknlayoutscalable_apps.cdl.h> |
32 #include <aknlayoutscalable_apps.cdl.h> |
31 #include <AknsBasicBackgroundControlContext.h> |
33 #include <AknsBasicBackgroundControlContext.h> |
32 #include <AknsMaskedLayerBackgroundControlContext.h> |
34 #include <AknsMaskedLayerBackgroundControlContext.h> |
33 #include <AknsDrawUtils.h> |
35 #include <AknsDrawUtils.h> |
266 |
268 |
267 iBackgroundMaskID = KAknsIIDNone; |
269 iBackgroundMaskID = KAknsIIDNone; |
268 iCbaRect = TRect( 0,0,0,0 ); |
270 iCbaRect = TRect( 0,0,0,0 ); |
269 iIfSkinChanged = EFalse; |
271 iIfSkinChanged = EFalse; |
270 iIfMskIconSet = EFalse; |
272 iIfMskIconSet = EFalse; |
271 iSemiBgID = KAknsIIDNone; |
|
272 |
273 |
273 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
274 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
274 { |
275 { |
275 AknItemActionMenuRegister::RegisterCollectionObserverL( |
276 AknItemActionMenuRegister::RegisterCollectionObserverL( |
276 *this ); |
277 *this ); |
729 * Using the special theme Id draw background |
730 * Using the special theme Id draw background |
730 */ |
731 */ |
731 void DrawSemiTransparencyL(CWindowGc& aGc, |
732 void DrawSemiTransparencyL(CWindowGc& aGc, |
732 const TRect& aRect) |
733 const TRect& aRect) |
733 { |
734 { |
734 //Temporary inner rectangal value |
735 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
735 TRect innerRect = aRect; |
736 aGc.SetBrushColor( TRgb(128, 128, 128, 64) ); |
736 innerRect.Shrink( 5, 5 ); |
737 aGc.Clear(); |
737 if ( iSemiBgID != KAknsIIDNone ) |
738 |
738 { |
739 TAknsItemID SemiButtonID = KAknsIIDQgnHomeButtonWidget; |
739 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
740 TAknsItemID SemiButtonCenterID = KAknsIIDQgnHomeButtonWidgetCenter; |
740 aGc, aRect, innerRect, iSemiBgID, iSemiBgCenterID ); |
741 TAknsItemID SemiButtonPressedID = KAknsIIDQgnHomeButtonWidget; |
741 } |
742 TAknsItemID SemiButtonPressedCenterID = KAknsIIDQsnFrHomeCenterPressed; |
|
743 |
|
744 CEikCbaButton* button1 = static_cast<CEikCbaButton*> |
|
745 (iOwner.Control(KControlArrayCBAButton1Posn)); |
|
746 CEikCbaButton* button2 = static_cast<CEikCbaButton*> |
|
747 (iOwner.Control(KControlArrayCBAButton2Posn)); |
|
748 |
|
749 if (IsMskEnabledLayoutActive()) |
|
750 { |
|
751 TRect innerRect = iMiddleFrameOuterRect; |
|
752 innerRect.Shrink(4, 4); |
|
753 |
|
754 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*> |
|
755 (iOwner.Control(KControlArrayCBAButtonMSKPosn)); |
|
756 |
|
757 if (buttonMSK && buttonMSK->PressedDown()) |
|
758 { |
|
759 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
760 iMiddleFrameOuterRect, |
|
761 innerRect,//iMiddleFrameInnerRect, |
|
762 SemiButtonPressedID, |
|
763 SemiButtonPressedCenterID); |
|
764 } |
|
765 else |
|
766 { |
|
767 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
768 iMiddleFrameOuterRect, |
|
769 innerRect,//iMiddleFrameInnerRect, |
|
770 SemiButtonID, |
|
771 SemiButtonCenterID); |
|
772 } |
|
773 } |
|
774 |
|
775 TRect innerRect = iLeftFrameOuterRect; |
|
776 innerRect.Shrink(4, 4); |
|
777 |
|
778 if (button1 && button1->PressedDown()) |
|
779 { |
|
780 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
781 iLeftFrameOuterRect, |
|
782 innerRect,//iLeftFrameInnerRect, |
|
783 SemiButtonPressedID, |
|
784 SemiButtonPressedCenterID); |
|
785 } |
|
786 else |
|
787 { |
|
788 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
789 iLeftFrameOuterRect, |
|
790 innerRect,//iLeftFrameInnerRect, |
|
791 SemiButtonID, |
|
792 SemiButtonCenterID); |
|
793 } |
|
794 |
|
795 innerRect = iRightFrameOuterRect; |
|
796 innerRect.Shrink(4, 4); |
|
797 if (button2 && button2->PressedDown()) |
|
798 { |
|
799 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
800 iRightFrameOuterRect, |
|
801 innerRect,//iRightFrameInnerRect, |
|
802 SemiButtonPressedID, |
|
803 SemiButtonPressedCenterID); |
|
804 } |
|
805 else |
|
806 { |
|
807 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
808 iRightFrameOuterRect, |
|
809 innerRect,//iRightFrameInnerRect, |
|
810 SemiButtonID, |
|
811 SemiButtonCenterID); |
|
812 } |
742 } |
813 } |
743 |
|
744 public: |
814 public: |
745 |
815 |
746 CEikCba& iOwner; |
816 CEikCba& iOwner; |
747 CRepository* iRepository; |
817 CRepository* iRepository; |
748 CCenRepNotifyHandler* iCRListener; |
818 CCenRepNotifyHandler* iCRListener; |
1331 if (aResourceId != KNoResource) |
1390 if (aResourceId != KNoResource) |
1332 { |
1391 { |
1333 TResourceReader reader; |
1392 TResourceReader reader; |
1334 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
1393 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
1335 iCbaFlags = reader.ReadInt32(); // flags resource |
1394 iCbaFlags = reader.ReadInt32(); // flags resource |
|
1395 |
|
1396 const TUid KActiveIdle2Uid = {0x102750F0}; |
|
1397 CEikApplication* app = CEikonEnv::Static()->EikAppUi()->Application(); |
|
1398 if ( app && app->AppDllUid() == KActiveIdle2Uid ) |
|
1399 { |
|
1400 //it's intereting that the transparent can't not be set after the CBA was created for a while. |
|
1401 //it just can be done in the CBA constructor, maybe some defect in Window server, but I'm not sure |
|
1402 //about that, in order to fix the defect I have hardcode the transparent flag for homescreen the only usercase. |
|
1403 //it should be fixed later. |
|
1404 iCbaFlags |= EEikCbaFlagSemiTransparent; |
|
1405 } |
1336 |
1406 |
1337 // If using enhanced cba. |
1407 // If using enhanced cba. |
1338 if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) |
1408 if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) |
1339 { |
1409 { |
1340 #ifdef RD_ENHANCED_CBA |
1410 #ifdef RD_ENHANCED_CBA |
2771 // |
2841 // |
2772 // NOTE: MSK is not supported in landscape. |
2842 // NOTE: MSK is not supported in landscape. |
2773 // |
2843 // |
2774 if ( statusPane && |
2844 if ( statusPane && |
2775 statusPane->IsVisible() && |
2845 statusPane->IsVisible() && |
2776 AknStatuspaneUtils::ExtendedFlatLayoutActive() && |
2846 AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
2777 ( iBgIID == KAknsIIDQsnBgAreaControl || |
2847 { |
2778 iBgIID == KAknsIIDQsnBgAreaControlIdle || |
|
2779 iBgIID == KAknsIIDQsnBgAreaControlMp || |
|
2780 ( iBgIID == KAknsIIDWallpaper && |
|
2781 AknStatuspaneUtils::IdleLayoutActive() ) ) ) |
|
2782 { |
|
2783 TRect digitalClockRect( 0,0,0,0 ); |
|
2784 TRect indicatorRect( 0,0,0,0 ); |
|
2785 |
|
2786 if ( iBgIID == KAknsIIDQsnBgAreaControlMp ) |
2848 if ( iBgIID == KAknsIIDQsnBgAreaControlMp ) |
2787 { |
2849 { |
2788 if ( !iIsClockIndicBgIIDSet ) |
2850 if ( !iIsClockIndicBgIIDSet ) |
2789 { |
2851 { |
2790 statusPane->SetCbaAreaBackgroundID( |
2852 statusPane->SetCbaAreaBackgroundID( |
2801 iBgIID, |
2863 iBgIID, |
2802 CEikStatusPaneBase::EDrawDeferred ); |
2864 CEikStatusPaneBase::EDrawDeferred ); |
2803 } |
2865 } |
2804 } |
2866 } |
2805 |
2867 |
2806 TRAPD( err1, |
2868 if ( statusPane->PaneCapabilities( |
2807 indicatorRect = statusPane->PaneRectL( TUid::Uid( |
2869 TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() ) |
2808 EEikStatusPaneUidIndic ) ) ); |
2870 { |
2809 |
2871 TRect combinedPaneRect( 0, 0, 0, 0 ); |
2810 TRAPD( err2, |
2872 TRAPD( err, |
2811 digitalClockRect = statusPane->PaneRectL( TUid::Uid( |
2873 combinedPaneRect = |
2812 EEikStatusPaneUidDigitalClock ) ) ); |
2874 statusPane->PaneRectL( TUid::Uid( |
2813 |
2875 EEikStatusPaneUidCombined ) ) ); |
2814 if ( !err1 && !err2 ) |
2876 |
2815 { |
2877 if ( !err ) |
2816 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
|
2817 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
|
2818 |
|
2819 if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) ) |
|
2820 { |
2878 { |
2821 indicatorRect.Move( |
2879 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
2822 -cbaPositionRelativeToScreen.iX, |
2880 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
2823 -cbaPositionRelativeToScreen.iY ); |
2881 |
2824 |
2882 if ( cbaRectRelativeToScreen.Intersects( combinedPaneRect ) ) |
2825 region.SubRect( indicatorRect ); |
2883 { |
|
2884 combinedPaneRect.Move( |
|
2885 -cbaPositionRelativeToScreen.iX, |
|
2886 -cbaPositionRelativeToScreen.iY ); |
|
2887 |
|
2888 region.SubRect( combinedPaneRect ); |
|
2889 } |
2826 } |
2890 } |
|
2891 } |
|
2892 else |
|
2893 { |
|
2894 TRect digitalClockRect( 0, 0, 0, 0 ); |
|
2895 TRect indicatorRect( 0, 0, 0, 0 ); |
|
2896 |
|
2897 TRAPD( err1, |
|
2898 indicatorRect = statusPane->PaneRectL( TUid::Uid( |
|
2899 EEikStatusPaneUidIndic ) ) ); |
|
2900 |
|
2901 TRAPD( err2, |
|
2902 digitalClockRect = statusPane->PaneRectL( TUid::Uid( |
|
2903 EEikStatusPaneUidDigitalClock ) ) ); |
2827 |
2904 |
2828 if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) ) |
2905 if ( !err1 && !err2 ) |
2829 { |
2906 { |
2830 digitalClockRect.Move( |
2907 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
2831 -cbaPositionRelativeToScreen.iX, |
2908 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
2832 -cbaPositionRelativeToScreen.iY ); |
2909 |
2833 |
2910 if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) ) |
2834 region.SubRect( digitalClockRect ); |
2911 { |
|
2912 indicatorRect.Move( |
|
2913 -cbaPositionRelativeToScreen.iX, |
|
2914 -cbaPositionRelativeToScreen.iY ); |
|
2915 |
|
2916 region.SubRect( indicatorRect ); |
|
2917 } |
|
2918 |
|
2919 if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) ) |
|
2920 { |
|
2921 digitalClockRect.Move( |
|
2922 -cbaPositionRelativeToScreen.iX, |
|
2923 -cbaPositionRelativeToScreen.iY ); |
|
2924 |
|
2925 region.SubRect( digitalClockRect ); |
|
2926 } |
2835 } |
2927 } |
2836 } |
2928 } |
2837 } |
2929 } |
2838 |
2930 |
2839 if ( !region.CheckError() ) |
2931 if ( !region.CheckError() ) |
3283 (aKeyEvent.iModifiers & EModifierCtrl) || |
3359 (aKeyEvent.iModifiers & EModifierCtrl) || |
3284 (aKeyEvent.iModifiers & EModifierRightCtrl); |
3360 (aKeyEvent.iModifiers & EModifierRightCtrl); |
3285 |
3361 |
3286 TKeyResponse response(EKeyWasNotConsumed); |
3362 TKeyResponse response(EKeyWasNotConsumed); |
3287 |
3363 |
|
3364 CEikCbaButton* button1 = |
|
3365 static_cast<CEikCbaButton*>( |
|
3366 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
|
3367 CEikCbaButton* button2 = |
|
3368 static_cast<CEikCbaButton*>( |
|
3369 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
|
3370 CEikCbaButton* buttonMSK = NULL; |
|
3371 if ( iMSKset && AknLayoutUtils::MSKEnabled() ) |
|
3372 { |
|
3373 buttonMSK = |
|
3374 static_cast<CEikCbaButton*>( |
|
3375 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
|
3376 } |
|
3377 |
3288 // AknLaf - changed to use keys defined in AknKeys.h. |
3378 // AknLaf - changed to use keys defined in AknKeys.h. |
3289 // Left soft key will be returned also when MSK is enabled but not defined. |
3379 // Left soft key will be returned also when MSK is enabled but not defined. |
3290 if (aKeyEvent.iCode == EKeyCBA1) |
3380 if (aKeyEvent.iCode == EKeyCBA1) |
3291 { |
3381 { |
3292 if (KControlArrayCBAButton1Posn < iControlArray->Count()) |
3382 if (KControlArrayCBAButton1Posn < iControlArray->Count()) |
3293 { |
3383 { |
|
3384 if( button1->IsDimmed() ) |
|
3385 { |
|
3386 return EKeyWasConsumed; |
|
3387 } |
3294 // Return immediately if the button is invisible |
3388 // Return immediately if the button is invisible |
3295 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3389 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3296 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3390 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3297 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3391 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3298 { |
3392 { |
3320 } |
3414 } |
3321 else if (aKeyEvent.iCode == EKeyCBA2) |
3415 else if (aKeyEvent.iCode == EKeyCBA2) |
3322 { |
3416 { |
3323 if (KControlArrayCBAButton2Posn < iControlArray->Count()) |
3417 if (KControlArrayCBAButton2Posn < iControlArray->Count()) |
3324 { |
3418 { |
|
3419 if( button2->IsDimmed() ) |
|
3420 { |
|
3421 return EKeyWasConsumed; |
|
3422 } |
3325 // Return immediately if the button is invisible. |
3423 // Return immediately if the button is invisible. |
3326 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl && |
3424 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl && |
3327 !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && |
3425 !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && |
3328 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3426 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3329 { |
3427 { |
3363 && AknLayoutUtils::MSKEnabled() |
3461 && AknLayoutUtils::MSKEnabled() |
3364 && iMSKset |
3462 && iMSKset |
3365 && aKeyEvent.iCode == EKeyOK |
3463 && aKeyEvent.iCode == EKeyOK |
3366 && !Window().IsFaded() ) |
3464 && !Window().IsFaded() ) |
3367 { |
3465 { |
|
3466 if( buttonMSK->IsDimmed() ) |
|
3467 { |
|
3468 return EKeyWasConsumed; |
|
3469 } |
3368 if (KControlArrayCBAButtonMSKPosn < iControlArray->Count()) |
3470 if (KControlArrayCBAButtonMSKPosn < iControlArray->Count()) |
3369 { |
3471 { |
3370 // Return immediately if the button is invisible. |
3472 // Return immediately if the button is invisible. |
3371 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3473 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3372 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
3474 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
4197 // Embedded CBA doesn't draw anything |
4314 // Embedded CBA doesn't draw anything |
4198 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4315 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4199 { |
4316 { |
4200 return; |
4317 return; |
4201 } |
4318 } |
|
4319 |
|
4320 if ( iCbaFlags & EEikCbaFlagSemiTransparent ) |
|
4321 { |
|
4322 CWindowGc &gc = SystemGc(); |
|
4323 |
|
4324 iExtension->DrawSemiTransparencyL( gc, Rect() ); |
|
4325 return; |
|
4326 } |
4202 |
4327 |
4203 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4328 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4204 |
4329 |
4205 const TRect rect( Rect() ); |
4330 const TRect rect( Rect() ); |
4206 CWindowGc& gc = SystemGc(); |
4331 CWindowGc& gc = SystemGc(); |
4207 |
|
4208 TRgb rgb( TRgb::Color16MA( 0 ) ); |
|
4209 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
4210 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
4211 gc.SetBrushColor( rgb ); |
|
4212 gc.Clear(); |
|
4213 |
|
4214 MAknsControlContext* cc = iMLBgContext; |
4332 MAknsControlContext* cc = iMLBgContext; |
4215 |
4333 |
4216 if ( iFlags.IsSet( ECbaEmbedded ) ) |
4334 if ( iFlags.IsSet( ECbaEmbedded ) ) |
4217 { |
4335 { |
4218 // Embedded CBA is drawn inside dialog |
4336 // Embedded CBA is drawn inside dialog |