idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp
branchRCL_3
changeset 35 3321d3e205b6
parent 34 5456b4e8b3a8
equal deleted inserted replaced
34:5456b4e8b3a8 35:3321d3e205b6
    25 #include "xnnode.h"
    25 #include "xnnode.h"
    26 #include "xnpropertylist.h"
    26 #include "xnpropertylist.h"
    27 #include "xnproperty.h"
    27 #include "xnproperty.h"
    28 #include "xnuiengine.h"
    28 #include "xnuiengine.h"
    29 #include "xnappuiadapter.h"
    29 #include "xnappuiadapter.h"
       
    30 #include "xnkeyeventdispatcher.h"
    30 #include "xncontroladapter.h"
    31 #include "xncontroladapter.h"
    31 #include "xnpopupcontroladapter.h"
    32 #include "xnpopupcontroladapter.h"
    32 #include "xnmenuadapter.h"
    33 #include "xnmenuadapter.h"
    33 #include "xndomlist.h"
    34 #include "xndomlist.h"
    34 #include "xndomdocument.h"
    35 #include "xndomdocument.h"
    49 #include "xnpanic.h"
    50 #include "xnpanic.h"
    50 #include "xnlistquerydialogadapter.h"
    51 #include "xnlistquerydialogadapter.h"
    51 #include "xneffectmanager.h"
    52 #include "xneffectmanager.h"
    52 #include "xnviewadapter.h"
    53 #include "xnviewadapter.h"
    53 #include "xnbackgroundmanager.h"
    54 #include "xnbackgroundmanager.h"
    54 #include "xntexteditor.h"
       
    55 #include "xnitemactivator.h"
    55 #include "xnitemactivator.h"
    56 
    56 
    57 // Local constants
    57 // Local constants
    58 _LIT8( KId, "id" );
    58 _LIT8( KId, "id" );
    59 _LIT8( KName, "name" );
    59 _LIT8( KName, "name" );
   335 static CXnNode* FindNextNodeFromRightL(
   335 static CXnNode* FindNextNodeFromRightL(
   336     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   336     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   337 static CXnNode* FindNextNodeFromLeftL(
   337 static CXnNode* FindNextNodeFromLeftL(
   338     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   338     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   339 static CXnNode* FindNextNodeFromBelowL(
   339 static CXnNode* FindNextNodeFromBelowL(
   340     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse );
   340     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   341 static CXnNode* FindNextNodeFromAboveL(
   341 static CXnNode* FindNextNodeFromAboveL(
   342     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse );
   342     RPointerArray< CXnNode >& aArray, CXnNode& aNode, TBool stayInNamespace = EFalse, CXnUiEngine* aEngine = NULL );
   343 static CXnNode* FindPluginNode( CXnNode& aNode );
   343 static CXnNode* FindPluginNode( CXnNode& aNode );
       
   344 static TBool IsPluginNode( CXnNode& aNode );
   344 static TBool DoInternalFocusChangeL(
   345 static TBool DoInternalFocusChangeL(
   345     CXnUiEngine& aEngine, CXnNode& aNode, const TKeyEvent& aKeyEvent,
   346     CXnUiEngine& aEngine, CXnNode& aNode, const TKeyEvent& aKeyEvent,
   346     TEventCode aType );
   347     TEventCode aType );
   347 static TBool DoTriggerKeyEventL(
   348 static TBool DoTriggerKeyEventL(
   348     CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode,
   349     CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnNode& aNode,
  2933     if( !editorNode && aLayoutNode.Type()->Type() == KTextEditor )
  2934     if( !editorNode && aLayoutNode.Type()->Type() == KTextEditor )
  2934         {
  2935         {
  2935         editorNode = &aLayoutNode;
  2936         editorNode = &aLayoutNode;
  2936         }
  2937         }
  2937     
  2938     
  2938     if( editorNode )
  2939     if ( editorNode )
  2939         {
  2940         {             
  2940         XnTextEditorInterface::MXnTextEditorInterface* editorControl = NULL;
  2941         CXnKeyEventDispatcher* eventDispatcher( 
       
  2942             aEngine.AppUiAdapter().ViewAdapter().EventDispatcher() );
  2941         
  2943         
  2942         XnComponentInterface::MakeInterfaceL( editorControl, editorNode->AppIfL() );
  2944         if ( eventDispatcher )
  2943         if( editorControl )
  2945             {
  2944             {
  2946             if ( aActivate )
  2945             if( aActivate )
  2947                 {
  2946                 {
  2948                 eventDispatcher->SetTextEditorActive( editorNode, ETrue );        
  2947                 editorControl->HandleEditorEvent(CXnTextEditor::KActivateTextEditor);
       
  2948                 }
  2949                 }
  2949             else
  2950             else
  2950                 {
  2951                 {
  2951                 editorControl->HandleEditorEvent(CXnTextEditor::KDeactivateTextEditor);
  2952                 eventDispatcher->SetTextEditorActive( NULL, EFalse );
  2952                 }
  2953                 }        
  2953             }    
  2954             }        
  2954         }
  2955         }
  2955     }
  2956     }
  2956 
  2957 
  2957 // -----------------------------------------------------------------------------
  2958 // -----------------------------------------------------------------------------
  2958 // RunEditL
  2959 // RunEditL
  3054     
  3055     
  3055     TBool useEmpty( view->UseEmptyWidget() );
  3056     TBool useEmpty( view->UseEmptyWidget() );
  3056     
  3057     
  3057     for ( TInt i = 0; i < plugins.Count(); i++ )
  3058     for ( TInt i = 0; i < plugins.Count(); i++ )
  3058         {
  3059         {
  3059         CXnNode* node( plugins[i]->Owner()->LayoutNode() );
  3060         CXnNode* node( plugins[i]->Owner()->LayoutNode() );       
       
  3061         TBool editable = plugins[i]->Editable();
       
  3062 
       
  3063         if( editable )
       
  3064             {
       
  3065             node->SetStateL( XnPropertyNames::style::common::KEdit );
       
  3066             }
  3060         
  3067         
  3061         node->SetStateL( XnPropertyNames::style::common::KEdit );
       
  3062                                
       
  3063         if ( !plugins[i]->Occupied() && useEmpty )
  3068         if ( !plugins[i]->Occupied() && useEmpty )
  3064             {                               
  3069             {                               
  3065             // Make empty space visible
  3070             // Make empty space visible
  3066             SetStringPropertyToNodeL( *sp, *node,
  3071             SetStringPropertyToNodeL( *sp, *node,
  3067                 XnPropertyNames::style::common::KVisibility,
  3072                 XnPropertyNames::style::common::KVisibility,
  3068                 XnPropertyNames::style::common::visibility::KVisible );                    
  3073                 XnPropertyNames::style::common::visibility::KVisible );                    
  3069             }                                              
  3074             }  
  3070         }
  3075         }
  3071     
  3076     
  3072     aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop );        
  3077     aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop );        
  3073     aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL();
  3078     aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL();
  3074 
  3079 
  3732                 {
  3737                 {
  3733                 plugins.AppendL( data );
  3738                 plugins.AppendL( data );
  3734                 }
  3739                 }
  3735             }
  3740             }
  3736         
  3741         
  3737         plugins.Append( &viewData );
  3742         plugins.AppendL( &viewData );
  3738             
  3743             
  3739         RPointerArray< CXnNode > list;
  3744         RPointerArray< CXnNode > list;
  3740         CleanupClosePushL( list );
  3745         CleanupClosePushL( list );
  3741 
  3746 
  3742         for( TInt i = 0; i < plugins.Count(); i++ )
  3747         for( TInt i = 0; i < plugins.Count(); i++ )
  4778     RPointerArray< CXnNode >& aArray,
  4783     RPointerArray< CXnNode >& aArray,
  4779     CXnNode& aNode,
  4784     CXnNode& aNode,
  4780     TBool stayInNamespace,
  4785     TBool stayInNamespace,
  4781     CXnUiEngine* aEngine )
  4786     CXnUiEngine* aEngine )
  4782     {
  4787     {
  4783     
       
  4784     CXnNode* nextNode = NULL;
  4788     CXnNode* nextNode = NULL;
  4785     TRect rect = aNode.PaddingRect();
  4789     TRect rect = aNode.PaddingRect();
  4786 
  4790 
  4787     for ( TInt i = 0; i < aArray.Count(); ++i )
  4791     for ( TInt i = 0; i < aArray.Count(); ++i )
  4788         {
  4792         {
  4797             }
  4801             }
  4798         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  4802         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  4799             {
  4803             {
  4800             // do not shift focus to another view
  4804             // do not shift focus to another view
  4801             continue;
  4805             continue;
       
  4806             }
       
  4807         if( aEngine->IsEditMode() )
       
  4808             {
       
  4809             if( !IsPluginNode( *tmpNode ) )
       
  4810                 {
       
  4811                 // move only between "plugin" nodes in edit mode
       
  4812                 continue;
       
  4813                 }
  4802             }
  4814             }
  4803         
  4815         
  4804         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  4816         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  4805         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  4817         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  4806                
  4818                
  4921             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  4933             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  4922                 {
  4934                 {
  4923                 // do not shift focus to another view
  4935                 // do not shift focus to another view
  4924                 continue;
  4936                 continue;
  4925                 }
  4937                 }
       
  4938             if( aEngine->IsEditMode() )
       
  4939                 {
       
  4940                 if( !IsPluginNode( *tmpNode ) )
       
  4941                     {
       
  4942                     // move only between "plugin" nodes in edit mode
       
  4943                     continue;
       
  4944                     }
       
  4945                 }          
  4926             
  4946             
  4927             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  4947             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  4928             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  4948             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  4929 
  4949 
  4930             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  4950             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5035         CXnNode* candidateBelow = NULL;
  5055         CXnNode* candidateBelow = NULL;
  5036 
  5056 
  5037         for ( TInt i = 0; i < aArray.Count(); ++i )
  5057         for ( TInt i = 0; i < aArray.Count(); ++i )
  5038             {
  5058             {
  5039             CXnNode* tmpNode = aArray[i];
  5059             CXnNode* tmpNode = aArray[i];
       
  5060             
  5040             if ( !IsNodeNavigableL( *tmpNode ) )
  5061             if ( !IsNodeNavigableL( *tmpNode ) )
  5041                 {
  5062                 {
  5042                 continue;
  5063                 continue;
  5043                 }
  5064                 }
  5044             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5065             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5045                 {
  5066                 {
  5046                 // do not shift focus to another view
  5067                 // do not shift focus to another view
  5047                 continue;
  5068                 continue;
  5048                 }
  5069                 }
       
  5070             if( aEngine->IsEditMode() )
       
  5071                 {
       
  5072                 if( !IsPluginNode( *tmpNode ) )
       
  5073                     {
       
  5074                     // move only between "plugin" nodes in edit mode
       
  5075                     continue;
       
  5076                     }
       
  5077                 }            
  5049             
  5078             
  5050             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5079             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5051             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5080             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5052                    
  5081                    
  5053             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5082             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5228             }
  5257             }
  5229         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5258         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5230             {
  5259             {
  5231             // do not shift focus to another view
  5260             // do not shift focus to another view
  5232             continue;
  5261             continue;
       
  5262             }
       
  5263         if( aEngine->IsEditMode() )
       
  5264             {
       
  5265             if( !IsPluginNode( *tmpNode ) )
       
  5266                 {
       
  5267                 // move only between "plugin" nodes in edit mode
       
  5268                 continue;
       
  5269                 }
  5233             }
  5270             }
  5234         
  5271         
  5235         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5272         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5236         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5273         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5237                
  5274                
  5351             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5388             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5352                 {
  5389                 {
  5353                 // do not shift focus to another view
  5390                 // do not shift focus to another view
  5354                 continue;
  5391                 continue;
  5355                 }
  5392                 }
       
  5393             if( aEngine->IsEditMode() )
       
  5394                 {
       
  5395                 if( !IsPluginNode( *tmpNode ) )
       
  5396                     {
       
  5397                     // move only between "plugin" nodes in edit mode
       
  5398                     continue;
       
  5399                     }
       
  5400                 }
  5356             
  5401             
  5357             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5402             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5358             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  5403             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  5359                    
  5404                    
  5360             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5405             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5468         CXnNode* candidateBelow = NULL;
  5513         CXnNode* candidateBelow = NULL;
  5469 
  5514 
  5470         for ( TInt i = 0; i < aArray.Count(); ++i )
  5515         for ( TInt i = 0; i < aArray.Count(); ++i )
  5471             {
  5516             {
  5472             CXnNode* tmpNode = aArray[i];
  5517             CXnNode* tmpNode = aArray[i];
  5473             /*
  5518 
  5474             if ( tmpNode == &aNode )
       
  5475                 {
       
  5476                 continue;
       
  5477                 }
       
  5478             */
       
  5479             if ( !IsNodeNavigableL( *tmpNode ) )
  5519             if ( !IsNodeNavigableL( *tmpNode ) )
  5480                 {
  5520                 {
  5481                 continue;
  5521                 continue;
  5482                 }
  5522                 }
  5483             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5523             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5484                 {
  5524                 {
  5485                 // do not shift focus to another view
  5525                 // do not shift focus to another view
  5486                 continue;
  5526                 continue;
  5487                 }
  5527                 }
       
  5528             if( aEngine->IsEditMode() )
       
  5529                 {
       
  5530                 if( !IsPluginNode( *tmpNode ) )
       
  5531                     {
       
  5532                     // move only between "plugin" nodes in edit mode
       
  5533                     continue;
       
  5534                     }
       
  5535                 }            
  5488             
  5536             
  5489             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5537             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5490             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5538             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5491                    
  5539                    
  5492             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5540             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5647 // FindNextNodeFromBelowL
  5695 // FindNextNodeFromBelowL
  5648 // -----------------------------------------------------------------------------
  5696 // -----------------------------------------------------------------------------
  5649 //
  5697 //
  5650 static CXnNode* FindNextNodeFromBelowL(
  5698 static CXnNode* FindNextNodeFromBelowL(
  5651     RPointerArray< CXnNode >& aArray,
  5699     RPointerArray< CXnNode >& aArray,
  5652     CXnNode& aNode, TBool stayInNamespace )
  5700     CXnNode& aNode, TBool stayInNamespace,
       
  5701     CXnUiEngine* aEngine )
  5653     {
  5702     {
  5654     CXnNode* nextNode = NULL;
  5703     CXnNode* nextNode = NULL;
  5655     TRect rect = aNode.PaddingRect();
  5704     TRect rect = aNode.PaddingRect();
  5656 
  5705 
  5657     for ( TInt i = 0; i < aArray.Count(); ++i )
  5706     for ( TInt i = 0; i < aArray.Count(); ++i )
  5667             }
  5716             }
  5668         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5717         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5669             {
  5718             {
  5670             // do not shift focus to another view
  5719             // do not shift focus to another view
  5671             continue;
  5720             continue;
       
  5721             }
       
  5722         if( aEngine->IsEditMode() )
       
  5723             {
       
  5724             if( !IsPluginNode( *tmpNode ) )
       
  5725                 {
       
  5726                 // move only between "plugin" nodes in edit mode
       
  5727                 continue;
       
  5728                 }
  5672             }        
  5729             }        
  5673         
  5730         
  5674         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5731         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5675         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5732         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5676                
  5733                
  5752             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5809             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5753                 {
  5810                 {
  5754                 // do not shift focus to another view
  5811                 // do not shift focus to another view
  5755                 continue;
  5812                 continue;
  5756                 }
  5813                 }
       
  5814             if( aEngine->IsEditMode() )
       
  5815                 {
       
  5816                 if( !IsPluginNode( *tmpNode ) )
       
  5817                     {
       
  5818                     // move only between "plugin" nodes in edit mode
       
  5819                     continue;
       
  5820                     }
       
  5821                 }            
  5757             
  5822             
  5758             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5823             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5759             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5824             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();
  5760 
  5825 
  5761             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5826             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5823 // FindNextNodeFromAboveL
  5888 // FindNextNodeFromAboveL
  5824 // -----------------------------------------------------------------------------
  5889 // -----------------------------------------------------------------------------
  5825 //
  5890 //
  5826 static CXnNode* FindNextNodeFromAboveL(
  5891 static CXnNode* FindNextNodeFromAboveL(
  5827     RPointerArray< CXnNode >& aArray,
  5892     RPointerArray< CXnNode >& aArray,
  5828     CXnNode& aNode, TBool stayInNamespace )
  5893     CXnNode& aNode, TBool stayInNamespace,
       
  5894     CXnUiEngine* aEngine )
  5829     {
  5895     {
  5830     CXnNode* nextNode = NULL;
  5896     CXnNode* nextNode = NULL;
  5831     TRect rect = aNode.PaddingRect();
  5897     TRect rect = aNode.PaddingRect();
  5832 
  5898 
  5833     for ( TInt i = 0; i < aArray.Count(); ++i )
  5899     for ( TInt i = 0; i < aArray.Count(); ++i )
  5844         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5910         if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5845             {
  5911             {
  5846             // do not shift focus to another view
  5912             // do not shift focus to another view
  5847             continue;
  5913             continue;
  5848             }
  5914             }
       
  5915         if( aEngine->IsEditMode() )
       
  5916             {
       
  5917             if( !IsPluginNode( *tmpNode ) )
       
  5918                 {
       
  5919                 // move only between "plugin" nodes in edit mode
       
  5920                 continue;
       
  5921                 }
       
  5922             }        
  5849         
  5923         
  5850         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5924         const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5851         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  5925         const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  5852        
  5926        
  5853         if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5927         if ( stayInNamespace && tmpNamespace != nodeNamespace )
  5927             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  6001             if ( tmpNode->FindViewNode() != tmpNode->UiEngine()->ActiveView() )
  5928                 {
  6002                 {
  5929                 // do not shift focus to another view
  6003                 // do not shift focus to another view
  5930                 continue;
  6004                 continue;
  5931                 }
  6005                 }
       
  6006             if( aEngine->IsEditMode() )
       
  6007                 {
       
  6008                 if( !IsPluginNode( *tmpNode ) )
       
  6009                     {
       
  6010                     // move only between "plugin" nodes in edit mode
       
  6011                     continue;
       
  6012                     }
       
  6013                 }            
  5932             
  6014             
  5933             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  6015             const TDesC8& tmpNamespace = tmpNode->Impl()->Namespace();
  5934             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  6016             const TDesC8& nodeNamespace = aNode.Impl()->Namespace();       
  5935                    
  6017                    
  5936             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  6018             if ( stayInNamespace && tmpNamespace != nodeNamespace )
  6017 
  6099 
  6018     return pluginNode;
  6100     return pluginNode;
  6019     }
  6101     }
  6020 
  6102 
  6021 // -----------------------------------------------------------------------------
  6103 // -----------------------------------------------------------------------------
       
  6104 // IsPluginNode
       
  6105 // -----------------------------------------------------------------------------
       
  6106 //
       
  6107 static TBool IsPluginNode( CXnNode& aNode )
       
  6108     {
       
  6109     TBool ret = EFalse;
       
  6110     
       
  6111     const TDesC8& nodeType = aNode.DomNode()->Name();
       
  6112     if( nodeType == KPlugin )
       
  6113         {
       
  6114         ret = ETrue;
       
  6115         }
       
  6116     
       
  6117     return ret;
       
  6118     }
       
  6119 
       
  6120 // -----------------------------------------------------------------------------
  6022 // DoInternalFocusChangeL
  6121 // DoInternalFocusChangeL
  6023 // -----------------------------------------------------------------------------
  6122 // -----------------------------------------------------------------------------
  6024 //
  6123 //
  6025 static TBool DoInternalFocusChangeL( CXnUiEngine& aEngine,
  6124 static TBool DoInternalFocusChangeL( CXnUiEngine& aEngine,
  6026     CXnNode& aNode, const TKeyEvent& aKeyEvent, TEventCode aType )
  6125     CXnNode& aNode, const TKeyEvent& aKeyEvent, TEventCode aType )
  6048 
  6147 
  6049     // Handle 'appearance' navigation first, if the current node has 
  6148     // Handle 'appearance' navigation first, if the current node has 
  6050     // "nav-index: appearance"...
  6149     // "nav-index: appearance"...
  6051     CXnProperty* navind = aNode.NavIndexL();
  6150     CXnProperty* navind = aNode.NavIndexL();
  6052     if ( navind && navind->StringValue() == XnPropertyNames::style::common::KAppearance )
  6151     if ( navind && navind->StringValue() == XnPropertyNames::style::common::KAppearance )
  6053         {
  6152         {        
       
  6153         CXnAppUiAdapter& appui( aEngine.AppUiAdapter() );
  6054         
  6154         
  6055         CXnAppUiAdapter& appui = static_cast< CXnAppUiAdapter& >( *iAvkonAppUi );
  6155         CXnPluginData* plugin( appui.ViewManager().ActiveViewData().Plugin( &aNode ) ); 
  6056         CXnPluginData* plugin( 
  6156                     
  6057                     appui.ViewManager().ActiveViewData().Plugin( &aNode ) );
       
  6058         
       
  6059         // find if node is in a widget that contatins some opened popup window       
  6157         // find if node is in a widget that contatins some opened popup window       
  6060         TBool containsPopUp = ( plugin ? plugin->IsDisplayingPopup() : EFalse );
  6158         TBool containsPopUp = ( plugin ? plugin->IsDisplayingPopup() : EFalse );
  6061 
  6159 
  6062         CXnNode* nextNode( NULL );
  6160         CXnNode* nextNode( NULL );
  6063         RPointerArray< CXnNode >& array = aEngine.ViewManager()->AppearanceNodes();
  6161         RPointerArray< CXnNode >& array = aEngine.ViewManager()->AppearanceNodes();
  6064         if ( aKeyEvent.iScanCode == EStdKeyDownArrow )
  6162         if ( aKeyEvent.iScanCode == EStdKeyDownArrow )
  6065             {
  6163             {
  6066             nextNode = FindNextNodeFromBelowL( array, aNode, containsPopUp );
  6164             nextNode = FindNextNodeFromBelowL( array, aNode, containsPopUp, &aEngine );
  6067             }
  6165             }
  6068         else if ( aKeyEvent.iScanCode == EStdKeyUpArrow )
  6166         else if ( aKeyEvent.iScanCode == EStdKeyUpArrow )
  6069             {
  6167             {
  6070             nextNode = FindNextNodeFromAboveL( array, aNode, containsPopUp );
  6168             nextNode = FindNextNodeFromAboveL( array, aNode, containsPopUp, &aEngine );
  6071             }
  6169             }
  6072         else if ( aKeyEvent.iScanCode == EStdKeyRightArrow )
  6170         else if ( aKeyEvent.iScanCode == EStdKeyRightArrow )
  6073             {
  6171             {
  6074             nextNode = FindNextNodeFromRightL( array, aNode, containsPopUp, &aEngine );
  6172             nextNode = FindNextNodeFromRightL( array, aNode, containsPopUp, &aEngine );
  6075             }
  6173             }
  6076         else if ( aKeyEvent.iScanCode == EStdKeyLeftArrow )
  6174         else if ( aKeyEvent.iScanCode == EStdKeyLeftArrow )
  6077             {
  6175             {
  6078             nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine );
  6176             nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine );
  6079             }
  6177             }
  6080         if ( nextNode )
  6178         if ( nextNode )
  6081             {
  6179             {   
  6082             // focus plugin node if in edit mode
       
  6083             if( aEngine.IsEditMode() )
       
  6084                 {
       
  6085                 if( nextNode->Type()->Type() != KPlugin )
       
  6086                     {
       
  6087                     CXnNode* pluginNode = FindPluginNode( *nextNode );
       
  6088                     if( pluginNode )
       
  6089                         {
       
  6090                         nextNode = pluginNode;
       
  6091                         }
       
  6092                     }
       
  6093                 }
       
  6094 
       
  6095             if( nextNode && nextNode->ScrollableControl() )
  6180             if( nextNode && nextNode->ScrollableControl() )
  6096                 {
  6181                 {
  6097                 nextNode->ScrollableControl()->ShowItem( *nextNode );
  6182                 nextNode->ScrollableControl()->ShowItem( *nextNode );
  6098                 }
  6183                 }
       
  6184             
  6099             nextNode->SetStateL( XnPropertyNames::style::common::KFocus );
  6185             nextNode->SetStateL( XnPropertyNames::style::common::KFocus );
  6100             return ETrue;
  6186             return ETrue;
  6101             }
  6187             }
  6102         }
  6188         }
  6103     else
  6189     else
  7954 // -----------------------------------------------------------------------------
  8040 // -----------------------------------------------------------------------------
  7955 // CXnNodeImpl::SetLaidOutL
  8041 // CXnNodeImpl::SetLaidOutL
  7956 // -----------------------------------------------------------------------------
  8042 // -----------------------------------------------------------------------------
  7957 //
  8043 //
  7958 void CXnNodeImpl::SetLaidOutL()
  8044 void CXnNodeImpl::SetLaidOutL()
  7959     {
  8045     {       
  7960     if ( !iLayoutCapable )
  8046     if ( !iLayoutCapable || iDropped || !IsNodeDisplayedL( *iNode ) )
  7961         {
  8047         {
  7962         return;
  8048         iLaidOut = EFalse;
  7963         }
  8049         }
  7964 
  8050     else
  7965     if ( iDropped || !IsNodeDisplayedL( *iNode ) )
  8051         {
  7966         {
  8052         iLaidOut = ETrue;
  7967         return;
  8053         }
  7968         }
       
  7969 
       
  7970     iLaidOut = ETrue;
       
  7971 
  8054 
  7972     for ( TInt i = 0; i < iChildren.Count(); i++ )
  8055     for ( TInt i = 0; i < iChildren.Count(); i++ )
  7973         {
  8056         {
  7974         iChildren[i]->SetLaidOutL();
  8057         iChildren[i]->SetLaidOutL();
  7975         }
  8058         }
  9132     lockedNodes.Reset();
  9215     lockedNodes.Reset();
  9133     lockedNodeIndex.Reset();
  9216     lockedNodeIndex.Reset();
  9134     CleanupStack::PopAndDestroy( 2 ); // lockedNodes, lockedNodeIndex
  9217     CleanupStack::PopAndDestroy( 2 ); // lockedNodes, lockedNodeIndex
  9135     }
  9218     }
  9136 
  9219 
       
  9220 /*
  9137 // -----------------------------------------------------------------------------
  9221 // -----------------------------------------------------------------------------
  9138 // CXnNodeImpl::FindNextNodeL
  9222 // CXnNodeImpl::FindNextNodeL
  9139 // -----------------------------------------------------------------------------
  9223 // -----------------------------------------------------------------------------
  9140 //
  9224 //
  9141 CXnNode* CXnNodeImpl::FindNextNodeL(
  9225 CXnNode* CXnNodeImpl::FindNextNodeL(
  9160         {
  9244         {
  9161         node = FindNextNodeFromBelowL( aArray, aNode );
  9245         node = FindNextNodeFromBelowL( aArray, aNode );
  9162         }
  9246         }
  9163     return node;
  9247     return node;
  9164     }
  9248     }
       
  9249 */    
  9165 
  9250 
  9166 // -----------------------------------------------------------------------------
  9251 // -----------------------------------------------------------------------------
  9167 // CXnNodeImpl::Namespace
  9252 // CXnNodeImpl::Namespace
  9168 // -----------------------------------------------------------------------------
  9253 // -----------------------------------------------------------------------------
  9169 //
  9254 //