idlehomescreen/xmluirendering/uiengine/src/xnfocuscontrol.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 88 3321d3e205b6
--- a/idlehomescreen/xmluirendering/uiengine/src/xnfocuscontrol.cpp	Wed Sep 15 12:00:00 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnfocuscontrol.cpp	Wed Oct 13 14:18:30 2010 +0300
@@ -109,20 +109,43 @@
     {
     if ( aVisible != iVisible )
         {
-        iVisible = aVisible;
-        
         if ( !aVisible )
             {
+            iVisible = aVisible;
+            
+            iRefused = EFalse;
+            
             CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() ); 
                                    
             if ( node )
                 {
-                node->UnsetStateL(  
-                    XnPropertyNames::style::common::KFocus );                    
+                node->HideTooltipsL();
+                                    
+                CXnControlAdapter* control( node->Control() );
+                
+                if  ( control && control->RefusesFocusLoss() )
+                    {
+                    // Need to keep drawing focus appearance
+                    iRefused = ETrue;
+                    
+                    node->UnsetStateL( 
+                        XnPropertyNames::style::common::KPressedDown );
+                    }
+                else
+                    {
+                    node->UnsetStateL(  
+                        XnPropertyNames::style::common::KFocus );                    
+                    }
                                 
                 iAppUiAdapter.UiEngine().RenderUIL();                
-                }
+                }    
             }
+        else
+            {
+            iRefused = EFalse;
+            
+            iVisible = aVisible;
+            }              
         }        
     }
 
@@ -151,17 +174,42 @@
         return;
         }
     
-    if ( IsVisible() ) 
+    if ( IsVisible() || iRefused ) 
         {                                       
-        TRect innerRect( aRect );            
+        CXnNode* node( iAppUiAdapter.UiEngine().FocusedNode() );
         
-        innerRect.Shrink( 
-            KSkinGfxInnerRectShrink, KSkinGfxInnerRectShrink );
-        
-        MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
-                     
-        AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect, 
-            KAknsIIDQsnFrHome, KAknsIIDDefault );                
+        if ( node )
+            {            
+            CXnProperty* prop( NULL );
+            
+            TRAP_IGNORE( prop = node->GetPropertyL( 
+                XnPropertyNames::common::KFocusAppearance ) );
+                                            
+            if ( prop && prop->StringValue() == XnPropertyNames::KNone )
+                {
+                // Current element refuses to draw focus appearance
+                return;
+                }
+            
+            TRect innerRect( aRect );            
+            
+            innerRect.Shrink( 
+                KSkinGfxInnerRectShrink, KSkinGfxInnerRectShrink );
+            
+            MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+                 
+            if ( node->IsStateSet( XnPropertyNames::style::common::KPressedDown ) )
+                {
+                AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect,
+                    KAknsIIDQsnFrHomePressed, KAknsIIDDefault );                
+                }            
+            
+            if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
+                {
+                AknsDrawUtils::DrawFrame( skin, aGc, aRect, innerRect, 
+                    KAknsIIDQsnFrHome, KAknsIIDDefault );                
+                }            
+            }       
         }
     }