9245 // Mark node to dirty list for relayout |
9245 // Mark node to dirty list for relayout |
9246 // ----------------------------------------------------------------------------- |
9246 // ----------------------------------------------------------------------------- |
9247 // |
9247 // |
9248 void CXnUiEngineImpl::AddToDirtyListL( CXnNode* aNode ) |
9248 void CXnUiEngineImpl::AddToDirtyListL( CXnNode* aNode ) |
9249 { |
9249 { |
9250 CXnNode* nodeToRedrawList( aNode ); |
9250 |
9251 CXnNode* nodeToDirtyList( aNode ); |
9251 if ( aNode ) |
9252 |
9252 { |
9253 if ( aNode == RootNode() ) |
9253 CXnNode* nodeToRedrawList( aNode ); |
9254 { |
9254 CXnNode* nodeToDirtyList( aNode ); |
9255 // Force relayout and redraw from current view |
9255 |
9256 iDirtyList.Reset(); |
9256 if ( aNode == RootNode() ) |
9257 iDirtyList.AppendL( iCurrentView ); |
9257 { |
9258 TXnDirtyRegion* dirtyRegion = FindDirtyRegionL( *iCurrentView ); |
9258 // Force relayout and redraw from current view |
9259 if( dirtyRegion ) |
9259 iDirtyList.Reset(); |
9260 { |
9260 iDirtyList.AppendL( iCurrentView ); |
9261 dirtyRegion->iRegion.Clear(); |
9261 TXnDirtyRegion* dirtyRegion = FindDirtyRegionL( *iCurrentView ); |
9262 } |
9262 if( dirtyRegion ) |
9263 iLayoutControl |= XnLayoutControl::EViewDirty; |
9263 { |
9264 nodeToDirtyList = nodeToRedrawList = iCurrentView; |
9264 dirtyRegion->iRegion.Clear(); |
9265 nodeToDirtyList->ClearRenderedAndLaidOut(); |
9265 } |
9266 |
9266 iLayoutControl |= XnLayoutControl::EViewDirty; |
9267 // Add to draw list for redraw |
9267 nodeToDirtyList = nodeToRedrawList = iCurrentView; |
9268 AddToRedrawListL( nodeToRedrawList ); |
|
9269 } |
|
9270 else |
|
9271 { |
|
9272 if ( !IsAbsoluteL( *aNode ) && !IsNodeTooltip( *aNode ) ) |
|
9273 { |
|
9274 // Check adaptives in normal flow |
|
9275 CXnNode* oldest( NULL ); |
|
9276 CXnNode* adaptive( aNode ); |
|
9277 |
|
9278 if ( !aNode->IsAdaptive( ETrue ) ) |
|
9279 { |
|
9280 adaptive = aNode->Parent(); |
|
9281 } |
|
9282 |
|
9283 for ( ; adaptive && adaptive->IsAdaptive( ETrue ); |
|
9284 adaptive = adaptive->Parent() ) |
|
9285 { |
|
9286 oldest = adaptive; |
|
9287 } |
|
9288 |
|
9289 // Now we have found the oldest adaptive node if present |
|
9290 if ( oldest ) |
|
9291 { |
|
9292 nodeToRedrawList = nodeToDirtyList = adaptive; |
|
9293 } |
|
9294 } |
|
9295 |
|
9296 RPointerArray< CXnNode > dirtyList; |
|
9297 CleanupClosePushL( dirtyList ); |
|
9298 TInt count( iDirtyList.Count() ); |
|
9299 TBool found; |
|
9300 |
|
9301 // first, check that aNode's children are not in the dirty array |
|
9302 for ( TInt i = 0; i < count; ++i ) |
|
9303 { |
|
9304 found = EFalse; |
|
9305 CXnNode* candidate( iDirtyList[i] ); |
|
9306 |
|
9307 for ( CXnNode* node = candidate->Parent(); node && !found; |
|
9308 node = node->Parent() ) |
|
9309 { |
|
9310 if ( nodeToDirtyList == node ) |
|
9311 { |
|
9312 found = ETrue; |
|
9313 } |
|
9314 } |
|
9315 |
|
9316 if ( !found ) |
|
9317 { |
|
9318 // Put candidate back to list as child is not found |
|
9319 dirtyList.AppendL( candidate ); |
|
9320 } |
|
9321 } |
|
9322 |
|
9323 found = EFalse; |
|
9324 |
|
9325 // second, check that aNode's parent is not in dirty array |
|
9326 for ( TInt i = 0; i < count && !found; ++i ) |
|
9327 { |
|
9328 CXnNode* candidate( iDirtyList[i] ); |
|
9329 |
|
9330 for ( CXnNode* node = nodeToDirtyList; node && !found; |
|
9331 node = node->Parent() ) |
|
9332 { |
|
9333 if ( node == candidate ) |
|
9334 { |
|
9335 found = ETrue; |
|
9336 } |
|
9337 } |
|
9338 } |
|
9339 |
|
9340 if ( !found && iDirtyList.Find( nodeToDirtyList ) == KErrNotFound ) |
|
9341 { |
|
9342 // Add node to dirty list as parent is neither found |
|
9343 dirtyList.AppendL( nodeToDirtyList ); |
|
9344 nodeToDirtyList->ClearRenderedAndLaidOut(); |
9268 nodeToDirtyList->ClearRenderedAndLaidOut(); |
9345 |
9269 |
9346 // Add to draw list for redraw |
9270 // Add to draw list for redraw |
9347 AddToRedrawListL( nodeToRedrawList ); |
9271 AddToRedrawListL( nodeToRedrawList ); |
9348 } |
9272 } |
9349 |
9273 else |
9350 // finally update the dirty list |
9274 { |
9351 iDirtyList.Reset(); |
9275 if ( !IsAbsoluteL( *aNode ) && !IsNodeTooltip( *aNode ) ) |
9352 iDirtyList = dirtyList; |
9276 { |
9353 |
9277 // Check adaptives in normal flow |
9354 CleanupStack::Pop( &dirtyList ); |
9278 CXnNode* oldest( NULL ); |
|
9279 CXnNode* adaptive( aNode ); |
|
9280 |
|
9281 if ( !aNode->IsAdaptive( ETrue ) ) |
|
9282 { |
|
9283 adaptive = aNode->Parent(); |
|
9284 } |
|
9285 |
|
9286 for ( ; adaptive && adaptive->IsAdaptive( ETrue ); |
|
9287 adaptive = adaptive->Parent() ) |
|
9288 { |
|
9289 oldest = adaptive; |
|
9290 } |
|
9291 |
|
9292 // Now we have found the oldest adaptive node if present |
|
9293 if ( oldest ) |
|
9294 { |
|
9295 nodeToRedrawList = nodeToDirtyList = adaptive; |
|
9296 } |
|
9297 } |
|
9298 |
|
9299 RPointerArray< CXnNode > dirtyList; |
|
9300 CleanupClosePushL( dirtyList ); |
|
9301 TInt count( iDirtyList.Count() ); |
|
9302 TBool found; |
|
9303 |
|
9304 // first, check that aNode's children are not in the dirty array |
|
9305 for ( TInt i = 0; i < count; ++i ) |
|
9306 { |
|
9307 found = EFalse; |
|
9308 CXnNode* candidate( iDirtyList[i] ); |
|
9309 |
|
9310 for ( CXnNode* node = candidate->Parent(); node && !found; |
|
9311 node = node->Parent() ) |
|
9312 { |
|
9313 if ( nodeToDirtyList == node ) |
|
9314 { |
|
9315 found = ETrue; |
|
9316 } |
|
9317 } |
|
9318 |
|
9319 if ( !found ) |
|
9320 { |
|
9321 // Put candidate back to list as child is not found |
|
9322 dirtyList.AppendL( candidate ); |
|
9323 } |
|
9324 } |
|
9325 |
|
9326 found = EFalse; |
|
9327 |
|
9328 // second, check that aNode's parent is not in dirty array |
|
9329 for ( TInt i = 0; i < count && !found; ++i ) |
|
9330 { |
|
9331 CXnNode* candidate( iDirtyList[i] ); |
|
9332 |
|
9333 for ( CXnNode* node = nodeToDirtyList; node && !found; |
|
9334 node = node->Parent() ) |
|
9335 { |
|
9336 if ( node == candidate ) |
|
9337 { |
|
9338 found = ETrue; |
|
9339 } |
|
9340 } |
|
9341 } |
|
9342 |
|
9343 if ( !found && iDirtyList.Find( nodeToDirtyList ) == KErrNotFound ) |
|
9344 { |
|
9345 // Add node to dirty list as parent is neither found |
|
9346 dirtyList.AppendL( nodeToDirtyList ); |
|
9347 nodeToDirtyList->ClearRenderedAndLaidOut(); |
|
9348 |
|
9349 // Add to draw list for redraw |
|
9350 AddToRedrawListL( nodeToRedrawList ); |
|
9351 } |
|
9352 |
|
9353 // finally update the dirty list |
|
9354 iDirtyList.Reset(); |
|
9355 iDirtyList = dirtyList; |
|
9356 |
|
9357 CleanupStack::Pop( &dirtyList ); |
|
9358 } |
9355 } |
9359 } |
9356 } |
9360 } |
9357 |
9361 |
9358 // ----------------------------------------------------------------------------- |
9362 // ----------------------------------------------------------------------------- |
9359 // CXnUiEngineImpl::SetClientRectL |
9363 // CXnUiEngineImpl::SetClientRectL |