66 /** Default timeout for status pane blanker. */ |
66 /** Default timeout for status pane blanker. */ |
67 const TInt KDefaultUnblankTimeout = 100000; // 0.1 s |
67 const TInt KDefaultUnblankTimeout = 100000; // 0.1 s |
68 |
68 |
69 /** This flag is used to turn redraw storing on/off in status pane. */ |
69 /** This flag is used to turn redraw storing on/off in status pane. */ |
70 const TInt KEnableRedrawStoring = ETrue; |
70 const TInt KEnableRedrawStoring = ETrue; |
71 |
|
72 const TUid KActiveIdle2Uid = {0x102750F0}; |
|
73 |
71 |
74 inline void CEikStatusPaneBase::TPaneCapabilities::SetPresent() |
72 inline void CEikStatusPaneBase::TPaneCapabilities::SetPresent() |
75 { |
73 { |
76 iFlags |= KStatusPaneCapsPresentBit; |
74 iFlags |= KStatusPaneCapsPresentBit; |
77 } |
75 } |
1176 * if the @c aParentWindowGroup is not |
1174 * if the @c aParentWindowGroup is not |
1177 * @c NULL. |
1175 * @c NULL. |
1178 * @param aRedrawStoreHandler Pointer to the redraw store handler should |
1176 * @param aRedrawStoreHandler Pointer to the redraw store handler should |
1179 * be also passed if @c aParentWindowGroup |
1177 * be also passed if @c aParentWindowGroup |
1180 * is specified. |
1178 * is specified. |
|
1179 * @param aTransparent Whether or not the control is transparent. |
1181 */ |
1180 */ |
1182 void SetParentWindowL( RWindowGroup* aParentWindowGroup, |
1181 void SetParentWindowL( RWindowGroup* aParentWindowGroup, |
1183 CCoeControl* aParentControl, |
1182 CCoeControl* aParentControl, |
1184 CRedrawStoreHandler* aRedrawStoreHandler ); |
1183 CRedrawStoreHandler* aRedrawStoreHandler, |
|
1184 TBool aTransparent ); |
1185 |
1185 |
1186 /** |
1186 /** |
1187 * Sets the background drawer for the container control. |
1187 * Sets the container control transparency. |
|
1188 * The background drawer is used if transparency is not enabled. |
1188 * |
1189 * |
1189 * @param aBackground The background drawer. |
1190 * @param aBackground The background drawer. |
1190 */ |
1191 */ |
1191 void SetBackgroundDrawer( MCoeControlBackground* aBackground ); |
1192 void SetTransparency( TBool aTransparent, |
1192 |
1193 MCoeControlBackground* aBackground ); |
1193 /** |
|
1194 * Checks if the status pane container is in the idle (Home Screen) |
|
1195 * application. This check in required in some places since Home |
|
1196 * Screen draws the status pane background itself. |
|
1197 * |
|
1198 * @return @c ETrue if in idle application, @c EFalse otherwise. |
|
1199 */ |
|
1200 TBool InIdleApplication(); |
|
1201 |
1194 |
1202 public: // From base class @c CCoeControl. |
1195 public: // From base class @c CCoeControl. |
1203 |
1196 |
1204 /** |
1197 /** |
1205 * Sets the dimming status. |
1198 * Sets the dimming status. |
1392 CRedrawStoreHandler& aRedrawStoreHandler ) |
1385 CRedrawStoreHandler& aRedrawStoreHandler ) |
1393 { |
1386 { |
1394 SetMopParent( iEikonEnv->EikAppUi() ); |
1387 SetMopParent( iEikonEnv->EikAppUi() ); |
1395 |
1388 |
1396 CreateWindowL( aParent ); |
1389 CreateWindowL( aParent ); |
1397 |
|
1398 // This is added for homescreen transparency support. |
|
1399 if ( InIdleApplication() ) |
|
1400 { |
|
1401 if( KErrNone == Window().SetTransparencyAlphaChannel()) |
|
1402 Window().SetBackgroundColor(~0); |
|
1403 } |
|
1404 else |
|
1405 { |
|
1406 Window().SetBackgroundColor( |
|
1407 iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) ); |
|
1408 } |
|
1409 |
1390 |
1410 // This helps for unsyncronized undimming problems. |
1391 // This helps for unsyncronized undimming problems. |
1411 aRedrawStoreHandler.SetStore( &Window(), KEnableRedrawStoring ); |
1392 aRedrawStoreHandler.SetStore( &Window(), KEnableRedrawStoring ); |
1412 |
1393 |
1413 iBgContext1 = aBgContext1; |
1394 iBgContext1 = aBgContext1; |
2620 // --------------------------------------------------------------------------- |
2601 // --------------------------------------------------------------------------- |
2621 // |
2602 // |
2622 void CEikStatusPaneContainer::SetParentWindowL( |
2603 void CEikStatusPaneContainer::SetParentWindowL( |
2623 RWindowGroup* aParentWindowGroup, |
2604 RWindowGroup* aParentWindowGroup, |
2624 CCoeControl* aParentControl, |
2605 CCoeControl* aParentControl, |
2625 CRedrawStoreHandler* aRedrawStoreHandler ) |
2606 CRedrawStoreHandler* aRedrawStoreHandler, |
|
2607 TBool aTransparent ) |
2626 { |
2608 { |
2627 if ( aParentWindowGroup ) |
2609 if ( aParentWindowGroup ) |
2628 { |
2610 { |
2629 MakeVisible( EFalse ); |
2611 MakeVisible( EFalse ); |
2630 |
2612 |
2636 CloseWindow(); |
2618 CloseWindow(); |
2637 } |
2619 } |
2638 |
2620 |
2639 CreateWindowL( aParentWindowGroup ); |
2621 CreateWindowL( aParentWindowGroup ); |
2640 |
2622 |
2641 // Enable the transparency only in HomeScreen where it's needed |
|
2642 // for performance reasons. |
|
2643 if ( InIdleApplication() ) |
|
2644 { |
|
2645 EnableWindowTransparency(); |
|
2646 } |
|
2647 else |
|
2648 { |
|
2649 Window().SetBackgroundColor( |
|
2650 iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) ); |
|
2651 } |
|
2652 |
|
2653 RWindow& window = Window(); |
2623 RWindow& window = Window(); |
2654 if ( aRedrawStoreHandler ) |
2624 if ( aRedrawStoreHandler ) |
2655 { |
2625 { |
2656 aRedrawStoreHandler->SetStore( &window, KEnableRedrawStoring ); |
2626 aRedrawStoreHandler->SetStore( &window, KEnableRedrawStoring ); |
|
2627 } |
|
2628 |
|
2629 // Enable the transparency only in HomeScreen where it's needed |
|
2630 // for performance reasons. |
|
2631 if ( aTransparent && window.SetTransparencyAlphaChannel() == KErrNone ) |
|
2632 { |
|
2633 window.SetBackgroundColor( ~0 ); |
|
2634 } |
|
2635 else |
|
2636 { |
|
2637 window.SetBackgroundColor( |
|
2638 iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) ); |
2657 } |
2639 } |
2658 |
2640 |
2659 window.SetPointerGrab( ETrue ); |
2641 window.SetPointerGrab( ETrue ); |
2660 window.SetShadowDisabled( ETrue ); |
2642 window.SetShadowDisabled( ETrue ); |
2661 window.SetNonFading( !LafStatusPaneContainer::AllowFading() ); |
2643 window.SetNonFading( !LafStatusPaneContainer::AllowFading() ); |
2671 } |
2653 } |
2672 } |
2654 } |
2673 |
2655 |
2674 |
2656 |
2675 // --------------------------------------------------------------------------- |
2657 // --------------------------------------------------------------------------- |
2676 // Sets the background drawer for the container control. |
2658 // Sets the container control transparency. |
2677 // --------------------------------------------------------------------------- |
2659 // --------------------------------------------------------------------------- |
2678 // |
2660 // |
2679 void CEikStatusPaneContainer::SetBackgroundDrawer( |
2661 void CEikStatusPaneContainer::SetTransparency( |
|
2662 TBool aTransparent, |
2680 MCoeControlBackground* aBackground ) |
2663 MCoeControlBackground* aBackground ) |
2681 { |
2664 { |
2682 if ( aBackground && InIdleApplication() ) |
2665 RWindow& window = Window(); |
|
2666 |
|
2667 if ( aTransparent ) |
2683 { |
2668 { |
2684 // In Home Screen the application draws also the status |
2669 if ( window.SetTransparencyAlphaChannel() == KErrNone ) |
2685 // pane background. |
2670 { |
2686 aBackground = NULL; |
2671 window.SetBackgroundColor( ~0 ); |
|
2672 } |
|
2673 } |
|
2674 else |
|
2675 { |
|
2676 window.SetBackgroundColor( |
|
2677 iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) ); |
2687 } |
2678 } |
2688 |
2679 |
2689 SetBackground( aBackground ); |
2680 // Skin background is not drawn for the subpane if it's transparent |
2690 } |
2681 // OR if it's a child of another subpane. |
2691 |
2682 TBool drawBackground( Parent() ? NULL : !aTransparent ); |
2692 |
2683 SetBackground( drawBackground ? aBackground : NULL ); |
2693 // --------------------------------------------------------------------------- |
|
2694 // Checks if the status pane container is in the Home Screen application. |
|
2695 // --------------------------------------------------------------------------- |
|
2696 // |
|
2697 TBool CEikStatusPaneContainer::InIdleApplication() |
|
2698 { |
|
2699 TBool retVal( EFalse ); |
|
2700 |
|
2701 CEikApplication* app = iEikonEnv->EikAppUi()->Application(); |
|
2702 if ( app && app->AppDllUid() == KActiveIdle2Uid ) |
|
2703 { |
|
2704 retVal = ETrue; |
|
2705 } |
|
2706 |
|
2707 return retVal; |
|
2708 } |
2684 } |
2709 |
2685 |
2710 |
2686 |
2711 // --------------------------------------------------------------------------- |
2687 // --------------------------------------------------------------------------- |
2712 // CEikStatusPaneContainer::Draw |
2688 // CEikStatusPaneContainer::Draw |
3402 static_cast<CAknsMaskedLayerBackgroundControlContext*>( |
3378 static_cast<CAknsMaskedLayerBackgroundControlContext*>( |
3403 iExtension->iCommonBgContext->GetControlContext( 1 ) ), |
3379 iExtension->iCommonBgContext->GetControlContext( 1 ) ), |
3404 iExtension->iDataSubscriber, |
3380 iExtension->iDataSubscriber, |
3405 *iExtension->iRedrawStoreHandler ); |
3381 *iExtension->iRedrawStoreHandler ); |
3406 |
3382 |
3407 cont->SetBackgroundDrawer( iExtension ); |
3383 cont->SetBackground( iExtension ); |
3408 |
3384 |
3409 CleanupStack::PushL( cont ); |
3385 CleanupStack::PushL( cont ); |
3410 iControls->AppendL( cont ); |
3386 iControls->AppendL( cont ); |
3411 CleanupStack::Pop( cont ); |
3387 CleanupStack::Pop( cont ); |
3412 } |
3388 } |
3801 CEikStatusPaneContainer* combinedPane = |
3777 CEikStatusPaneContainer* combinedPane = |
3802 Find( TUid::Uid( EEikStatusPaneUidCombined ) ); |
3778 Find( TUid::Uid( EEikStatusPaneUidCombined ) ); |
3803 if ( combinedPane ) |
3779 if ( combinedPane ) |
3804 { |
3780 { |
3805 CCoeControl* combinedPaneControl = combinedPane->Control(); |
3781 CCoeControl* combinedPaneControl = combinedPane->Control(); |
3806 |
3782 |
|
3783 TBool transparencyEnabled( IsTransparent() ); |
|
3784 |
3807 // The subpane container controls inside combined pane are it's |
3785 // The subpane container controls inside combined pane are it's |
3808 // component controls. |
3786 // component controls. |
3809 TInt count( combinedPaneControl->CountComponentControls() ); |
3787 TInt count( combinedPaneControl->CountComponentControls() ); |
3810 |
3788 |
3811 for ( TInt i = 0; i < count; ++i ) |
3789 for ( TInt i = 0; i < count; ++i ) |
3817 { |
3795 { |
3818 if ( aVisible ) |
3796 if ( aVisible ) |
3819 { |
3797 { |
3820 subPane->SetParentWindowL( NULL, |
3798 subPane->SetParentWindowL( NULL, |
3821 combinedPaneControl, |
3799 combinedPaneControl, |
3822 NULL ); |
3800 NULL, |
|
3801 transparencyEnabled ); |
3823 // Background is drawn by the combined pane so remove |
3802 // Background is drawn by the combined pane so remove |
3824 // the subpane's own background drawer. |
3803 // the subpane's own background drawer. |
3825 subPane->SetBackgroundDrawer( NULL ); |
3804 subPane->SetBackground( NULL ); |
3826 } |
3805 } |
3827 else |
3806 else |
3828 { |
3807 { |
3829 subPane->SetParentWindowL( |
3808 subPane->SetParentWindowL( |
3830 iParentWindowGroup, |
3809 iParentWindowGroup, |
3831 NULL, |
3810 NULL, |
3832 iExtension ? iExtension->iRedrawStoreHandler : NULL ); |
3811 iExtension ? iExtension->iRedrawStoreHandler : NULL, |
3833 subPane->SetBackgroundDrawer( iExtension ); |
3812 transparencyEnabled ); |
|
3813 |
|
3814 subPane->SetBackground( transparencyEnabled ? NULL : |
|
3815 iExtension ); |
3834 } |
3816 } |
3835 } |
3817 } |
3836 } |
3818 } |
3837 } |
3819 } |
3838 } |
3820 } |
3930 MakeVisible( aFlags & KEikStatusPaneBaseVisibleBit ); |
3912 MakeVisible( aFlags & KEikStatusPaneBaseVisibleBit ); |
3931 SetDimmed( aFlags & KEikStatusPaneBaseDimmedBit ); |
3913 SetDimmed( aFlags & KEikStatusPaneBaseDimmedBit ); |
3932 EnableTransparent( aFlags & KStatusPaneTransparentBit ); |
3914 EnableTransparent( aFlags & KStatusPaneTransparentBit ); |
3933 } |
3915 } |
3934 |
3916 |
|
3917 // --------------------------------------------------------------------------- |
|
3918 // CEikStatusPaneBase::EnableTransparent |
|
3919 // Enables transparency in the status pane. |
|
3920 // --------------------------------------------------------------------------- |
|
3921 // |
3935 EXPORT_C void CEikStatusPaneBase::EnableTransparent( TBool aTransparent ) |
3922 EXPORT_C void CEikStatusPaneBase::EnableTransparent( TBool aTransparent ) |
3936 { |
3923 { |
3937 if ( COMPARE_BOOLS( aTransparent, IsTransparent() ) ) |
3924 if ( COMPARE_BOOLS( aTransparent, IsTransparent() ) ) |
3938 { |
3925 { |
3939 return; |
3926 return; |
3940 } |
3927 } |
3941 if( aTransparent ) |
3928 |
|
3929 if ( aTransparent ) |
3942 { |
3930 { |
3943 iFlags |= KStatusPaneTransparentBit; |
3931 iFlags |= KStatusPaneTransparentBit; |
3944 } |
3932 } |
3945 else |
3933 else |
3946 { |
3934 { |
3947 iFlags &= ~KStatusPaneTransparentBit; |
3935 iFlags &= ~KStatusPaneTransparentBit; |
3948 } |
3936 } |
|
3937 |
|
3938 // Change the subpane window background colour and background drawer |
|
3939 // based on the transparency. |
|
3940 const TInt count = iControls->Count(); |
|
3941 for ( TInt ii = 0; ii < count; ++ii ) |
|
3942 { |
|
3943 iControls->At( ii )->SetTransparency( aTransparent, iExtension ); |
|
3944 } |
|
3945 |
3949 DoDrawNow( EDrawDeferred ); |
3946 DoDrawNow( EDrawDeferred ); |
3950 |
3947 } |
3951 } |
3948 |
3952 |
3949 |
|
3950 // --------------------------------------------------------------------------- |
|
3951 // CEikStatusPaneBase::IsTransparent |
|
3952 // Checks if the status pane has transparency enabled. |
|
3953 // --------------------------------------------------------------------------- |
|
3954 // |
3953 EXPORT_C TBool CEikStatusPaneBase::IsTransparent() const |
3955 EXPORT_C TBool CEikStatusPaneBase::IsTransparent() const |
3954 { |
3956 { |
3955 return iFlags & KStatusPaneTransparentBit; |
3957 return iFlags & KStatusPaneTransparentBit; |
3956 } |
3958 } |
|
3959 |
|
3960 |
3957 // --------------------------------------------------------------------------- |
3961 // --------------------------------------------------------------------------- |
3958 // CEikStatusPaneBase::Flags |
3962 // CEikStatusPaneBase::Flags |
3959 // Returns the status pane flags. |
3963 // Returns the status pane flags. |
3960 // --------------------------------------------------------------------------- |
3964 // --------------------------------------------------------------------------- |
3961 // |
3965 // |