idlehomescreen/xmluirendering/uiengine/src/xnuiengineimpl.cpp
branchRCL_3
changeset 18 d05a55b217df
parent 17 b8fae6b8a148
child 19 79311d856354
equal deleted inserted replaced
17:b8fae6b8a148 18:d05a55b217df
    49 #include <aknlayoutscalable_avkon.cdl.h>
    49 #include <aknlayoutscalable_avkon.cdl.h>
    50 #include "xuikon_builds_cfg.hrh"
    50 #include "xuikon_builds_cfg.hrh"
    51 #include "xndomdocument.h"
    51 #include "xndomdocument.h"
    52 #include "xndomnode.h"
    52 #include "xndomnode.h"
    53 #include "xneditmode.h"
    53 #include "xneditmode.h"
    54 #include "xnhittest.h"
       
    55 #include "xnnode.h"
    54 #include "xnnode.h"
    56 #include "xnpanic.h"
    55 #include "xnpanic.h"
    57 #include "xneffectmanager.h"
    56 #include "xneffectmanager.h"
    58 #include "xneditor.h"
    57 #include "xneditor.h"
    59 #include "xnbackgroundmanager.h"
    58 #include "xnbackgroundmanager.h"
  8065 // -----------------------------------------------------------------------------
  8064 // -----------------------------------------------------------------------------
  8066 //
  8065 //
  8067 void CXnUiEngineImpl::ConstructL()
  8066 void CXnUiEngineImpl::ConstructL()
  8068     {                  
  8067     {                  
  8069     iEditMode = CXnEditMode::NewL( *iUiEngine );
  8068     iEditMode = CXnEditMode::NewL( *iUiEngine );
  8070 
  8069    
  8071     iHitTest = CXnHitTest::NewL();
       
  8072 
       
  8073     iCurrentGraphicsDevice = CCoeEnv::Static()->ScreenDevice();
  8070     iCurrentGraphicsDevice = CCoeEnv::Static()->ScreenDevice();
  8074 
  8071 
  8075     // Update the units here, even the refence client rect is only a quess.
  8072     // Update the units here, even the refence client rect is only a quess.
  8076     // That is because we don't know the UI furniture yet. Units are
  8073     // That is because we don't know the UI furniture yet. Units are
  8077     // needed in controls constructions
  8074     // needed in controls constructions
  8102     iAppUiAdapter.UiStateListener().RemoveObserver( *this );
  8099     iAppUiAdapter.UiStateListener().RemoveObserver( *this );
  8103     
  8100     
  8104     iViewManager.RemoveObserver( *this );
  8101     iViewManager.RemoveObserver( *this );
  8105            
  8102            
  8106     delete iEditMode;
  8103     delete iEditMode;
  8107     delete iHitTest;
       
  8108 
  8104 
  8109     iFocusCandidateList.Reset();
  8105     iFocusCandidateList.Reset();
  8110 
  8106 
  8111     if ( iRedrawRegions.Count() )
  8107     if ( iRedrawRegions.Count() )
  8112         {
  8108         {
  8289                         }
  8285                         }
  8290                     if ( adapter->Rect() != rect )
  8286                     if ( adapter->Rect() != rect )
  8291                         {
  8287                         {
  8292                         AddToRedrawListL( node, rect );
  8288                         AddToRedrawListL( node, rect );
  8293                         
  8289                         
  8294                         adapter->SetRect( rect );
  8290                         // popup calculates its position based on _s60-position-hint property
       
  8291                         if( node->Type()->Type() == KPopUpNodeName )
       
  8292                             {
       
  8293                             adapter->DoHandlePropertyChangeL();
       
  8294                             }
       
  8295                         else
       
  8296                             {
       
  8297                             adapter->SetRect( rect );                        
       
  8298                             }
  8295                         CXnProperty* prop = node->GetPropertyL(
  8299                         CXnProperty* prop = node->GetPropertyL(
  8296                             XnPropertyNames::common::KSizeAware );
  8300                             XnPropertyNames::common::KSizeAware );
  8297                         if ( prop && prop->StringValue() ==
  8301                         if ( prop && prop->StringValue() ==
  8298                              XnPropertyNames::KTrue )
  8302                              XnPropertyNames::KTrue )
  8299                             {
  8303                             {
  9667         }
  9671         }
  9668     iLayoutControl &= ~XnLayoutControl::EIgnoreState;
  9672     iLayoutControl &= ~XnLayoutControl::EIgnoreState;
  9669     }
  9673     }
  9670 
  9674 
  9671 // -----------------------------------------------------------------------------
  9675 // -----------------------------------------------------------------------------
  9672 // CXnUiEngineImpl::HitTest
       
  9673 // -----------------------------------------------------------------------------
       
  9674 //
       
  9675 CXnHitTest& CXnUiEngineImpl::HitTest() const
       
  9676     {
       
  9677     return *iHitTest;
       
  9678     }
       
  9679 
       
  9680 // -----------------------------------------------------------------------------
       
  9681 // CXnUiEngineImpl::GetThemeResource
  9676 // CXnUiEngineImpl::GetThemeResource
  9682 // -----------------------------------------------------------------------------
  9677 // -----------------------------------------------------------------------------
  9683 //
  9678 //
  9684 TInt CXnUiEngineImpl::GetThemeResource( const TDesC& aPath, RFile& aFile )
  9679 TInt CXnUiEngineImpl::GetThemeResource( const TDesC& aPath, RFile& aFile )
  9685     {
  9680     {
  9880 // -----------------------------------------------------------------------------
  9875 // -----------------------------------------------------------------------------
  9881 // CXnUiEngineImpl::HandlePartialTouchInputL()
  9876 // CXnUiEngineImpl::HandlePartialTouchInputL()
  9882 // -----------------------------------------------------------------------------
  9877 // -----------------------------------------------------------------------------
  9883 void CXnUiEngineImpl::HandlePartialTouchInputL( CXnNode& aNode, TBool aEnable )
  9878 void CXnUiEngineImpl::HandlePartialTouchInputL( CXnNode& aNode, TBool aEnable )
  9884     {
  9879     {
       
  9880     CXnNode* editorplugin = FindPlugin( aNode );
       
  9881     if ( !editorplugin )
       
  9882         {
       
  9883         User::Leave( KErrNotFound );
       
  9884         }
       
  9885     
  9885     DisableRenderUiLC();
  9886     DisableRenderUiLC();
  9886     CXnNode* editorplugin = FindPlugin( aNode );
  9887 
  9887 
  9888     if ( aEnable )    
  9888     if ( aEnable ) 
       
  9889     
       
  9890         {        
  9889         {        
  9891         iSplitScreenState.iPartialScreenOpen = ETrue;           
  9890         iSplitScreenState.iPartialScreenOpen = ETrue;           
  9892         iSplitScreenState.iPartialScreenEditorNode = &aNode;           
  9891         iSplitScreenState.iPartialScreenEditorNode = &aNode;           
  9893 
  9892 
  9894         // make sure that we always get up event
  9893         // make sure that we always get up event
  9895         CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(  
  9894         CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(  
  9896             iViewManager.ActiveViewData().ViewNode()->Control() );            
  9895             iViewManager.ActiveViewData().ViewNode()->Control() );            
  9897                    
  9896                    
  9898         control->ResetGrabbing();  
  9897         control->ResetGrabbing();  
       
  9898          
       
  9899         // Block progression must be bottom-to-top when partial screen is open
       
  9900         // Previous value needs to be stored first
       
  9901         CXnProperty* prop( 
       
  9902                 editorplugin->Parent()->GetPropertyL( 
       
  9903                         XnPropertyNames::style::common::KBlockProgression ) );                
       
  9904         if ( prop )
       
  9905             {
       
  9906             iSplitScreenState.iPartialScreenBlock = &prop->StringValue();
       
  9907             }
       
  9908         else
       
  9909             {
       
  9910             iSplitScreenState.iPartialScreenBlock = 
       
  9911                     &XnPropertyNames::style::common::block_progression::KTB();
       
  9912             }
       
  9913 
       
  9914         SetPartialScreenBlockProgressionL( 
       
  9915                 editorplugin->Parent(), 
       
  9916                 XnPropertyNames::style::common::block_progression::KBT );
  9899 
  9917 
  9900         // Hide all plugins except the one that contains given editor node
  9918         // Hide all plugins except the one that contains given editor node
  9901         RPointerArray< CXnNode >& plugins( *Plugins() );                   
  9919         RPointerArray< CXnNode >& plugins( *Plugins() );                   
  9902         for( TInt i=0; i<plugins.Count(); i++ )
  9920         for( TInt i=0; i<plugins.Count(); i++ )
  9903              {         
  9921              {         
  9905              if ( pluginNode != editorplugin )
  9923              if ( pluginNode != editorplugin )
  9906                 {
  9924                 {
  9907                 SetNodeVisibleL(pluginNode, EFalse);
  9925                 SetNodeVisibleL(pluginNode, EFalse);
  9908                 }      
  9926                 }      
  9909              }
  9927              }
  9910          
       
  9911         // Block progression must be bottom-to-top when partial screen is open
       
  9912         // Previous value needs to be stored first
       
  9913         StorePartialScreenBlockProgressionL();
       
  9914            
       
  9915         SetPartialScreenBlockProgressionL( 
       
  9916             XnPropertyNames::style::common::block_progression::KBT );
       
  9917         
  9928         
  9918         // Hide statuspane
  9929         // Hide statuspane
  9919         iAppUiAdapter.StatusPane()->MakeVisible( EFalse );
  9930         iAppUiAdapter.StatusPane()->MakeVisible( EFalse );
  9920         } 
  9931         } 
  9921      
  9932      
  9922     else
  9933     else
  9923         { 
  9934         { 
  9924         // Show plugin nodes again
  9935         // Show plugin nodes again
  9925         RPointerArray< CXnNode >& plugins( *Plugins() );                   
  9936         RPointerArray< CXnNode >& plugins( *Plugins() );
  9926 
  9937 
  9927         for( TInt i=0; i<plugins.Count(); i++ )
  9938         for( TInt i=0; i<plugins.Count(); i++ )
  9928            {           
  9939            {           
  9929            CXnNode* pluginNode = plugins[i];               
  9940            CXnNode* pluginNode = plugins[i];
  9930            
  9941            
  9931            if ( pluginNode != editorplugin )
  9942            if ( pluginNode != editorplugin )
  9932                 {
  9943                 {
  9933                 SetNodeVisibleL(pluginNode, ETrue);
  9944                 SetNodeVisibleL(pluginNode, ETrue);
  9934                 }           
  9945                 }
  9935            }
  9946            }
  9936             
  9947 
  9937         if( iSplitScreenState.iPartialScreenBlock == NULL )
  9948         SetPartialScreenBlockProgressionL( 
  9938             {
  9949                 editorplugin->Parent(),
  9939             SetPartialScreenBlockProgressionL( 
  9950                 *iSplitScreenState.iPartialScreenBlock );
  9940                         XnPropertyNames::style::common::block_progression::KTB );
       
  9941             }
       
  9942         else
       
  9943             {
       
  9944             SetPartialScreenBlockProgressionL(iSplitScreenState.iPartialScreenBlock->Des());
       
  9945             delete iSplitScreenState.iPartialScreenBlock; 
       
  9946             iSplitScreenState.iPartialScreenBlock = NULL;
       
  9947             }
       
  9948         
  9951         
       
  9952         iSplitScreenState.iPartialScreenBlock = NULL;
  9949         iSplitScreenState.iPartialScreenEditorNode = NULL;
  9953         iSplitScreenState.iPartialScreenEditorNode = NULL;
  9950         iSplitScreenState.iPartialScreenOpen = EFalse;
  9954         iSplitScreenState.iPartialScreenOpen = EFalse;
  9951                  
  9955                  
  9952         // Show statuspane again
  9956         // Show statuspane again
  9953         iAppUiAdapter.StatusPane()->MakeVisible(ETrue);
  9957         iAppUiAdapter.StatusPane()->MakeVisible(ETrue);
 10094     }
 10098     }
 10095 
 10099 
 10096 // -----------------------------------------------------------------------------
 10100 // -----------------------------------------------------------------------------
 10097 // SetPartialScreenBlockProgressionL
 10101 // SetPartialScreenBlockProgressionL
 10098 // -----------------------------------------------------------------------------
 10102 // -----------------------------------------------------------------------------
 10099 void CXnUiEngineImpl::SetPartialScreenBlockProgressionL( const TDesC8& aBlockProgression )
 10103 void CXnUiEngineImpl::SetPartialScreenBlockProgressionL( 
 10100     {
 10104         CXnNode* aParent, const TDesC8& aBlockProgression )
 10101     CXnNode* plugin = FindPlugin( *iSplitScreenState.iPartialScreenEditorNode );
 10105     {
 10102     CXnNode* parent( NULL );    
 10106     CXnDomStringPool* sp( iUiEngine->ODT()->DomDocument().StringPool());
 10103     if( plugin )
 10107     if( aParent && sp )
 10104         {
 10108         {        
 10105         parent = plugin->Parent();
       
 10106         }
       
 10107     
       
 10108     CXnDomStringPool* sp( iUiEngine->ODT()->DomDocument().StringPool());   
       
 10109     if(parent)
       
 10110         {
       
 10111         CXnProperty* block_progression = CXnProperty::NewL(
 10109         CXnProperty* block_progression = CXnProperty::NewL(
 10112         XnPropertyNames::style::common::KBlockProgression,
 10110                 XnPropertyNames::style::common::KBlockProgression,
 10113         aBlockProgression,
 10111                 aBlockProgression,
 10114         CXnDomPropertyValue::EString, *sp );
 10112                 CXnDomPropertyValue::EString, *sp );
 10115         
 10113         if ( block_progression )
 10116         CleanupStack::PushL( block_progression );            
 10114             {
 10117         parent->SetPropertyL(block_progression);            
 10115             CleanupStack::PushL( block_progression );            
 10118         CleanupStack::Pop( block_progression );
 10116             aParent->SetPropertyL(block_progression);            
 10119         }
 10117             CleanupStack::Pop( block_progression );
 10120     }
 10118             }
 10121 
 10119         }
 10122 // -----------------------------------------------------------------------------
       
 10123 // SetPartialScreenBlockProgressionL
       
 10124 // -----------------------------------------------------------------------------
       
 10125 void CXnUiEngineImpl::StorePartialScreenBlockProgressionL()
       
 10126     {    
       
 10127     CXnNode* parent = iSplitScreenState.iPartialScreenEditorNode->Parent();
       
 10128     
       
 10129     if(parent)
       
 10130         {
       
 10131         CXnProperty* blocProgressionProperty( 
       
 10132           parent->GetPropertyL( XnPropertyNames::style::common::KBlockProgression ) );               
       
 10133         if ( !blocProgressionProperty )
       
 10134             {
       
 10135             User::Leave( KErrNotFound );
       
 10136             }
       
 10137         HBufC* blocProgressionValue (blocProgressionProperty->StringValueL());
       
 10138         if ( !blocProgressionValue )
       
 10139             {
       
 10140             User::Leave( KErrNotFound );
       
 10141             }
       
 10142         CleanupStack::PushL( blocProgressionValue );
       
 10143         if(iSplitScreenState.iPartialScreenBlock)
       
 10144             {
       
 10145             delete iSplitScreenState.iPartialScreenBlock;
       
 10146             iSplitScreenState.iPartialScreenBlock = NULL;
       
 10147             }
       
 10148         iSplitScreenState.iPartialScreenBlock =
       
 10149                 CnvUtfConverter::ConvertFromUnicodeToUtf8L(blocProgressionValue->Des() );
       
 10150         CleanupStack::PopAndDestroy( blocProgressionValue );
       
 10151         }    
       
 10152     }
 10120     }
 10153 
 10121 
 10154 // -----------------------------------------------------------------------------
 10122 // -----------------------------------------------------------------------------
 10155 // isPartialInputActive
 10123 // isPartialInputActive
 10156 // -----------------------------------------------------------------------------
 10124 // -----------------------------------------------------------------------------