idlehomescreen/xmluirendering/uiengine/src/xnfocuscontrol.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 88 3321d3e205b6
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
   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         
       
   114         if ( !aVisible )
   112         if ( !aVisible )
   115             {
   113             {
       
   114             iVisible = aVisible;
       
   115             
       
   116             iRefused = EFalse;
       
   117             
   116             CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() ); 
   118             CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() ); 
   117                                    
   119                                    
   118             if ( node )
   120             if ( node )
   119                 {
   121                 {
   120                 node->UnsetStateL(  
   122                 node->HideTooltipsL();
   121                     XnPropertyNames::style::common::KFocus );                    
   123                                     
       
   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                     }
   122                                 
   139                                 
   123                 iAppUiAdapter.UiEngine().RenderUIL();                
   140                 iAppUiAdapter.UiEngine().RenderUIL();                
   124                 }
   141                 }    
   125             }
   142             }
       
   143         else
       
   144             {
       
   145             iRefused = EFalse;
       
   146             
       
   147             iVisible = aVisible;
       
   148             }              
   126         }        
   149         }        
   127     }
   150     }
   128 
   151 
   129 // -----------------------------------------------------------------------------
   152 // -----------------------------------------------------------------------------
   130 // CXnFocusControl::IsVisible()
   153 // CXnFocusControl::IsVisible()
   149     if ( state == CXnEditMode::EShootContent )
   172     if ( state == CXnEditMode::EShootContent )
   150         {
   173         {
   151         return;
   174         return;
   152         }
   175         }
   153     
   176     
   154     if ( IsVisible() ) 
   177     if ( IsVisible() || iRefused ) 
   155         {                                       
   178         {                                       
   156         TRect innerRect( aRect );            
   179         CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() );
   157         
   180         
   158         innerRect.Shrink( 
   181         if ( node )
   159             KSkinGfxInnerRectShrink, KSkinGfxInnerRectShrink );
   182             {            
   160         
   183             CXnProperty* prop( NULL );
   161         MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
   184             
   162                      
   185             TRAP_IGNORE( prop = node->GetPropertyL( 
   163         AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect, 
   186                 XnPropertyNames::common::KFocusAppearance ) );
   164             KAknsIIDQsnFrHome, KAknsIIDDefault );                
   187                                             
       
   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             }       
   165         }
   213         }
   166     }
   214     }
   167 
   215 
   168 // End of file
   216 // End of file
   169 
   217