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