idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 15 040e93e348f6
child 17 b8fae6b8a148
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    44 #include "xneditor.h"
    44 #include "xneditor.h"
    45 #include "xntext.h"
    45 #include "xntext.h"
    46 #include "xnhittest.h"
    46 #include "xnhittest.h"
    47 #include "xnscrollablecontroladapter.h"
    47 #include "xnscrollablecontroladapter.h"
    48 #include "xnviewdata.h"
    48 #include "xnviewdata.h"
       
    49 #include "xnrootdata.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"
    57 _LIT8( KId, "id" );
    58 _LIT8( KId, "id" );
    58 _LIT8( KName, "name" );
    59 _LIT8( KName, "name" );
    59 _LIT8( KToolTip, "tooltip" );
    60 _LIT8( KToolTip, "tooltip" );
    60 _LIT8( KMenuBar, "menubar" );
    61 _LIT8( KMenuBar, "menubar" );
    61 _LIT8( KTextEditor, "texteditor" );
    62 _LIT8( KTextEditor, "texteditor" );
       
    63 _LIT8( KPlugin, "plugin" );
    62 
    64 
    63 _LIT8( KActionsHandler, "actionshandler" );
    65 _LIT8( KActionsHandler, "actionshandler" );
    64 
    66 
    65 const TInt KUnitMaxLen = 2;
    67 const TInt KUnitMaxLen = 2;
    66 const TInt KOneView = 1;
    68 const TInt KOneView = 1;
  2808 // -----------------------------------------------------------------------------
  2810 // -----------------------------------------------------------------------------
  2809 //
  2811 //
  2810 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2812 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2811     {
  2813     {
  2812     TInt effectid = ResolveEffectId( aEventNode );
  2814     TInt effectid = ResolveEffectId( aEventNode );
  2813     aEngine.ViewManager()->ActivateNextViewL( effectid );
  2815     aEngine.ViewManager()->ActivateNextViewL( /*effectid*/ );
  2814     }
  2816     }
  2815 
  2817 
  2816 // -----------------------------------------------------------------------------
  2818 // -----------------------------------------------------------------------------
  2817 // RunActivatePreviousViewL
  2819 // RunActivatePreviousViewL
  2818 // -----------------------------------------------------------------------------
  2820 // -----------------------------------------------------------------------------
  2819 //
  2821 //
  2820 static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2822 static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2821     {
  2823     {
  2822     TInt effectid = ResolveEffectId( aEventNode );
  2824     TInt effectid = ResolveEffectId( aEventNode );
  2823     aEngine.ViewManager()->ActivatePreviousViewL( effectid );
  2825     aEngine.ViewManager()->ActivatePreviousViewL( /*effectid*/ );
  2824     }
  2826     }
  2825 
  2827 
  2826 // -----------------------------------------------------------------------------
  2828 // -----------------------------------------------------------------------------
  2827 // RunAddViewL
  2829 // RunAddViewL
  2828 // -----------------------------------------------------------------------------
  2830 // -----------------------------------------------------------------------------
  2942     CXnDomNode& aEventNode )
  2944     CXnDomNode& aEventNode )
  2943     {        
  2945     {        
  2944     aEngine.DisableRenderUiLC();
  2946     aEngine.DisableRenderUiLC();
  2945    
  2947    
  2946     // Set plugins to edit state
  2948     // Set plugins to edit state
  2947     RPointerArray< CXnPluginData>& plugins( 
  2949     RPointerArray< CXnPluginData >& views( 
  2948             aEngine.ViewManager()->ActiveViewData().PluginData() );
  2950         aEngine.ViewManager()->ActiveAppData().PluginData() );
       
  2951     
       
  2952     CXnViewData* view( NULL );
       
  2953     
       
  2954     for ( TInt i = 0; i < views.Count(); i++ )
       
  2955         {
       
  2956         view = static_cast< CXnViewData* >( views[i] );
       
  2957         
       
  2958         CXnPluginData* plugin( view->Plugin( aThis->Node() ) );
       
  2959         
       
  2960         if ( plugin && plugin == view )
       
  2961             {
       
  2962             break;
       
  2963             }            
       
  2964         }
       
  2965     
       
  2966     if ( !view )
       
  2967         {
       
  2968         return;
       
  2969         }
       
  2970     
       
  2971     RPointerArray< CXnPluginData >& plugins( view->PluginData() );             
  2949 
  2972 
  2950     CXnDomStringPool* sp( aEventNode.StringPool() );
  2973     CXnDomStringPool* sp( aEventNode.StringPool() );
  2951     
  2974     
  2952     CXnDomList& children( aEventNode.ChildNodes() );
  2975     CXnDomList& children( aEventNode.ChildNodes() );
  2953 
  2976 
  2978                         }
  3001                         }
  2979                     }
  3002                     }
  2980                 // Find nodes by class
  3003                 // Find nodes by class
  2981                 else if ( name == XnPropertyNames::common::KClass )
  3004                 else if ( name == XnPropertyNames::common::KClass )
  2982                     {
  3005                     {
  2983                     CXnPointerArray* array = aEngine.FindNodeByClassL( value );
  3006                     CXnPointerArray* array = aEngine.FindNodeByClassL( value, aThis->Namespace() );
  2984                     CleanupStack::PushL( array );
  3007                     CleanupStack::PushL( array );
  2985 
  3008 
  2986                     if ( array )
  3009                     if ( array )
  2987                         {
  3010                         {
  2988                         const TInt count( array->Container().Count() );
  3011                         const TInt count( array->Container().Count() );
  3006                     CleanupStack::PopAndDestroy( array );
  3029                     CleanupStack::PopAndDestroy( array );
  3007                     }
  3030                     }
  3008                 }
  3031                 }
  3009             }
  3032             }
  3010         }
  3033         }
  3011     TBool useEmpty( aEngine.ViewManager()->ActiveViewData().UseEmptyWidget() );
  3034     
       
  3035     TBool useEmpty( view->UseEmptyWidget() );
  3012     
  3036     
  3013     for ( TInt i = 0; i < plugins.Count(); i++ )
  3037     for ( TInt i = 0; i < plugins.Count(); i++ )
  3014         {
  3038         {
  3015         CXnNode* node( plugins[i]->Owner()->LayoutNode() );
  3039         CXnNode* node( plugins[i]->Owner()->LayoutNode() );
  3016         
  3040         
  3023                 XnPropertyNames::style::common::KVisibility,
  3047                 XnPropertyNames::style::common::KVisibility,
  3024                 XnPropertyNames::style::common::visibility::KVisible );                    
  3048                 XnPropertyNames::style::common::visibility::KVisible );                    
  3025             }                                              
  3049             }                                              
  3026         }
  3050         }
  3027     
  3051     
  3028         aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop );        
  3052     aEngine.EditMode()->SetEditModeL( CXnEditMode::EDragAndDrop );        
  3029         aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL();
  3053     aEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL();
  3030 
  3054 
  3031     CleanupStack::PopAndDestroy();
  3055     CleanupStack::PopAndDestroy();
  3032     
  3056     
  3033     aEngine.AppUiAdapter().ViewAdapter().UpdateRskByModeL();
  3057     aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view );
  3034     }
  3058     }
  3035 
  3059 
  3036 // -----------------------------------------------------------------------------
  3060 // -----------------------------------------------------------------------------
  3037 // RunResetEditL
  3061 // RunResetEditL
  3038 // -----------------------------------------------------------------------------
  3062 // -----------------------------------------------------------------------------
  3039 //
  3063 //
  3040 static void RunResetEditL(
  3064 static void RunResetEditL(
  3041     CXnNodeImpl* aThis,
  3065     CXnNodeImpl* aThis,
  3042     CXnUiEngine& aEngine,
  3066     CXnUiEngine& aEngine,
  3043     CXnDomNode& aEventNode )
  3067     CXnDomNode& aEventNode )
  3044     {    
  3068     {
       
  3069     // Set plugins to edit state
       
  3070     RPointerArray< CXnPluginData >& views( 
       
  3071         aEngine.ViewManager()->ActiveAppData().PluginData() );
       
  3072     
       
  3073     CXnViewData* view( NULL );
       
  3074     
       
  3075     for ( TInt i = 0; i < views.Count(); i++ )
       
  3076         {
       
  3077         view = static_cast< CXnViewData* >( views[i] );
       
  3078         
       
  3079         CXnPluginData* plugin( view->Plugin( aThis->Node() ) );
       
  3080         
       
  3081         if ( plugin && plugin == view )
       
  3082             {
       
  3083             break;
       
  3084             }            
       
  3085         }
       
  3086     
       
  3087     if ( !view )
       
  3088         {
       
  3089         return;
       
  3090         }
       
  3091     
  3045     CXnDomList& children( aEventNode.ChildNodes() );
  3092     CXnDomList& children( aEventNode.ChildNodes() );
  3046 
  3093 
  3047     TInt count( children.Length() );
  3094     TInt count( children.Length() );
  3048 
  3095 
  3049     for ( TInt i = 0; i < count; ++i )
  3096     for ( TInt i = 0; i < count; ++i )
  3070                             XnPropertyNames::style::common::KEdit );                        
  3117                             XnPropertyNames::style::common::KEdit );                        
  3071                         }
  3118                         }
  3072                     }
  3119                     }
  3073                 else if ( name == XnPropertyNames::common::KClass )
  3120                 else if ( name == XnPropertyNames::common::KClass )
  3074                     {
  3121                     {
  3075                     CXnPointerArray* array( aEngine.FindNodeByClassL( value ) );
  3122                     CXnPointerArray* array( aEngine.FindNodeByClassL( value, aThis->Namespace() ) );
  3076                     CleanupStack::PushL( array );
  3123                     CleanupStack::PushL( array );
  3077 
  3124 
  3078                     const TInt count = array->Container().Count();
  3125                     const TInt count = array->Container().Count();
  3079 
  3126 
  3080                     for ( TInt i = 0; i < count; ++i )
  3127                     for ( TInt i = 0; i < count; ++i )
  3092                     CleanupStack::PopAndDestroy( array );
  3139                     CleanupStack::PopAndDestroy( array );
  3093                     }
  3140                     }
  3094                 }
  3141                 }
  3095             }
  3142             }
  3096         }
  3143         }
  3097 
  3144     
  3098     RPointerArray< CXnPluginData>& plugins( 
  3145     RPointerArray< CXnPluginData>& plugins( view->PluginData() );             
  3099             aEngine.ViewManager()->ActiveViewData().PluginData() );
  3146     
  3100 
       
  3101     CXnDomStringPool* sp( aEventNode.StringPool() );
  3147     CXnDomStringPool* sp( aEventNode.StringPool() );
  3102 
  3148 
  3103     TBool useEmpty( aEngine.ViewManager()->ActiveViewData().UseEmptyWidget() );
  3149     TBool useEmpty( view->UseEmptyWidget() );
  3104     
  3150     
  3105     for ( TInt i = 0; i < plugins.Count(); i++ )
  3151     for ( TInt i = 0; i < plugins.Count(); i++ )
  3106         {
  3152         {
  3107         CXnNode* node( plugins[i]->Owner()->LayoutNode() );
  3153         CXnNode* node( plugins[i]->Owner()->LayoutNode() );
  3108         
  3154         
  3117             }
  3163             }
  3118         }                
  3164         }                
  3119     
  3165     
  3120     aEngine.EditMode()->SetEditModeL( CXnEditMode::ENone );   
  3166     aEngine.EditMode()->SetEditModeL( CXnEditMode::ENone );   
  3121 
  3167 
  3122     aEngine.AppUiAdapter().ViewAdapter().UpdateRskByModeL();
  3168     aEngine.AppUiAdapter().ViewAdapter().UpdateRskByUiStateL( *view );
  3123     }
  3169     }
  3124 
  3170 
  3125 // -----------------------------------------------------------------------------
  3171 // -----------------------------------------------------------------------------
  3126 // RunDeactivateL
  3172 // RunDeactivateL
  3127 // -----------------------------------------------------------------------------
  3173 // -----------------------------------------------------------------------------
  3761                 aEngine, node, *name, values, CXnDomPropertyValue::EAttr );
  3807                 aEngine, node, *name, values, CXnDomPropertyValue::EAttr );
  3762             }
  3808             }
  3763         }
  3809         }
  3764     else if ( name && classId && type )
  3810     else if ( name && classId && type )
  3765         {
  3811         {
  3766         CXnPointerArray* array = aEngine.FindNodeByClassL( *classId );
  3812         CXnPointerArray* array = aEngine.FindNodeByClassL( *classId, aThis->Namespace() );
  3767         CleanupStack::PushL( array );
  3813         CleanupStack::PushL( array );
  3768 
  3814 
  3769         const TInt count = array->Container().Count();
  3815         const TInt count = array->Container().Count();
  3770 
  3816 
  3771         for ( TInt i = 0; i < count; ++i )
  3817         for ( TInt i = 0; i < count; ++i )
  4840         }
  4886         }
  4841 
  4887 
  4842     // find node below or above to the right
  4888     // find node below or above to the right
  4843     if ( !nextNode )
  4889     if ( !nextNode )
  4844         {
  4890         {
  4845         if ( !stayInNamespace && aEngine &&
       
  4846              aEngine->ViewManager()->ViewAmount() != KOneView )
       
  4847             {
       
  4848             aEngine->ViewManager()->ActivateNextViewL();
       
  4849             return nextNode;
       
  4850             }
       
  4851         CXnNode* candidateAbove = NULL;
  4891         CXnNode* candidateAbove = NULL;
  4852         CXnNode* candidateBelow = NULL;
  4892         CXnNode* candidateBelow = NULL;
  4853 
  4893 
  4854         for ( TInt i = 0; i < aArray.Count(); ++i )
  4894         for ( TInt i = 0; i < aArray.Count(); ++i )
  4855             {
  4895             {
  4966         }
  5006         }
  4967 
  5007 
  4968     // loop to the right
  5008     // loop to the right
  4969     if ( !nextNode )
  5009     if ( !nextNode )
  4970         {
  5010         {
       
  5011         if ( !stayInNamespace && aEngine &&
       
  5012              aEngine->ViewManager()->ViewAmount() != KOneView )
       
  5013             {
       
  5014             aEngine->ViewManager()->ActivateNextViewL();
       
  5015             return nextNode;
       
  5016             }        
       
  5017         
  4971         CXnNode* candidateAbove = NULL;
  5018         CXnNode* candidateAbove = NULL;
  4972         CXnNode* candidateBelow = NULL;
  5019         CXnNode* candidateBelow = NULL;
  4973 
  5020 
  4974         for ( TInt i = 0; i < aArray.Count(); ++i )
  5021         for ( TInt i = 0; i < aArray.Count(); ++i )
  4975             {
  5022             {
  5269             }
  5316             }
  5270         }
  5317         }
  5271 
  5318 
  5272     if ( !nextNode )
  5319     if ( !nextNode )
  5273         {
  5320         {
  5274         if ( !stayInNamespace && aEngine &&
       
  5275              aEngine->ViewManager()->ViewAmount() != KOneView )
       
  5276             {
       
  5277             aEngine->ViewManager()->ActivatePreviousViewL();
       
  5278             return nextNode;
       
  5279             }
       
  5280         CXnNode* candidateAbove = NULL;
  5321         CXnNode* candidateAbove = NULL;
  5281         CXnNode* candidateBelow = NULL;
  5322         CXnNode* candidateBelow = NULL;
  5282 
  5323 
  5283         for ( TInt i = 0; i < aArray.Count(); ++i )
  5324         for ( TInt i = 0; i < aArray.Count(); ++i )
  5284             {
  5325             {
  5398     TInt viewWidth = aNode.FindViewNode()->PaddingRect().Width();
  5439     TInt viewWidth = aNode.FindViewNode()->PaddingRect().Width();
  5399 
  5440 
  5400     // loop to the left
  5441     // loop to the left
  5401     if ( !nextNode )
  5442     if ( !nextNode )
  5402         {
  5443         {
       
  5444         if ( !stayInNamespace && aEngine &&
       
  5445              aEngine->ViewManager()->ViewAmount() != KOneView )
       
  5446             {
       
  5447             aEngine->ViewManager()->ActivatePreviousViewL();
       
  5448             return nextNode;
       
  5449             }
       
  5450         
  5403         CXnNode* candidateAbove = NULL;
  5451         CXnNode* candidateAbove = NULL;
  5404         CXnNode* candidateBelow = NULL;
  5452         CXnNode* candidateBelow = NULL;
  5405 
  5453 
  5406         for ( TInt i = 0; i < aArray.Count(); ++i )
  5454         for ( TInt i = 0; i < aArray.Count(); ++i )
  5407             {
  5455             {
  5934 // FindPluginNode
  5982 // FindPluginNode
  5935 // -----------------------------------------------------------------------------
  5983 // -----------------------------------------------------------------------------
  5936 //
  5984 //
  5937 static CXnNode* FindPluginNode( CXnNode& aNode )
  5985 static CXnNode* FindPluginNode( CXnNode& aNode )
  5938     {
  5986     {
  5939     _LIT8( KPlugin, "plugin" );
       
  5940 
       
  5941     CXnNode* pluginNode = NULL;
  5987     CXnNode* pluginNode = NULL;
  5942     CXnNode* tmp = &aNode;
  5988     CXnNode* tmp = &aNode;
  5943 
  5989 
  5944     while( tmp->Parent() )
  5990     while( tmp->Parent() )
  5945         {
  5991         {
  6015             {
  6061             {
  6016             nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine );
  6062             nextNode = FindNextNodeFromLeftL( array, aNode, containsPopUp, &aEngine );
  6017             }
  6063             }
  6018         if ( nextNode )
  6064         if ( nextNode )
  6019             {
  6065             {
       
  6066             // focus plugin node if in edit mode
       
  6067             if( aEngine.IsEditMode() )
       
  6068                 {
       
  6069                 if( nextNode->Type()->Type() != KPlugin )
       
  6070                     {
       
  6071                     CXnNode* pluginNode = FindPluginNode( *nextNode );
       
  6072                     if( pluginNode )
       
  6073                         {
       
  6074                         nextNode = pluginNode;
       
  6075                         }
       
  6076                     }
       
  6077                 }
       
  6078 
  6020             if( nextNode && nextNode->ScrollableControl() )
  6079             if( nextNode && nextNode->ScrollableControl() )
  6021                 {
  6080                 {
  6022                 nextNode->ScrollableControl()->ShowItem( *nextNode );
  6081                 nextNode->ScrollableControl()->ShowItem( *nextNode );
  6023                 }
  6082                 }
  6024             nextNode->SetStateL( XnPropertyNames::style::common::KFocus );
  6083             nextNode->SetStateL( XnPropertyNames::style::common::KFocus );
  7068 
  7127 
  7069                 if ( popup )
  7128                 if ( popup )
  7070                     {
  7129                     {
  7071                     if ( aSource == XnEventSource::EStylus )
  7130                     if ( aSource == XnEventSource::EStylus )
  7072                         {
  7131                         {
  7073                         const TTimeIntervalMicroSeconds32 delay( 0 );                       
  7132                         const TTimeIntervalMicroSeconds32 delay( 1000 * 100 );                       
  7074                         const TTimeIntervalMicroSeconds32 display( 1000 * 1000 * 6 );                                                
  7133                         const TTimeIntervalMicroSeconds32 display( 1000 * 1000 * 6 );                                                
  7075                         
  7134                         
  7076                         popup->ShowPopupL( aRect, delay, display );
  7135                         popup->ShowPopupL( aRect, delay, display );
  7077                         }
  7136                         }
  7078                     else
  7137                     else