idlehomescreen/xmluirendering/uiengine/src/xnnodeimpl.cpp
branchRCL_3
changeset 20 899e4666ea9a
parent 15 040e93e348f6
parent 19 79311d856354
child 24 515194ff9f15
equal deleted inserted replaced
16:1526727a5b85 20:899e4666ea9a
    41 #include "xnpopup.h"
    41 #include "xnpopup.h"
    42 #include "c_xnutils.h"
    42 #include "c_xnutils.h"
    43 #include "xneditmode.h"
    43 #include "xneditmode.h"
    44 #include "xneditor.h"
    44 #include "xneditor.h"
    45 #include "xntext.h"
    45 #include "xntext.h"
    46 #include "xnhittest.h"
       
    47 #include "xnscrollablecontroladapter.h"
    46 #include "xnscrollablecontroladapter.h"
    48 #include "xnviewdata.h"
    47 #include "xnviewdata.h"
    49 #include "xnrootdata.h"
    48 #include "xnrootdata.h"
    50 #include "xnpanic.h"
    49 #include "xnpanic.h"
    51 #include "xnlistquerydialogadapter.h"
    50 #include "xnlistquerydialogadapter.h"
   264     RPointerArray< CXnNode >& aFocusCandidates );
   263     RPointerArray< CXnNode >& aFocusCandidates );
   265 static void RunAppUiNotificationL( CXnUiEngine& aEngine, CXnNode& aNode,
   264 static void RunAppUiNotificationL( CXnUiEngine& aEngine, CXnNode& aNode,
   266     CXnDomNode& aEventNode, CXnDomNode& aTriggerNode, CXnNode& aEventData );
   265     CXnDomNode& aEventNode, CXnDomNode& aTriggerNode, CXnNode& aEventData );
   267 static void RunFullScreenEffectL(
   266 static void RunFullScreenEffectL(
   268     CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   267     CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   269 static void RunActivateViewL(
       
   270     CXnNodeImpl* aThis, CXnUiEngine& aEngine, CXnDomNode& aEventNode );
       
   271 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   268 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   272 static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   269 static void RunActivatePreviousViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   273 static void RunAddViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   270 static void RunAddViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   274 static void RunRemoveViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   271 static void RunRemoveViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode );
   275 static void RunActivateL(
   272 static void RunActivateL(
   893         }
   890         }
   894 
   891 
   895     TInt level( XnDirtyLevel::ENone );
   892     TInt level( XnDirtyLevel::ENone );
   896 
   893 
   897     EnableStatePropertyL(
   894     EnableStatePropertyL(
   898         aNode, aPseudoClass, CXnNode::WidthL,
   895         aNode, aPseudoClass, &CXnNode::WidthL,
   899         aLayoutPropertyCache->iWidth,
   896         aLayoutPropertyCache->iWidth,
   900         aLayoutPropertyCache->iWidths, level );
   897         aLayoutPropertyCache->iWidths, level );
   901 
   898 
   902     EnableStatePropertyL(
   899     EnableStatePropertyL(
   903         aNode, aPseudoClass, &CXnNode::HeightL,
   900         aNode, aPseudoClass, &CXnNode::HeightL,
  2771             effectId, aEngine.ViewManager()->ActiveViewData() );        
  2768             effectId, aEngine.ViewManager()->ActiveViewData() );        
  2772         }
  2769         }
  2773     }
  2770     }
  2774 
  2771 
  2775 // -----------------------------------------------------------------------------
  2772 // -----------------------------------------------------------------------------
  2776 // RunActivateViewL
       
  2777 // -----------------------------------------------------------------------------
       
  2778 //
       
  2779 static void RunActivateViewL(
       
  2780     CXnNodeImpl* aThis,
       
  2781     CXnUiEngine& aEngine,
       
  2782     CXnDomNode& aEventNode )
       
  2783     {
       
  2784     CXnDomList& children( aEventNode.ChildNodes() );
       
  2785 
       
  2786     TInt count( children.Length() );
       
  2787 
       
  2788     for ( TInt i = 0; i < count; ++i )
       
  2789         {
       
  2790         CXnDomNode* node = static_cast< CXnDomNode* >( children.Item( i ) );
       
  2791 
       
  2792         const TDesC8& type( node->Name() );
       
  2793 
       
  2794         if ( type == XnPropertyNames::action::KProperty )
       
  2795             {
       
  2796             const TDesC8& id( node->AttributeValue( XnPropertyNames::action::KValue ) );
       
  2797 
       
  2798             CXnNode* viewNode( aEngine.FindNodeByIdL( id, aThis->Namespace() ) );
       
  2799 
       
  2800             if ( viewNode )
       
  2801                 {
       
  2802                 aEngine.ActivateViewL( *viewNode );
       
  2803                 }
       
  2804             }
       
  2805         }
       
  2806     }
       
  2807 
       
  2808 // -----------------------------------------------------------------------------
       
  2809 // RunActivateNextViewL
  2773 // RunActivateNextViewL
  2810 // -----------------------------------------------------------------------------
  2774 // -----------------------------------------------------------------------------
  2811 //
  2775 //
  2812 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2776 static void RunActivateNextViewL( CXnUiEngine& aEngine, CXnDomNode& aEventNode )
  2813     {
  2777     {
  3558                     XnMenuInterface::MXnMenuInterface* menuIf( NULL );
  3522                     XnMenuInterface::MXnMenuInterface* menuIf( NULL );
  3559                     XnComponentInterface::MakeInterfaceL( menuIf, menubar->AppIfL() );
  3523                     XnComponentInterface::MakeInterfaceL( menuIf, menubar->AppIfL() );
  3560 
  3524 
  3561                     if ( menuIf )
  3525                     if ( menuIf )
  3562                         {
  3526                         {
  3563                         menuIf->TryDisplayingMenuBarL( *menuId );
  3527                         aEngine.Editor()->SetTargetPlugin( aEngine.FocusedNode() );
       
  3528                         menuIf->TryDisplayingMenuBarL( *menuId, EFalse );
  3564                         }
  3529                         }
  3565 
  3530 
  3566                     CleanupStack::PopAndDestroy( menuId );
  3531                     CleanupStack::PopAndDestroy( menuId );
  3567                     }
  3532                     }
  3568                 }
  3533                 }
  3944         RunAddViewL( aEngine, aEventNode );
  3909         RunAddViewL( aEngine, aEventNode );
  3945         }
  3910         }
  3946     else if ( nameString == XnPropertyNames::action::event::KRemoveView )
  3911     else if ( nameString == XnPropertyNames::action::event::KRemoveView )
  3947         {
  3912         {
  3948         RunRemoveViewL( aEngine, aEventNode );
  3913         RunRemoveViewL( aEngine, aEventNode );
  3949         }
       
  3950     else if ( nameString == XnPropertyNames::action::event::KActivateView )
       
  3951         {
       
  3952         RunActivateViewL( aThis, aEngine, aEventNode );
       
  3953         }
  3914         }
  3954     else if ( nameString == XnPropertyNames::action::event::KActivate )
  3915     else if ( nameString == XnPropertyNames::action::event::KActivate )
  3955         {
  3916         {
  3956         RunActivateL( aThis, aEngine, aEventNode );
  3917         RunActivateL( aThis, aEngine, aEventNode );
  3957         return ETrue;
  3918         return ETrue;
  7123                 CXnNodeAppIf& tooltipNode( node->AppIfL() );
  7084                 CXnNodeAppIf& tooltipNode( node->AppIfL() );
  7124                 CXnPopup* popup( NULL );
  7085                 CXnPopup* popup( NULL );
  7125 
  7086 
  7126                 XnComponentInterface::MakeInterfaceL( popup, tooltipNode );
  7087                 XnComponentInterface::MakeInterfaceL( popup, tooltipNode );
  7127 
  7088 
  7128                 if ( popup )
  7089                 if ( popup && aSource != XnEventSource::EStylus )
  7129                     {
  7090                     {
  7130                     if ( aSource == XnEventSource::EStylus )
  7091                     popup->ShowPopupL( aRect );
  7131                         {
       
  7132                         const TTimeIntervalMicroSeconds32 delay( 1000 * 100 );                       
       
  7133                         const TTimeIntervalMicroSeconds32 display( 1000 * 1000 * 6 );                                                
       
  7134                         
       
  7135                         popup->ShowPopupL( aRect, delay, display );
       
  7136                         }
       
  7137                     else
       
  7138                         {
       
  7139                         popup->ShowPopupL( aRect );
       
  7140                         }
       
  7141                     }
  7092                     }
  7142                 }
  7093                 }
  7143             }
  7094             }
  7144         }
  7095         }
  7145     }
  7096     }
  9078             target = i;
  9029             target = i;
  9079             }
  9030             }
  9080         }
  9031         }
  9081     if ( source != -1 && target != -1 )
  9032     if ( source != -1 && target != -1 )
  9082         {
  9033         {
       
  9034         TBool swap = EFalse;
       
  9035         CXnPluginData* data( aTarget->UiEngine()->ViewManager()->
       
  9036                 ActiveViewData().Plugin( aTarget ) );
       
  9037         if ( data && !data->Occupied() )
       
  9038             {
       
  9039             // target is empty widget, swap widget places
       
  9040             swap = ETrue;
       
  9041             }
       
  9042         
  9083         if ( target < source )
  9043         if ( target < source )
  9084             {
  9044             {
  9085             iChildren.InsertL( aSource, target );
  9045             iChildren.InsertL( aSource, target );
  9086             iChildren.Remove( source + 1 );
  9046             iChildren.Remove( source + 1 );
       
  9047             if ( swap )
       
  9048                 {
       
  9049                 iChildren.Remove( target + 1 );
       
  9050                 iChildren.InsertL( aTarget, source );
       
  9051                 }
  9087             }
  9052             }
  9088         else if ( source < target )
  9053         else if ( source < target )
  9089             {
  9054             {
  9090             iChildren.Remove( source );
  9055             iChildren.Remove( source );
  9091             iChildren.InsertL( aSource, target );
  9056             iChildren.InsertL( aSource, target );
       
  9057             if ( swap )
       
  9058                 {
       
  9059                 iChildren.Insert( aTarget, source );
       
  9060                 iChildren.Remove( target );
       
  9061                 }
  9092             }
  9062             }
  9093 
  9063 
  9094         // put the locked nodes to the original places
  9064         // put the locked nodes to the original places
  9095         TInt lockedNodeCount = lockedNodes.Count();
  9065         TInt lockedNodeCount = lockedNodes.Count();
  9096         TInt lockedIndexCount = lockedNodeIndex.Count();
  9066         TInt lockedIndexCount = lockedNodeIndex.Count();