idlehomescreen/xmluirendering/uiengine/src/xneditmode.cpp
branchRCL_3
changeset 23 7be2816dbabd
parent 18 d05a55b217df
child 26 1b758917cafc
equal deleted inserted replaced
19:79311d856354 23:7be2816dbabd
   381         
   381         
   382         TRAP_IGNORE( appui.HandleEnterEditModeL( EFalse ) );               
   382         TRAP_IGNORE( appui.HandleEnterEditModeL( EFalse ) );               
   383         }
   383         }
   384     
   384     
   385     // Update background
   385     // Update background
   386     appui.ViewAdapter().BgManager().UpdateScreen();
   386     appui.ViewAdapter().BgManager().DrawNow();
   387     }
   387     }
   388 
   388 
   389 // -----------------------------------------------------------------------------
   389 // -----------------------------------------------------------------------------
   390 // CXnEditMode::HandlePointerEventL
   390 // CXnEditMode::HandlePointerEventL
   391 //
   391 //
   504             CXnPluginData* plugin( iUiEngine.ViewManager()->
   504             CXnPluginData* plugin( iUiEngine.ViewManager()->
   505                     ActiveViewData().Plugin( node ) );
   505                     ActiveViewData().Plugin( node ) );
   506             
   506             
   507             if ( plugin && plugin->Occupied() )
   507             if ( plugin && plugin->Occupied() )
   508                 {
   508                 {
   509                 StartDragL( *node );
   509                 StartDragL( *plugin );
   510                                   
   510                                   
   511                 iDrawPos = iDraggingNode->BorderRect().iTl;
   511                 iDrawPos = iDraggingNode->BorderRect().iTl;
   512                 
   512                 
   513                 iStylusDownPos = iPreviousPos = aPointerEvent.iPosition;
   513                 iStylusDownPos = iPreviousPos = aPointerEvent.iPosition;
   514                 }  
   514                 }  
   548             {                        
   548             {                        
   549             // Resolve draw position
   549             // Resolve draw position
   550             TPoint dp( iPreviousPos - aPointerEvent.iPosition );
   550             TPoint dp( iPreviousPos - aPointerEvent.iPosition );
   551                                 
   551                                 
   552             iDrawPos -= dp;
   552             iDrawPos -= dp;
   553                     
   553                                 
   554             // Update previous position
       
   555             iPreviousPos = aPointerEvent.iPosition;
       
   556             
       
   557             UpdateScreen();
   554             UpdateScreen();
   558             }
   555             }
       
   556 
       
   557         // Update previous position
       
   558         iPreviousPos = aPointerEvent.iPosition;        
   559         }
   559         }
   560     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   560     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   561         {
   561         {
   562 #ifdef RD_TACTILE_FEEDBACK                
   562 #ifdef RD_TACTILE_FEEDBACK                
   563         MTouchFeedback* feedback( MTouchFeedback::Instance() );
   563         MTouchFeedback* feedback( MTouchFeedback::Instance() );
   722 // -----------------------------------------------------------------------------
   722 // -----------------------------------------------------------------------------
   723 // CXnEditMode::StartDragL()
   723 // CXnEditMode::StartDragL()
   724 //
   724 //
   725 // -----------------------------------------------------------------------------
   725 // -----------------------------------------------------------------------------
   726 //
   726 //
   727 void CXnEditMode::StartDragL( CXnNode& aNode )
   727 void CXnEditMode::StartDragL( const CXnPluginData& aPlugin  )
   728     {  
   728     {  
   729     CXnControlAdapter* control( aNode.Control() );
   729     CXnNode* node( aPlugin.Owner()->LayoutNode() );
   730         
   730     
       
   731     CXnControlAdapter* control( node->Control() ); 
       
   732             
       
   733     CXnControlAdapter* parent( 
       
   734         aPlugin.Parent()->Node()->LayoutNode()->Control() );
       
   735     
   731     TRect rect( control->Rect() );
   736     TRect rect( control->Rect() );
   732     
   737     
   733     // Clear first with alpha 
   738     // Clear first with alpha 
   734     TRgb rgb( TRgb::Color16MA( 0 ) );
   739     TRgb rgb( TRgb::Color16MA( 0 ) );
   735     rgb.SetAlpha( 64 );
   740     rgb.SetAlpha( 64 );
   737     iMapGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   742     iMapGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   738     
   743     
   739     iMapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
   744     iMapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
   740     iMapGc->SetBrushColor( rgb );
   745     iMapGc->SetBrushColor( rgb );
   741     
   746     
   742     iMapGc->Clear( rect );
   747     iMapGc->Clear();
   743                          
   748                          
   744     iState = CXnEditMode::EShootContent;
   749     iState = CXnEditMode::EShootContent;
   745         
   750         
   746     CWindowGc* gc( control->CustomGc() );
   751     CWindowGc* gc( control->CustomGc() );
   747             
   752             
   748     control->SetCustomGc( iMapGc );
   753     parent->SetCustomGc( iMapGc );
   749 
   754     
   750     TBool focusStateChanged( EFalse );
       
   751     
       
   752     if( aNode.IsStateSet( XnPropertyNames::style::common::KFocus ) )
       
   753         {        
       
   754         aNode.UnsetStateL( XnPropertyNames::style::common::KFocus );
       
   755         focusStateChanged = ETrue;
       
   756         }
       
   757 
       
   758     control->DrawNow( rect );
   755     control->DrawNow( rect );
   759 
   756 
   760     control->SetCustomGc( gc );
   757     parent->SetCustomGc( gc );
   761 
   758        
   762     if( focusStateChanged )
       
   763         {
       
   764         aNode.SetStateL( XnPropertyNames::style::common::KFocus );
       
   765         iUiEngine.RenderUIL( &aNode );
       
   766         }
       
   767 
       
   768     if ( iWidget->SizeInPixels() != rect.Size() )
   759     if ( iWidget->SizeInPixels() != rect.Size() )
   769         {
   760         {
   770         iWidget->Resize( rect.Size() );
   761         iWidget->Resize( rect.Size() );
   771         }
   762         }
   772     
   763     
   773     User::LeaveIfError( CopyBitmap( *iWidget, *iMainpane, rect.iTl ) );
       
   774 
       
   775     iState = CXnEditMode::EDragging;
   764     iState = CXnEditMode::EDragging;
   776         
   765     
   777     iDraggingNode = &aNode;       
   766     iDraggingNode = node;
       
   767     
       
   768     User::LeaveIfError( CopyBitmap( *iWidget, *iMainpane, rect.iTl ) );                   
   778     }
   769     }
   779 
   770 
   780 // -----------------------------------------------------------------------------
   771 // -----------------------------------------------------------------------------
   781 // CXnEditMode::StopDragL()
   772 // CXnEditMode::StopDragL()
   782 // -----------------------------------------------------------------------------
   773 // -----------------------------------------------------------------------------