idlehomescreen/xmluirendering/uiengine/src/xnfocuscontrol.cpp
branchRCL_3
changeset 35 3321d3e205b6
parent 34 5456b4e8b3a8
equal deleted inserted replaced
34:5456b4e8b3a8 35:3321d3e205b6
   107 //
   107 //
   108 void CXnFocusControl::DoMakeVisibleL( TBool aVisible )
   108 void CXnFocusControl::DoMakeVisibleL( TBool aVisible )
   109     {
   109     {
   110     if ( aVisible != iVisible )
   110     if ( aVisible != iVisible )
   111         {
   111         {
       
   112         iVisible = aVisible;
       
   113         
   112         if ( !aVisible )
   114         if ( !aVisible )
   113             {
   115             {
   114             iVisible = aVisible;
       
   115             
       
   116             iRefused = EFalse;
       
   117             
       
   118             CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() ); 
   116             CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() ); 
   119                                    
   117                                    
   120             if ( node )
   118             if ( node )
   121                 {
   119                 {
   122                 node->HideTooltipsL();
   120                 node->UnsetStateL(  
   123                                     
   121                     XnPropertyNames::style::common::KFocus );                    
   124                 CXnControlAdapter* control( node->Control() );
       
   125                 
       
   126                 if  ( control && control->RefusesFocusLoss() )
       
   127                     {
       
   128                     // Need to keep drawing focus appearance
       
   129                     iRefused = ETrue;
       
   130                     
       
   131                     node->UnsetStateL( 
       
   132                         XnPropertyNames::style::common::KPressedDown );
       
   133                     }
       
   134                 else
       
   135                     {
       
   136                     node->UnsetStateL(  
       
   137                         XnPropertyNames::style::common::KFocus );                    
       
   138                     }
       
   139                                 
   122                                 
   140                 iAppUiAdapter.UiEngine().RenderUIL();                
   123                 iAppUiAdapter.UiEngine().RenderUIL();                
   141                 }    
   124                 }
   142             }
   125             }
   143         else
       
   144             {
       
   145             iRefused = EFalse;
       
   146             
       
   147             iVisible = aVisible;
       
   148             }              
       
   149         }        
   126         }        
   150     }
   127     }
   151 
   128 
   152 // -----------------------------------------------------------------------------
   129 // -----------------------------------------------------------------------------
   153 // CXnFocusControl::IsVisible()
   130 // CXnFocusControl::IsVisible()
   172     if ( state == CXnEditMode::EShootContent )
   149     if ( state == CXnEditMode::EShootContent )
   173         {
   150         {
   174         return;
   151         return;
   175         }
   152         }
   176     
   153     
   177     if ( IsVisible() || iRefused ) 
   154     if ( IsVisible() ) 
   178         {                                       
   155         {                                       
   179         CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() );
   156         TRect innerRect( aRect );            
   180         
   157         
   181         if ( node )
   158         innerRect.Shrink( 
   182             {            
   159             KSkinGfxInnerRectShrink, KSkinGfxInnerRectShrink );
   183             CXnProperty* prop( NULL );
   160         
   184             
   161         MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
   185             TRAP_IGNORE( prop = node->GetPropertyL( 
   162                      
   186                 XnPropertyNames::common::KFocusAppearance ) );
   163         AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect, 
   187                                             
   164             KAknsIIDQsnFrHome, KAknsIIDDefault );                
   188             if ( prop && prop->StringValue() == XnPropertyNames::KNone )
       
   189                 {
       
   190                 // Current element refuses to draw focus appearance
       
   191                 return;
       
   192                 }
       
   193             
       
   194             TRect innerRect( aRect );            
       
   195             
       
   196             innerRect.Shrink( 
       
   197                 KSkinGfxInnerRectShrink, KSkinGfxInnerRectShrink );
       
   198             
       
   199             MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
       
   200                  
       
   201             if ( node->IsStateSet( XnPropertyNames::style::common::KPressedDown ) )
       
   202                 {
       
   203                 AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect,
       
   204                     KAknsIIDQsnFrHomePressed, KAknsIIDDefault );                
       
   205                 }            
       
   206             
       
   207             if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
       
   208                 {
       
   209                 AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect, 
       
   210                     KAknsIIDQsnFrHome, KAknsIIDDefault );                
       
   211                 }            
       
   212             }       
       
   213         }
   165         }
   214     }
   166     }
   215 
   167 
   216 // End of file
   168 // End of file
   217 
   169