75 const TInt KXnStackPriorityKeyEventDispatcher = 55; |
76 const TInt KXnStackPriorityKeyEventDispatcher = 55; |
76 const TInt KFocusGrowValue = 3; |
77 const TInt KFocusGrowValue = 3; |
77 |
78 |
78 _LIT8( KBoxNodeName, "box" ); |
79 _LIT8( KBoxNodeName, "box" ); |
79 _LIT8( KButtonNodeName, "button" ); |
80 _LIT8( KButtonNodeName, "button" ); |
80 _LIT8( KWidgetNodeName, "widget" ); |
|
81 _LIT8( KWidgetExtensionNodeName, "widgetextension" ); |
81 _LIT8( KWidgetExtensionNodeName, "widgetextension" ); |
82 _LIT8( KScrollableBoxNodeName, "scrollablebox" ); |
82 _LIT8( KScrollableBoxNodeName, "scrollablebox" ); |
83 _LIT8( KMenuBar, "menubar" ); |
83 _LIT8( KMenuBar, "menubar" ); |
84 _LIT8( KPopUpNodeName, "popup" ); |
84 _LIT8( KPopUpNodeName, "popup" ); |
85 _LIT8( KEditorNodeName, "texteditor" ); |
|
86 |
85 |
87 _LIT8( KPlugin, "plugin" ); |
86 _LIT8( KPlugin, "plugin" ); |
|
87 |
|
88 _LIT8( KSplitScreenEnabledTrigger , "splitscreenenabled" ); |
|
89 _LIT8( KSplitScreenDisabledTrigger, "splitscreendisabled" ); |
|
90 |
88 |
91 |
89 // LOCAL CONSTANTS AND MACROS |
92 // LOCAL CONSTANTS AND MACROS |
90 static const TReal KIntConversionConstant = 0.5; |
93 static const TReal KIntConversionConstant = 0.5; |
91 static const TReal KIntPercentageConstant = |
94 static const TReal KIntPercentageConstant = |
92 static_cast< TReal >( 1 ) / static_cast< TReal >( 100 ); |
95 static_cast< TReal >( 1 ) / static_cast< TReal >( 100 ); |
286 #endif |
289 #endif |
287 |
290 |
288 // ============================= LOCAL FUNCTIONS =============================== |
291 // ============================= LOCAL FUNCTIONS =============================== |
289 |
292 |
290 // ----------------------------------------------------------------------------- |
293 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
|
292 // |
|
293 CXnNode* FindPlugin( CXnNode& aNode ) |
|
294 { |
|
295 CXnNode* pluginNode( NULL ); |
|
296 for( CXnNode* node = &aNode; node; node = node->Parent() ) |
|
297 { |
|
298 if( node->DomNode()->Name() == KPlugin ) |
|
299 { |
|
300 pluginNode = node; |
|
301 break; |
|
302 } |
|
303 } |
|
304 return pluginNode; |
|
305 } |
|
306 |
|
307 // ----------------------------------------------------------------------------- |
|
308 // GrowIfNeeded() |
294 // GrowIfNeeded() |
309 // When a plugin is focused, the focus is a bit bigger than its control |
295 // When a plugin is focused, the focus is a bit bigger than its control |
310 // (this is a hack fix to get focus visible with WRT widgets). |
296 // (this is a hack fix to get focus visible with WRT widgets). |
311 // Therefore we need to check if focused node is a plugin, |
297 // Therefore we need to check if focused node is a plugin, |
312 // or focused node has same size with its plugin, and grow dirty rect accordingly. |
298 // or focused node has same size with its plugin, and grow dirty rect accordingly. |
3181 |
3167 |
3182 if ( !layoutUnderPrevious ) |
3168 if ( !layoutUnderPrevious ) |
3183 { |
3169 { |
3184 TInt width = |
3170 TInt width = |
3185 aNode.BorderRect().Width() + marginLeft + marginRight; |
3171 aNode.BorderRect().Width() + marginLeft + marginRight; |
3186 if ( aColumnMargin < marginLeft ) |
3172 if ( aColumnMargin < marginRight ) |
3187 { |
3173 { |
3188 width -= aColumnMargin; |
3174 width -= aColumnMargin; |
3189 } |
3175 } |
3190 else |
3176 else |
3191 { |
3177 { |
3192 width -= marginLeft; |
3178 width -= marginRight; |
3193 } |
3179 } |
3194 if ( width + aColumnWidth <= aParentRect.Width() ) |
3180 if ( width + aColumnWidth <= aParentRect.Width() ) |
3195 { |
3181 { |
3196 offsety = aParentRect.iTl.iY + marginTop; |
3182 offsety = aParentRect.iTl.iY + marginTop; |
3197 if ( aColumnMargin < marginLeft ) |
3183 if ( aColumnMargin < marginRight ) |
3198 { |
3184 { |
3199 offsetx = aParentRect.iBr.iX - aColumnWidth + |
3185 offsetx = aParentRect.iBr.iX - aColumnWidth + |
3200 aColumnMargin - marginRight - |
3186 aColumnMargin - marginRight - |
3201 aNode.BorderRect().Width(); |
3187 aNode.BorderRect().Width(); |
3202 } |
3188 } |
7096 |
7084 |
7097 CXnProperty* top = aNode.TopL(); |
7085 CXnProperty* top = aNode.TopL(); |
7098 if ( IsPropertyAutoL( *top ) ) |
7086 if ( IsPropertyAutoL( *top ) ) |
7099 { |
7087 { |
7100 TPtrC8 propertyName = top->Property()->Name(); |
7088 TPtrC8 propertyName = top->Property()->Name(); |
7101 autoArray.Append( propertyName ); |
7089 autoArray.AppendL( propertyName ); |
7102 } |
7090 } |
7103 CXnProperty* bottom = aNode.BottomL(); |
7091 CXnProperty* bottom = aNode.BottomL(); |
7104 if ( IsPropertyAutoL( *bottom ) ) |
7092 if ( IsPropertyAutoL( *bottom ) ) |
7105 { |
7093 { |
7106 TPtrC8 propertyName = bottom->Property()->Name(); |
7094 TPtrC8 propertyName = bottom->Property()->Name(); |
7107 autoArray.Append( propertyName ); |
7095 autoArray.AppendL( propertyName ); |
7108 } |
7096 } |
7109 CXnProperty* left = aNode.LeftL(); |
7097 CXnProperty* left = aNode.LeftL(); |
7110 if ( IsPropertyAutoL( *left ) ) |
7098 if ( IsPropertyAutoL( *left ) ) |
7111 { |
7099 { |
7112 TPtrC8 propertyName = left->Property()->Name(); |
7100 TPtrC8 propertyName = left->Property()->Name(); |
7113 autoArray.Append( propertyName ); |
7101 autoArray.AppendL( propertyName ); |
7114 } |
7102 } |
7115 CXnProperty* right = aNode.RightL(); |
7103 CXnProperty* right = aNode.RightL(); |
7116 if ( IsPropertyAutoL( *right ) ) |
7104 if ( IsPropertyAutoL( *right ) ) |
7117 { |
7105 { |
7118 TPtrC8 propertyName = right->Property()->Name(); |
7106 TPtrC8 propertyName = right->Property()->Name(); |
7119 autoArray.Append( propertyName ); |
7107 autoArray.AppendL( propertyName ); |
7120 } |
7108 } |
7121 CXnProperty* width = aNode.WidthL(); |
7109 CXnProperty* width = aNode.WidthL(); |
7122 if ( IsPropertyAutoL( *width ) ) |
7110 if ( IsPropertyAutoL( *width ) ) |
7123 { |
7111 { |
7124 TPtrC8 propertyName = width->Property()->Name(); |
7112 TPtrC8 propertyName = width->Property()->Name(); |
7125 autoArray.Append( propertyName ); |
7113 autoArray.AppendL( propertyName ); |
7126 } |
7114 } |
7127 if ( !width ) |
7115 if ( !width ) |
7128 { |
7116 { |
7129 TPtrC8 propertyName = XnPropertyNames::style::common::KWidth(); |
7117 TPtrC8 propertyName = XnPropertyNames::style::common::KWidth(); |
7130 autoArray.Append( propertyName ); |
7118 autoArray.AppendL( propertyName ); |
7131 } |
7119 } |
7132 CXnProperty* height = aNode.HeightL(); |
7120 CXnProperty* height = aNode.HeightL(); |
7133 if ( IsPropertyAutoL( *height ) ) |
7121 if ( IsPropertyAutoL( *height ) ) |
7134 { |
7122 { |
7135 TPtrC8 propertyName = height->Property()->Name(); |
7123 TPtrC8 propertyName = height->Property()->Name(); |
7136 autoArray.Append( propertyName ); |
7124 autoArray.AppendL( propertyName ); |
7137 } |
7125 } |
7138 if ( !height ) |
7126 if ( !height ) |
7139 { |
7127 { |
7140 TPtrC8 propertyName = XnPropertyNames::style::common::KHeight(); |
7128 TPtrC8 propertyName = XnPropertyNames::style::common::KHeight(); |
7141 autoArray.Append( propertyName ); |
7129 autoArray.AppendL( propertyName ); |
7142 } |
7130 } |
7143 CXnProperty* marginTop = aNode.MarginTopL(); |
7131 CXnProperty* marginTop = aNode.MarginTopL(); |
7144 if ( IsPropertyAutoL( *marginTop ) ) |
7132 if ( IsPropertyAutoL( *marginTop ) ) |
7145 { |
7133 { |
7146 TPtrC8 propertyName = marginTop->Property()->Name(); |
7134 TPtrC8 propertyName = marginTop->Property()->Name(); |
7147 autoArray.Append( propertyName ); |
7135 autoArray.AppendL( propertyName ); |
7148 } |
7136 } |
7149 CXnProperty* marginBottom = aNode.MarginBottomL(); |
7137 CXnProperty* marginBottom = aNode.MarginBottomL(); |
7150 if ( IsPropertyAutoL( *marginBottom ) ) |
7138 if ( IsPropertyAutoL( *marginBottom ) ) |
7151 { |
7139 { |
7152 TPtrC8 propertyName = marginBottom->Property()->Name(); |
7140 TPtrC8 propertyName = marginBottom->Property()->Name(); |
7153 autoArray.Append( propertyName ); |
7141 autoArray.AppendL( propertyName ); |
7154 } |
7142 } |
7155 CXnProperty* marginLeft = aNode.MarginLeftL(); |
7143 CXnProperty* marginLeft = aNode.MarginLeftL(); |
7156 if ( IsPropertyAutoL( *marginLeft ) ) |
7144 if ( IsPropertyAutoL( *marginLeft ) ) |
7157 { |
7145 { |
7158 TPtrC8 propertyName = marginLeft->Property()->Name(); |
7146 TPtrC8 propertyName = marginLeft->Property()->Name(); |
7159 autoArray.Append( propertyName ); |
7147 autoArray.AppendL( propertyName ); |
7160 } |
7148 } |
7161 CXnProperty* marginRight = aNode.MarginRightL(); |
7149 CXnProperty* marginRight = aNode.MarginRightL(); |
7162 if ( IsPropertyAutoL( *marginRight ) ) |
7150 if ( IsPropertyAutoL( *marginRight ) ) |
7163 { |
7151 { |
7164 TPtrC8 propertyName = marginRight->Property()->Name(); |
7152 TPtrC8 propertyName = marginRight->Property()->Name(); |
7165 autoArray.Append( propertyName ); |
7153 autoArray.AppendL( propertyName ); |
7166 } |
7154 } |
7167 |
7155 |
7168 if ( aParentDirection == XnPropertyNames::style::common::direction::KLTR ) |
7156 if ( aParentDirection == XnPropertyNames::style::common::direction::KLTR ) |
7169 { |
7157 { |
7170 if ( aParentBlockProgression == |
7158 if ( aParentBlockProgression == |
7624 TSize size; |
7612 TSize size; |
7625 |
7613 |
7626 if ( count == 0 ) |
7614 if ( count == 0 ) |
7627 { |
7615 { |
7628 TRect parentRect( parent->Rect() ); |
7616 TRect parentRect( parent->Rect() ); |
|
7617 |
7629 if( parent->Control() && parent->Control()->OwnsWindow() ) |
7618 if( parent->Control() && parent->Control()->OwnsWindow() ) |
7630 { |
7619 { |
7631 parentRect = TRect( parentRect.iTl - parent->MarginRect().iTl, parentRect.Size() ); |
7620 parentRect = TRect( parentRect.iTl - parent->MarginRect().iTl, parentRect.Size() ); |
7632 } |
7621 } |
|
7622 |
|
7623 RPointerArray< CXnNode >& siblings( parent->Children() ); |
|
7624 |
|
7625 for ( TInt i = 0; i < siblings.Count(); i++ ) |
|
7626 { |
|
7627 CXnNode* sibling( siblings[i] ); |
|
7628 |
|
7629 if ( sibling == &aNode ) |
|
7630 { |
|
7631 break; |
|
7632 } |
|
7633 |
|
7634 if ( IsNodeDisplayedL( *sibling ) && !sibling->IsDropped() && |
|
7635 !IsAbsoluteL( *sibling ) && !IsNodeTooltip( *sibling ) ) |
|
7636 { |
|
7637 TRect marginRect( sibling->MarginRect() ); |
|
7638 |
|
7639 TInt availableWidth( parentRect.Width() ); |
|
7640 TInt availableHeight( parentRect.Height() ); |
|
7641 |
|
7642 if ( aParentBlockProgression == |
|
7643 XnPropertyNames::style::common::block_progression::KTB || |
|
7644 aParentBlockProgression == |
|
7645 XnPropertyNames::style::common::block_progression::KBT ) |
|
7646 { |
|
7647 availableHeight -= marginRect.Height(); |
|
7648 |
|
7649 if ( availableHeight < 0 ) |
|
7650 { |
|
7651 parentRect.SetHeight( 0 ); |
|
7652 } |
|
7653 else |
|
7654 { |
|
7655 parentRect.SetHeight( availableHeight ); |
|
7656 } |
|
7657 } |
|
7658 else // LR / RL |
|
7659 { |
|
7660 availableWidth -= marginRect.Width(); |
|
7661 |
|
7662 if ( availableWidth < 0 ) |
|
7663 { |
|
7664 parentRect.SetWidth( 0 ); |
|
7665 } |
|
7666 else |
|
7667 { |
|
7668 parentRect.SetWidth( availableWidth ); |
|
7669 } |
|
7670 } |
|
7671 } |
|
7672 } |
|
7673 |
7633 // I don't have any displayed childrens, fix my own size |
7674 // I don't have any displayed childrens, fix my own size |
7634 size = CalculateTotalDimensionsL( aNode, ETrue, EFalse, |
7675 size = CalculateTotalDimensionsL( aNode, ETrue, EFalse, |
7635 parentRect, aGraphicsDevice, aHorizontalUnitInPixels, |
7676 parentRect, aGraphicsDevice, aHorizontalUnitInPixels, |
7636 aVerticalUnitInPixels ); |
7677 aVerticalUnitInPixels ); |
7637 adaptiveHeight = size.iHeight; |
7678 adaptiveHeight = size.iHeight; |
7926 |
7967 |
7927 return node; |
7968 return node; |
7928 } |
7969 } |
7929 |
7970 |
7930 // ----------------------------------------------------------------------------- |
7971 // ----------------------------------------------------------------------------- |
|
7972 // ----------------------------------------------------------------------------- |
|
7973 // |
|
7974 static void ReportScreenDeviceChangedL( const CXnPluginData& aPluginData ) |
|
7975 { |
|
7976 CXnNode* node( NULL ); |
|
7977 |
|
7978 if ( aPluginData.Node() ) |
|
7979 { |
|
7980 node = aPluginData.Node()->LayoutNode(); |
|
7981 } |
|
7982 |
|
7983 if ( !node ) |
|
7984 { |
|
7985 return; |
|
7986 } |
|
7987 |
|
7988 CXnNode* trigger( BuildScreenDeviceChangeTriggerNodeLC( *node->UiEngine() ) ); |
|
7989 |
|
7990 node->ReportXuikonEventL( *trigger ); |
|
7991 |
|
7992 CleanupStack::PopAndDestroy( trigger ); |
|
7993 |
|
7994 RPointerArray< CXnPluginData >& plugins( aPluginData.PluginData() ); |
|
7995 |
|
7996 for( TInt i = 0; i < plugins.Count(); i++ ) |
|
7997 { |
|
7998 ReportScreenDeviceChangedL( *plugins[i] ); |
|
7999 } |
|
8000 } |
|
8001 |
|
8002 // ----------------------------------------------------------------------------- |
7931 // FillFocusCandidatesL |
8003 // FillFocusCandidatesL |
7932 // ----------------------------------------------------------------------------- |
8004 // ----------------------------------------------------------------------------- |
7933 // |
8005 // |
7934 static void FillFocusCandidatesL( CXnNode* aParent, |
8006 static void FillFocusCandidatesL( CXnNode* aParent, |
7935 RPointerArray< CXnNode >& aArray ) |
8007 RPointerArray< CXnNode >& aArray ) |
7983 { |
8055 { |
7984 CXnDepthFirstTreeIterator< CXnNode >* iterator = |
8056 CXnDepthFirstTreeIterator< CXnNode >* iterator = |
7985 CXnDepthFirstTreeIterator< CXnNode >::NewL( *aRootNode ); |
8057 CXnDepthFirstTreeIterator< CXnNode >::NewL( *aRootNode ); |
7986 CleanupStack::PushL( iterator ); |
8058 CleanupStack::PushL( iterator ); |
7987 |
8059 |
7988 RDebug::Print( _L("Xuikon: UI tree:") ); |
8060 RDebug::Print( _L("*** XML UI layout:") ); |
7989 |
8061 |
7990 TBuf8< 256 > debug; |
8062 TBuf8< 512 > debug; |
7991 |
8063 |
7992 TInt level( 0 ); |
8064 TInt level( 0 ); |
7993 |
8065 |
7994 for( CXnNode* node = iterator->Value(); node; |
8066 for( CXnNode* node = iterator->Value(); node; |
7995 node = iterator->NextL() ) |
8067 node = iterator->NextL() ) |
7996 { |
8068 { |
7997 debug = _L8( "Xuikon: " ); |
8069 debug = _L8( "* " ); |
7998 |
|
7999 level = iterator->Level(); |
|
8000 |
|
8001 for ( TInt i = 0; i < level; i++ ) |
|
8002 { |
|
8003 debug.Append( ' ' ); |
|
8004 } |
|
8005 |
8070 |
8006 debug.Append( node->Type()->Type() ); |
8071 debug.Append( node->Type()->Type() ); |
8007 |
8072 |
8008 CXnProperty* id( node->IdL() ); |
8073 CXnProperty* id( node->IdL() ); |
8009 |
8074 |
8010 if ( id ) |
8075 if ( id ) |
8011 { |
8076 { |
8012 debug.Append( _L8( ", id: " ) ); |
8077 debug.Append( _L8( " id=" ) ); |
8013 debug.Append( id->StringValue() ); |
8078 debug.Append( id->StringValue() ); |
8014 } |
8079 } |
8015 |
8080 |
8016 debug.AppendFormat( _L8( ", laidout: %d" ), node->IsLaidOut() ); |
8081 debug.AppendFormat( _L8( " laidout=%d" ), node->IsLaidOut() ); |
8017 debug.AppendFormat( _L8( ", displayed: %d" ), |
8082 debug.AppendFormat( _L8( " displayed=%d" ), |
8018 IsNodeDisplayedL( *node ) ); |
8083 IsNodeDisplayedL( *node ) ); |
8019 |
8084 |
8020 CCoeControl* control( node->Control() ); |
8085 CCoeControl* control( node->Control() ); |
8021 |
8086 |
8022 if ( control ) |
8087 if ( control ) |
8023 { |
8088 { |
8024 TBool visible( control->IsVisible() ); |
8089 TBool visible( control->IsVisible() ); |
8025 TRect rect( control->Rect() ); |
8090 debug.AppendFormat( _L8( " visible=%d" ), visible ); |
8026 TPoint tl( rect.iTl ); |
8091 |
8027 TPoint br( rect.iBr ); |
8092 TRect rect; |
8028 debug.AppendFormat( _L8( ", visible %d:" ), visible ); |
8093 TPoint tl; |
|
8094 TPoint br; |
|
8095 |
|
8096 rect = node->MarginRect(); |
|
8097 tl = rect.iTl; |
|
8098 br = rect.iBr; |
|
8099 |
|
8100 debug.Append( _L8( "; Margin " ) ); |
8029 debug.AppendFormat( |
8101 debug.AppendFormat( |
8030 _L8( ", Tl: %d %d, Br: %d %d" ), tl.iX, tl.iY, br.iX, br.iY ); |
8102 _L8( "tl(%d,%d) br(%d,%d)" ), tl.iX, tl.iY, br.iX, br.iY ); |
|
8103 |
|
8104 rect = node->BorderRect(); |
|
8105 tl = rect.iTl; |
|
8106 br = rect.iBr; |
|
8107 |
|
8108 debug.Append( _L8( "; Border " ) ); |
|
8109 debug.AppendFormat( |
|
8110 _L8( "tl(%d,%d) br(%d,%d)" ), tl.iX, tl.iY, br.iX, br.iY ); |
|
8111 |
|
8112 rect = node->PaddingRect(); |
|
8113 tl = rect.iTl; |
|
8114 br = rect.iBr; |
|
8115 |
|
8116 debug.Append( _L8( "; Padding " ) ); |
|
8117 debug.AppendFormat( |
|
8118 _L8( "tl(%d,%d) br(%d,%d)" ), tl.iX, tl.iY, br.iX, br.iY ); |
|
8119 |
|
8120 rect = node->Rect(); |
|
8121 tl = rect.iTl; |
|
8122 br = rect.iBr; |
|
8123 |
|
8124 debug.Append( _L8( "; Content " ) ); |
|
8125 debug.AppendFormat( |
|
8126 _L8( "tl(%d,%d) br(%d,%d)" ), tl.iX, tl.iY, br.iX, br.iY ); |
|
8127 |
|
8128 if ( control->Rect() != node->BorderRect() ) |
|
8129 { |
|
8130 debug.Append( _L8( "; control rect != rect set by layout algorithm " ) ); |
|
8131 |
|
8132 rect = control->Rect(); |
|
8133 tl = rect.iTl; |
|
8134 br = rect.iBr; |
|
8135 |
|
8136 debug.AppendFormat( |
|
8137 _L8( "tl(%d,%d) br(%d,%d)" ), tl.iX, tl.iY, br.iX, br.iY ); |
|
8138 } |
8031 } |
8139 } |
8032 else |
8140 else |
8033 { |
8141 { |
8034 debug.Append( _L8( ", no control" ) ); |
8142 debug.Append( _L8( ", no control" ) ); |
8035 } |
8143 } |
8186 // Layout is now recalculated |
8294 // Layout is now recalculated |
8187 CleanupStack::PopAndDestroy(); // anonymous |
8295 CleanupStack::PopAndDestroy(); // anonymous |
8188 } |
8296 } |
8189 |
8297 |
8190 // ----------------------------------------------------------------------------- |
8298 // ----------------------------------------------------------------------------- |
|
8299 // CXnUiEngineImpl::LayoutFromNodeL() |
|
8300 // ----------------------------------------------------------------------------- |
|
8301 // |
|
8302 void CXnUiEngineImpl::LayoutFromNodeL( CXnNode& aNode ) |
|
8303 { |
|
8304 PrepareRunLayoutL( aNode ); |
|
8305 |
|
8306 // Run layout until it is fully calculated |
|
8307 do |
|
8308 { |
|
8309 iLayoutPhase = RunLayoutFromNodeL( aNode ); |
|
8310 } |
|
8311 while ( iLayoutPhase != XnLayoutPhase::ENone ); |
|
8312 } |
|
8313 |
|
8314 // ----------------------------------------------------------------------------- |
8191 // PrepareRunLayoutL() |
8315 // PrepareRunLayoutL() |
8192 // Set dropped flags of all nodes in the tree to ENone. |
8316 // Set dropped flags of all nodes in the tree to ENone. |
8193 // ----------------------------------------------------------------------------- |
8317 // ----------------------------------------------------------------------------- |
8194 // |
8318 // |
8195 void CXnUiEngineImpl::PrepareRunLayoutL() |
8319 void CXnUiEngineImpl::PrepareRunLayoutL() |
8208 if ( SetAdaptivesL( *dirty ) ) |
8332 if ( SetAdaptivesL( *dirty ) ) |
8209 { |
8333 { |
8210 // Adaptive node causes measure phase |
8334 // Adaptive node causes measure phase |
8211 iLayoutPhase = XnLayoutPhase::EMeasure; |
8335 iLayoutPhase = XnLayoutPhase::EMeasure; |
8212 } |
8336 } |
|
8337 } |
|
8338 } |
|
8339 } |
|
8340 |
|
8341 // ----------------------------------------------------------------------------- |
|
8342 // PrepareRunLayoutL() |
|
8343 // Set dropped flags of all nodes in the tree to ENone. |
|
8344 // ----------------------------------------------------------------------------- |
|
8345 // |
|
8346 void CXnUiEngineImpl::PrepareRunLayoutL( CXnNode& aNode ) |
|
8347 { |
|
8348 if ( iLayoutPhase == XnLayoutPhase::ENone ) |
|
8349 { |
|
8350 iLayoutPhase = XnLayoutPhase::ELayout; |
|
8351 |
|
8352 CXnNode* dirty( &aNode ); |
|
8353 dirty->ClearRenderedAndLaidOut(); |
|
8354 |
|
8355 // Clear dropped flags recursively |
|
8356 SetNodeDroppedL( *dirty, XnNodeLayout::ENone ); |
|
8357 |
|
8358 if ( SetAdaptivesL( *dirty ) ) |
|
8359 { |
|
8360 // Adaptive node causes measure phase |
|
8361 iLayoutPhase = XnLayoutPhase::EMeasure; |
8213 } |
8362 } |
8214 } |
8363 } |
8215 } |
8364 } |
8216 |
8365 |
8217 // ----------------------------------------------------------------------------- |
8366 // ----------------------------------------------------------------------------- |
8313 CleanupStack::PopAndDestroy( &laidOutList ); |
8462 CleanupStack::PopAndDestroy( &laidOutList ); |
8314 return nextPhase; |
8463 return nextPhase; |
8315 } |
8464 } |
8316 |
8465 |
8317 // ----------------------------------------------------------------------------- |
8466 // ----------------------------------------------------------------------------- |
|
8467 // CXnUiEngineImpl::RunLayoutL() |
|
8468 // ----------------------------------------------------------------------------- |
|
8469 // |
|
8470 TInt CXnUiEngineImpl::RunLayoutFromNodeL( CXnNode& aNode ) |
|
8471 { |
|
8472 TRect clientRect( ClientRect() ); |
|
8473 // Move it to 0, 0 |
|
8474 clientRect.Move( -clientRect.iTl.iX, -clientRect.iTl.iY ); |
|
8475 |
|
8476 RPointerArray< CXnNode > laidOutList; |
|
8477 CleanupClosePushL( laidOutList ); |
|
8478 |
|
8479 if ( IsNodeDisplayedL( aNode ) ) |
|
8480 { |
|
8481 if ( aNode.ViewNodeImpl() && !aNode.IsLaidOut() ) |
|
8482 { |
|
8483 aNode.SetMarginRect( clientRect ); |
|
8484 aNode.SetBorderRect( clientRect ); |
|
8485 aNode.SetNormalFlowBorderRect( clientRect ); |
|
8486 aNode.SetPaddingRect( clientRect ); |
|
8487 aNode.SetRect( clientRect ); |
|
8488 } |
|
8489 |
|
8490 // Put areas to place |
|
8491 PlaceAreasL( aNode, laidOutList, iLayoutPhase, |
|
8492 *iCurrentGraphicsDevice, iHorizontalUnitInPixels, |
|
8493 iVerticalUnitInPixels ); |
|
8494 } |
|
8495 |
|
8496 TInt nextPhase; |
|
8497 |
|
8498 switch ( iLayoutPhase ) |
|
8499 { |
|
8500 case XnLayoutPhase::EMeasure: |
|
8501 nextPhase = XnLayoutPhase::ELayout; |
|
8502 break; |
|
8503 case XnLayoutPhase::ELayout: |
|
8504 // Layout is now calculated |
|
8505 aNode.SetLaidOutL(); |
|
8506 |
|
8507 // Check nodes which dimensions are changed |
|
8508 for ( TInt i = 0; i < laidOutList.Count(); i++ ) |
|
8509 { |
|
8510 CXnNode* node( laidOutList[i] ); |
|
8511 if( IsSrollableBox( *node ) && node->ScrollableControl() ) |
|
8512 { |
|
8513 node->ScrollableControl()->LayoutChangedL(); |
|
8514 } |
|
8515 if ( !node->IsLaidOut() ) |
|
8516 { |
|
8517 continue; |
|
8518 } |
|
8519 CXnControlAdapter* adapter( node->Control() ); |
|
8520 if ( adapter ) |
|
8521 { |
|
8522 TRect rect; |
|
8523 |
|
8524 if ( node->ViewNodeImpl() ) |
|
8525 { |
|
8526 rect = ClientRect(); |
|
8527 } |
|
8528 else |
|
8529 { |
|
8530 rect = node->BorderRect(); |
|
8531 } |
|
8532 if ( adapter->Rect() != rect ) |
|
8533 { |
|
8534 adapter->SetRect( rect ); |
|
8535 } |
|
8536 } |
|
8537 } |
|
8538 /* flow through */ |
|
8539 default: |
|
8540 nextPhase = XnLayoutPhase::ENone; |
|
8541 break; |
|
8542 } |
|
8543 CleanupStack::PopAndDestroy( &laidOutList ); |
|
8544 return nextPhase; |
|
8545 } |
|
8546 |
|
8547 // ----------------------------------------------------------------------------- |
8318 // CXnUiEngineImpl::RenderUIL() |
8548 // CXnUiEngineImpl::RenderUIL() |
8319 // ----------------------------------------------------------------------------- |
8549 // ----------------------------------------------------------------------------- |
8320 // |
8550 // |
8321 void CXnUiEngineImpl::RenderUIL( CXnNode* /*aNode*/ ) |
8551 void CXnUiEngineImpl::RenderUIL( CXnNode* /*aNode*/ ) |
8322 { |
8552 { |
8401 iLayoutControl &= ~XnLayoutControl::ERenderUI; |
8631 iLayoutControl &= ~XnLayoutControl::ERenderUI; |
8402 |
8632 |
8403 iAppUiAdapter.EffectManager()->UiRendered(); |
8633 iAppUiAdapter.EffectManager()->UiRendered(); |
8404 |
8634 |
8405 __PRINTS("*** CXnUiEngineImpl::RenderUIL - done ***"); |
8635 __PRINTS("*** CXnUiEngineImpl::RenderUIL - done ***"); |
|
8636 } |
|
8637 |
|
8638 // ----------------------------------------------------------------------------- |
|
8639 // CXnUiEngineImpl::RenderFromNodeL() |
|
8640 // ----------------------------------------------------------------------------- |
|
8641 // |
|
8642 void CXnUiEngineImpl::RenderFromNodeL( CXnNode& aNode ) |
|
8643 { |
|
8644 #ifdef _XN3_DEBUG_ |
|
8645 TraceTreeL( &aNode ); |
|
8646 #endif |
|
8647 CCoeControl* control = WindowOwningControl( aNode ); |
|
8648 control->DrawNow(); |
8406 } |
8649 } |
8407 |
8650 |
8408 // ----------------------------------------------------------------------------- |
8651 // ----------------------------------------------------------------------------- |
8409 // CXnUiEngineImpl::RootNode() |
8652 // CXnUiEngineImpl::RootNode() |
8410 // ----------------------------------------------------------------------------- |
8653 // ----------------------------------------------------------------------------- |
8711 static_cast< CXnPopupControlAdapter* > |
8954 static_cast< CXnPopupControlAdapter* > |
8712 ( node->Control() )->SetObserver( *this ); |
8955 ( node->Control() )->SetObserver( *this ); |
8713 } |
8956 } |
8714 } |
8957 } |
8715 |
8958 |
8716 ReportScreenDeviceChangeL(); |
|
8717 |
|
8718 SetClientRectL( iAppUiAdapter.ClientRect(), EFalse ); |
8959 SetClientRectL( iAppUiAdapter.ClientRect(), EFalse ); |
8719 |
8960 |
8720 RootNode()->SetDirtyL(); |
8961 RootNode()->SetDirtyL(); |
8721 |
8962 |
8722 ForceRenderUIL(); |
8963 ForceRenderUIL(); |
8723 |
8964 |
8724 iLayoutControl &= ~XnLayoutControl::ERefreshMenu; |
8965 iLayoutControl &= ~XnLayoutControl::ERefreshMenu; |
8725 } |
8966 } |
8726 |
8967 |
8727 // ----------------------------------------------------------------------------- |
8968 // ----------------------------------------------------------------------------- |
|
8969 // CXnUiEngineImpl::NotifyViewLoadedL() |
|
8970 // ----------------------------------------------------------------------------- |
|
8971 // |
|
8972 void CXnUiEngineImpl::NotifyViewLoadedL( const CXnViewData& aViewData ) |
|
8973 { |
|
8974 ReportScreenDeviceChangedL( aViewData ); |
|
8975 } |
|
8976 |
|
8977 // ----------------------------------------------------------------------------- |
8728 // CXnUiEngineImpl::NotifyWidgetAdditionL() |
8978 // CXnUiEngineImpl::NotifyWidgetAdditionL() |
8729 // ----------------------------------------------------------------------------- |
8979 // ----------------------------------------------------------------------------- |
8730 // |
8980 // |
8731 void CXnUiEngineImpl::NotifyWidgetAdditionL( |
8981 void CXnUiEngineImpl::NotifyWidgetAdditionL( |
8732 const CXnPluginData& /*aPluginData*/ ) |
8982 const CXnPluginData& aPluginData ) |
8733 { |
8983 { |
8734 } |
8984 ReportScreenDeviceChangedL( aPluginData ); |
8735 |
8985 } |
|
8986 |
|
8987 // ----------------------------------------------------------------------------- |
|
8988 // CXnUiEngineImpl::NotifyViewAdditionL() |
|
8989 // ----------------------------------------------------------------------------- |
|
8990 // |
|
8991 void CXnUiEngineImpl::NotifyViewAdditionL( const CXnViewData& aViewData ) |
|
8992 { |
|
8993 ReportScreenDeviceChangedL( aViewData ); |
|
8994 } |
|
8995 |
8736 // ----------------------------------------------------------------------------- |
8996 // ----------------------------------------------------------------------------- |
8737 // CXnUiEngineImpl::DynInitMenuItemL() |
8997 // CXnUiEngineImpl::DynInitMenuItemL() |
8738 // ----------------------------------------------------------------------------- |
8998 // ----------------------------------------------------------------------------- |
8739 // |
8999 // |
8740 TBool CXnUiEngineImpl::DynInitMenuItemL( CXnNodeAppIf& aMenuItem, |
9000 TBool CXnUiEngineImpl::DynInitMenuItemL( CXnNodeAppIf& aMenuItem, |
9846 ); |
10108 ); |
9847 } |
10109 } |
9848 } |
10110 } |
9849 } |
10111 } |
9850 |
10112 |
9851 |
|
9852 // ----------------------------------------------------------------------------- |
10113 // ----------------------------------------------------------------------------- |
9853 // ----------------------------------------------------------------------------- |
10114 // ----------------------------------------------------------------------------- |
9854 // |
10115 // |
9855 void CXnUiEngineImpl::ReportScreenDeviceChangeL() |
10116 void CXnUiEngineImpl::ReportScreenDeviceChangeL() |
9856 { |
10117 { |
9857 CXnNode* trigger( BuildScreenDeviceChangeTriggerNodeLC( *iUiEngine ) ); |
10118 // Notify current orientation to all views |
9858 |
10119 RPointerArray< CXnPluginData >& plugins( |
9859 // Notify current orientation to iCurrentView |
10120 iViewManager.ActiveAppData().PluginData() ); |
9860 iCurrentView->ReportXuikonEventL( *trigger ); |
10121 |
9861 |
10122 for( TInt i = 0; i < plugins.Count(); i++ ) |
9862 // Notify also plugins |
10123 { |
9863 RPointerArray<CXnNode> plugins = *Plugins(); |
10124 ReportScreenDeviceChangedL( *plugins[i] ); |
9864 for( TInt i=0; i<plugins.Count(); i++ ) |
10125 } |
9865 { |
|
9866 CXnNode* pluginNode = plugins[i]; |
|
9867 RPointerArray<CXnNode> pluginChildren = pluginNode->Children(); |
|
9868 for( TInt ii=0; ii<pluginChildren.Count(); ii++ ) |
|
9869 { |
|
9870 CXnDomNode* widgetNode = pluginChildren[ii]->DomNode(); |
|
9871 if( widgetNode && widgetNode->Name() == KWidgetNodeName ) |
|
9872 { |
|
9873 pluginChildren[ii]->ReportXuikonEventL( *trigger ); |
|
9874 } |
|
9875 } |
|
9876 } |
|
9877 |
|
9878 CleanupStack::PopAndDestroy(); // trigger |
|
9879 } |
10126 } |
9880 |
10127 |
9881 // ----------------------------------------------------------------------------- |
10128 // ----------------------------------------------------------------------------- |
9882 // CXnUiEngineImpl::HandlePartialTouchInputL() |
10129 // CXnUiEngineImpl::HandlePartialTouchInputL() |
9883 // ----------------------------------------------------------------------------- |
10130 // ----------------------------------------------------------------------------- |
9884 void CXnUiEngineImpl::HandlePartialTouchInputL( CXnNode& aNode, TBool aEnable ) |
10131 void CXnUiEngineImpl::HandlePartialTouchInputL( CXnNode* aNode, TBool aEnable ) |
9885 { |
10132 { |
9886 CXnNode* editorplugin = FindPlugin( aNode ); |
10133 CXnViewData& view( iViewManager.ActiveViewData() ); |
9887 if ( !editorplugin ) |
10134 |
9888 { |
10135 CXnNode* editor( aEnable ? aNode : iSplitScreenState.iPartialScreenEditorNode ); |
9889 User::Leave( KErrNotFound ); |
10136 |
9890 } |
10137 CXnPluginData* plugin( view.Plugin( editor ) ); |
|
10138 |
|
10139 if ( !plugin || !editor ) |
|
10140 { |
|
10141 return; |
|
10142 } |
|
10143 |
|
10144 CXnNode* editorplugin( plugin->Owner()->LayoutNode() ); |
9891 |
10145 |
9892 DisableRenderUiLC(); |
10146 DisableRenderUiLC(); |
9893 |
10147 |
9894 if ( aEnable ) |
10148 if ( aEnable ) |
9895 { |
10149 { |
9896 iSplitScreenState.iPartialScreenOpen = ETrue; |
10150 iSplitScreenState.iPartialScreenOpen = ETrue; |
9897 iSplitScreenState.iPartialScreenEditorNode = &aNode; |
10151 iSplitScreenState.iPartialScreenEditorNode = editor; |
9898 |
10152 |
9899 // make sure that we always get up event |
10153 // make sure that we always get up event |
9900 CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >( |
10154 CXnViewControlAdapter* control = |
9901 iViewManager.ActiveViewData().ViewNode()->Control() ); |
10155 static_cast< CXnViewControlAdapter* >( view.ViewNode()->Control() ); |
9902 |
10156 |
9903 control->ResetGrabbing(); |
10157 control->ResetGrabbing(); |
9904 |
10158 |
9905 // Block progression must be bottom-to-top when partial screen is open |
10159 // Block progression must be bottom-to-top when partial screen is open |
9906 // Previous value needs to be stored first |
10160 // Previous value needs to be stored first |
9907 CXnProperty* prop( |
10161 CXnProperty* prop( |