uifw/EikStd/coctlsrc/eikcba.cpp
branchRCL_3
changeset 64 85902f042028
parent 56 d48ab3b357f1
child 72 a5e7a4f63858
equal deleted inserted replaced
59:978afdc0236f 64:85902f042028
   130             // MSK is not enabled in the layout metadata, but for
   130             // MSK is not enabled in the layout metadata, but for
   131             // these status pane layouts an exception is made.
   131             // these status pane layouts an exception is made.
   132             result = ETrue;
   132             result = ETrue;
   133             }
   133             }
   134         }
   134         }
   135     
   135     _AKNTRACE( "IsMskEnabledLayoutActive is %d", result );
   136     _AKNTRACE_FUNC_EXIT;
   136     _AKNTRACE_FUNC_EXIT;
   137     return result;
   137     return result;
   138     }
   138     }
   139 
   139 
   140 
   140 
   782      * 
   782      * 
   783      * @return ETrue if observer is active.
   783      * @return ETrue if observer is active.
   784      */
   784      */
   785     TBool Active() const
   785     TBool Active() const
   786         {
   786         {
   787         _AKNTRACE_FUNC_ENTER;
   787     	TBool ret;
   788         _AKNTRACE_FUNC_EXIT;
   788     	ret = iOwner.IsVisible() && !iOwner.IsEmpty();
   789         return iOwner.IsVisible() && !iOwner.IsEmpty();
   789     	_AKNTRACE( "Active is %d", ret );
       
   790         return ret;
   790         }
   791         }
   791     
   792     
   792     /*
   793     /*
   793      * Using the special theme Id draw background
   794      * Using the special theme Id draw background
   794      */
   795      */
  2954             
  2955             
  2955         // SetBoundingRect is always called by status pane when it is changing visibility.
  2956         // SetBoundingRect is always called by status pane when it is changing visibility.
  2956         // If the status pane is invisible in landscape, softkey need to draw frame to cover
  2957         // If the status pane is invisible in landscape, softkey need to draw frame to cover
  2957         // the area of combine pane.
  2958         // the area of combine pane.
  2958         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  2959         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  2959         if (statusPane && !statusPane->IsVisible() && isLandscapeOrient &&
  2960         if ( ( iCbaFlags & EEikCbaFlagAppMskIcon ) || ( statusPane && !statusPane->IsVisible() && isLandscapeOrient &&
  2960             statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidCombined)).IsInCurrentLayout())
  2961             statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidCombined)).IsInCurrentLayout()))
  2961             {
  2962             {
  2962             iFlags.Set( ECbaCombinePaneUncovered );
  2963             iFlags.Set( ECbaCombinePaneUncovered );
  2963             }
  2964             }
  2964         else
  2965         else
  2965             {
  2966             {
  2981         region.AddRect( Rect() );
  2982         region.AddRect( Rect() );
  2982         
  2983         
  2983         // If status indicators and clock are shown in control pane area,
  2984         // If status indicators and clock are shown in control pane area,
  2984         // then remove those areas from cba window region.
  2985         // then remove those areas from cba window region.
  2985         // 
  2986         // 
  2986         // NOTE: MSK is not supported in landscape.
       
  2987         //
  2987         //
  2988         if ( statusPane &&
  2988         // NOTE: MSK is not supported in landscape except the flag EEikCbaFlagAppMskIcon is defined .
       
  2989         //
       
  2990 
       
  2991         if ( !(iCbaFlags & EEikCbaFlagAppMskIcon ) )
       
  2992         	{
       
  2993             if( statusPane &&
  2989              statusPane->IsVisible() &&
  2994              statusPane->IsVisible() &&
  2990              AknStatuspaneUtils::ExtendedFlatLayoutActive() )
  2995              AknStatuspaneUtils::ExtendedFlatLayoutActive() )
  2991             { 
  2996                 { 
  2992             if ( iBgIID == KAknsIIDQsnBgAreaControlMp )
  2997                 if ( iBgIID == KAknsIIDQsnBgAreaControlMp )
  2993                 {
       
  2994                 if ( !iIsClockIndicBgIIDSet )
       
  2995                     {
  2998                     {
  2996                     statusPane->SetCbaAreaBackgroundID(
  2999                     if ( !iIsClockIndicBgIIDSet )
  2997                         iBgIID,
       
  2998                         CEikStatusPaneBase::EDrawDeferred );
       
  2999                     iIsClockIndicBgIIDSet = ETrue;
       
  3000                     }
       
  3001                 }
       
  3002             else
       
  3003                 {
       
  3004                 if ( statusPane->CbaAreaBackgroundID() != iBgIID )
       
  3005                     {
       
  3006                     statusPane->SetCbaAreaBackgroundID(
       
  3007                         iBgIID,
       
  3008                         CEikStatusPaneBase::EDrawDeferred );
       
  3009                     }
       
  3010                 }
       
  3011 
       
  3012             if ( statusPane->PaneCapabilities(
       
  3013                      TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() )
       
  3014                 {
       
  3015                 TRect combinedPaneRect( 0, 0, 0, 0 );
       
  3016                 TRAPD( err,
       
  3017                        combinedPaneRect =
       
  3018                            statusPane->PaneRectL( TUid::Uid( 
       
  3019                                EEikStatusPaneUidCombined ) ) );
       
  3020                 
       
  3021                 if ( !err )
       
  3022                     {
       
  3023                     TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
       
  3024                     TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
       
  3025                     
       
  3026                     if ( cbaRectRelativeToScreen.Intersects( combinedPaneRect ) )
       
  3027                         {
  3000                         {
  3028                         combinedPaneRect.Move(
  3001                         statusPane->SetCbaAreaBackgroundID(
  3029                             -cbaPositionRelativeToScreen.iX,
  3002                             iBgIID,
  3030                             -cbaPositionRelativeToScreen.iY );
  3003                             CEikStatusPaneBase::EDrawDeferred );
  3031                             
  3004                         iIsClockIndicBgIIDSet = ETrue;
  3032                         region.SubRect( combinedPaneRect );                              
       
  3033                         }
  3005                         }
  3034                     }
  3006                     }
  3035                 }
  3007                 else
  3036             else
  3008                     {
  3037                 {
  3009                     if ( statusPane->CbaAreaBackgroundID() != iBgIID )
  3038                 TRect digitalClockRect( 0, 0, 0, 0 );
  3010                         {
  3039                 TRect indicatorRect( 0, 0, 0, 0 );
  3011                         statusPane->SetCbaAreaBackgroundID(
  3040 
  3012                             iBgIID,
  3041                 TRAPD( err1,
  3013                             CEikStatusPaneBase::EDrawDeferred );
  3042                        indicatorRect = statusPane->PaneRectL( TUid::Uid( 
  3014                         }
  3043                            EEikStatusPaneUidIndic ) ) );
  3015                     }
       
  3016 
       
  3017                 if ( statusPane->PaneCapabilities(
       
  3018                          TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() )
       
  3019                     {
       
  3020                     TRect combinedPaneRect( 0, 0, 0, 0 );
       
  3021                     TRAPD( err,
       
  3022                            combinedPaneRect =
       
  3023                                statusPane->PaneRectL( TUid::Uid( 
       
  3024                                    EEikStatusPaneUidCombined ) ) );
       
  3025                 
       
  3026                     if ( !err )
       
  3027                         {
       
  3028                         TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
       
  3029                         TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
       
  3030                     
       
  3031                         if ( cbaRectRelativeToScreen.Intersects( combinedPaneRect ) )
       
  3032                             {
       
  3033                             combinedPaneRect.Move(
       
  3034                                 -cbaPositionRelativeToScreen.iX,
       
  3035                                 -cbaPositionRelativeToScreen.iY );
       
  3036                             
       
  3037                             region.SubRect( combinedPaneRect );                              
       
  3038                             }
       
  3039                         }
       
  3040                     }
       
  3041                 else
       
  3042                     {
       
  3043                     TRect digitalClockRect( 0, 0, 0, 0 );
       
  3044                     TRect indicatorRect( 0, 0, 0, 0 );
       
  3045 
       
  3046                     TRAPD( err1,
       
  3047                            indicatorRect = statusPane->PaneRectL( TUid::Uid( 
       
  3048                                EEikStatusPaneUidIndic ) ) );
  3044                                                
  3049                                                
  3045                 TRAPD( err2,
  3050                     TRAPD( err2,
  3046                        digitalClockRect = statusPane->PaneRectL( TUid::Uid( 
  3051                            digitalClockRect = statusPane->PaneRectL( TUid::Uid( 
  3047                            EEikStatusPaneUidDigitalClock ) ) );
  3052                                EEikStatusPaneUidDigitalClock ) ) );
  3048                 
  3053                 
  3049                 if ( !err1 && !err2 )
  3054                     if ( !err1 && !err2 )
  3050                     {
       
  3051                     TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
       
  3052                     TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
       
  3053 
       
  3054                     if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) )
       
  3055                         {
  3055                         {
  3056                         indicatorRect.Move(
  3056                         TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
  3057                             -cbaPositionRelativeToScreen.iX,
  3057                         TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
  3058                             -cbaPositionRelativeToScreen.iY );
  3058 
       
  3059                         if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) )
       
  3060                             {
       
  3061                             indicatorRect.Move(
       
  3062                                 -cbaPositionRelativeToScreen.iX,
       
  3063                                 -cbaPositionRelativeToScreen.iY );
  3059                             
  3064                             
  3060                         region.SubRect( indicatorRect );                              
  3065                             region.SubRect( indicatorRect );                              
  3061                         }
  3066                             }
  3062                     
  3067                     
  3063                     if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) )
  3068                         if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) )
  3064                         {
  3069                             {
  3065                         digitalClockRect.Move(
  3070                             digitalClockRect.Move(
  3066                             -cbaPositionRelativeToScreen.iX,
  3071                                 -cbaPositionRelativeToScreen.iX,
  3067                             -cbaPositionRelativeToScreen.iY );
  3072                                 -cbaPositionRelativeToScreen.iY );
  3068                             
  3073                             
  3069                         region.SubRect( digitalClockRect );       
  3074                             region.SubRect( digitalClockRect );       
       
  3075                             }
  3070                         }
  3076                         }
  3071                     }
  3077                     }
  3072                 }
  3078                 }
  3073             }
  3079             }
  3074 
  3080 
  3562         {
  3568         {
  3563         if (KControlArrayCBAButton1Posn < iControlArray->Count())
  3569         if (KControlArrayCBAButton1Posn < iControlArray->Count())
  3564             {
  3570             {
  3565             if( button1->IsDimmed() )
  3571             if( button1->IsDimmed() )
  3566                 {
  3572                 {
       
  3573                 _AKNTRACE_FUNC_EXIT;
  3567                 return EKeyWasConsumed;
  3574                 return EKeyWasConsumed;
  3568                 }
  3575                 }
  3569             // Return immediately if the button is invisible                        
  3576             // Return immediately if the button is invisible                        
  3570             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3577             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3571                  !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3578                  !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3599         {
  3606         {
  3600         if (KControlArrayCBAButton2Posn < iControlArray->Count())
  3607         if (KControlArrayCBAButton2Posn < iControlArray->Count())
  3601             {
  3608             {
  3602             if( button2->IsDimmed() )
  3609             if( button2->IsDimmed() )
  3603                 {
  3610                 {
       
  3611                 _AKNTRACE_FUNC_EXIT;
  3604                 return EKeyWasConsumed;
  3612                 return EKeyWasConsumed;
  3605                 }
  3613                 }
  3606             // Return immediately if the button is invisible.
  3614             // Return immediately if the button is invisible.
  3607             if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl &&
  3615             if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl &&
  3608                  !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && 
  3616                  !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && 
  3653                 && iMSKset
  3661                 && iMSKset
  3654                 && aKeyEvent.iCode == EKeyOK
  3662                 && aKeyEvent.iCode == EKeyOK
  3655                 && !Window().IsFaded() )
  3663                 && !Window().IsFaded() )
  3656         {
  3664         {
  3657         if( buttonMSK->IsDimmed() )
  3665         if( buttonMSK->IsDimmed() )
  3658             {
  3666             { 
       
  3667             _AKNTRACE_FUNC_EXIT;
  3659             return EKeyWasConsumed;
  3668             return EKeyWasConsumed;
  3660             }
  3669             }
  3661         if (KControlArrayCBAButtonMSKPosn < iControlArray->Count())
  3670         if (KControlArrayCBAButtonMSKPosn < iControlArray->Count())
  3662             {
  3671             {
  3663             // Return immediately if the button is invisible.
  3672             // Return immediately if the button is invisible.
  3881     if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty )
  3890     if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty )
  3882         {
  3891         {
  3883         if( button1->IsDimmed() )
  3892         if( button1->IsDimmed() )
  3884             {
  3893             {
  3885             CCoeControl::HandlePointerEventL( aPointerEvent );
  3894             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  3895             _AKNTRACE_FUNC_EXIT;
  3886             return;
  3896             return;
  3887             }
  3897             }
  3888         if ( button1->IsVisible() )
  3898         if ( button1->IsVisible() )
  3889             {
  3899             {
  3890             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3900             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3945     else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty )
  3955     else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty )
  3946         {              
  3956         {              
  3947         if( button2->IsDimmed() )
  3957         if( button2->IsDimmed() )
  3948             {
  3958             {
  3949             CCoeControl::HandlePointerEventL( aPointerEvent );
  3959             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  3960             _AKNTRACE_FUNC_EXIT;
  3950             return;
  3961             return;
  3951             }             
  3962             }             
  3952         if ( button2->IsVisible() )
  3963         if ( button2->IsVisible() )
  3953             {
  3964             {
  3954             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3965             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4011               buttonMSKRect.Contains( aPointerEvent.iPosition ) )
  4022               buttonMSKRect.Contains( aPointerEvent.iPosition ) )
  4012         {
  4023         {
  4013         if( buttonMSK->IsDimmed() )
  4024         if( buttonMSK->IsDimmed() )
  4014             {
  4025             {
  4015             CCoeControl::HandlePointerEventL( aPointerEvent );
  4026             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  4027             _AKNTRACE_FUNC_EXIT;
  4016             return;
  4028             return;
  4017             }
  4029             }
  4018         if  ( buttonMSK->IsVisible() )
  4030         if  ( buttonMSK->IsVisible() )
  4019             {
  4031             {
  4020             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4032             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4549     {
  4561     {
  4550     _AKNTRACE_FUNC_ENTER;
  4562     _AKNTRACE_FUNC_ENTER;
  4551     // Embedded CBA doesn't draw anything
  4563     // Embedded CBA doesn't draw anything
  4552     if ( iFlags.IsSet( ECbaInsideDialog ) )
  4564     if ( iFlags.IsSet( ECbaInsideDialog ) )
  4553         {
  4565         {
       
  4566         _AKNTRACE_FUNC_EXIT;
  4554         return;
  4567         return;
  4555         }
  4568         }
  4556     
  4569     
  4557     if ( iCbaFlags & EEikCbaFlagSemiTransparent )
  4570     if ( iCbaFlags & EEikCbaFlagSemiTransparent )
  4558         {
  4571         {
  4559         CWindowGc &gc = SystemGc();
  4572         CWindowGc &gc = SystemGc();
  4560 
  4573 
  4561         iExtension->DrawSemiTransparency( gc );
  4574         iExtension->DrawSemiTransparency( gc );
       
  4575         _AKNTRACE_FUNC_EXIT;
  4562         return;
  4576         return;
  4563         }
  4577         }
  4564 
  4578 
  4565     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  4579     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  4566     
  4580     
  5268     TRect rect( cbarect.Rect().Size() );
  5282     TRect rect( cbarect.Rect().Size() );
  5269 
  5283 
  5270     TRect posInScreen( cbarect.Rect() );
  5284     TRect posInScreen( cbarect.Rect() );
  5271     
  5285     
  5272     TBool mskEnabledInPlatform( iMSKEnabledInPlatform &&
  5286     TBool mskEnabledInPlatform( iMSKEnabledInPlatform &&
  5273                                 IsMskEnabledLayoutActive() );
  5287                                 ( IsMskEnabledLayoutActive() || ( iCbaFlags & EEikCbaFlagAppMskIcon ) ) );
  5274 
  5288 
  5275     TBool mskEnabledInApplication( AknLayoutUtils::MSKEnabled() && iMSKset );
  5289     TBool mskEnabledInApplication( AknLayoutUtils::MSKEnabled() && iMSKset );
  5276     
  5290     
  5277     // Set the softkey frame rectangles in touch layouts.
  5291     // Set the softkey frame rectangles in touch layouts.
  5278     if ( iExtension && AknLayoutUtils::PenEnabled() )
  5292     if ( iExtension && AknLayoutUtils::PenEnabled() )
  7734 // when on layout changes etc.
  7748 // when on layout changes etc.
  7735 // ---------------------------------------------------------------------------
  7749 // ---------------------------------------------------------------------------
  7736 //     
  7750 //     
  7737 TBool CEikCba::MskAllowed() const
  7751 TBool CEikCba::MskAllowed() const
  7738     {
  7752     {
  7739     _AKNTRACE_FUNC_ENTER;
  7753 	_AKNTRACE_FUNC_ENTER;
  7740     _AKNTRACE_FUNC_EXIT;
  7754     TBool ret = EFalse;
  7741     return ( iMSKEnabledInPlatform &&
  7755     ret = iMSKEnabledInPlatform &&
  7742              AknLayoutUtils::MSKEnabled() &&
  7756     	    ( ( AknLayoutUtils::MSKEnabled() &&
  7743              IsMskEnabledLayoutActive() );
  7757              IsMskEnabledLayoutActive() ) || ( iCbaFlags & EEikCbaFlagAppMskIcon ) );
       
  7758     _AKNTRACE( "MskAllowed is %d", ret );
       
  7759     _AKNTRACE_FUNC_EXIT;
       
  7760     return ret;
  7744     }
  7761     }
  7745 
  7762 
  7746 
  7763 
  7747 // ---------------------------------------------------------------------------
  7764 // ---------------------------------------------------------------------------
  7748 // CEikCba::SoftkeyStatusChangeAllowed
  7765 // CEikCba::SoftkeyStatusChangeAllowed
  7877 // ---------------------------------------------------------------------------
  7894 // ---------------------------------------------------------------------------
  7878 //     
  7895 //     
  7879 void CEikCba::UpdateMultipleMarkingSoftkey()
  7896 void CEikCba::UpdateMultipleMarkingSoftkey()
  7880     {
  7897     {
  7881     _AKNTRACE_FUNC_ENTER;
  7898     _AKNTRACE_FUNC_ENTER;
       
  7899     if ( iFlags.IsSet( ECbaEmbedded ) )
       
  7900         {
       
  7901         return;
       
  7902         }
  7882     if ( iFlags.IsSet( ECbaSingleClickEnabled )
  7903     if ( iFlags.IsSet( ECbaSingleClickEnabled )
  7883             && iExtension && iExtension->iItemActionMenu )
  7904             && iExtension && iExtension->iItemActionMenu )
  7884         {
  7905         {
  7885         TBool markingActive(
  7906         TBool markingActive(
  7886                 iExtension->iItemActionMenu->MarkingMode(
  7907                 iExtension->iItemActionMenu->MarkingMode(