bool DockBase::DragAndDrop_HandleDrop( gwen::DragAndDrop::Package* pPackage, int x, int y ) { gwen::Point pPos = CanvasPosToLocal( gwen::Point( x, y ) ); int dir = GetDroppedTabDirection( pPos.x, pPos.y ); DockedTabControl* pAddTo = m_DockedTabControl; if ( dir == Pos::Fill && pAddTo == NULL ) { return false; } if ( dir != Pos::Fill ) { DockBase* pDock = GetChildDock( dir ); pAddTo = pDock->m_DockedTabControl; if ( !m_bDropFar ) { pDock->BringToFront(); } else { pDock->SendToBack(); } } if ( pPackage->name == "TabButtonMove" ) { TabButton* pTabButton = gwen_cast<TabButton> ( DragAndDrop::SourceControl ); if ( !pTabButton ) { return false; } pAddTo->AddPage( pTabButton ); } if ( pPackage->name == "TabWindowMove" ) { DockedTabControl* pTabControl = gwen_cast<DockedTabControl> ( DragAndDrop::SourceControl ); if ( !pTabControl ) { return false; } if ( pTabControl == pAddTo ) { return false; } pTabControl->MoveTabsTo( pAddTo ); } Invalidate(); return true; }
bool DockBase::DragAndDrop_HandleDrop( Gwen::DragAndDrop::Package* pPackage, int x, int y ) { Gwen::Point pPos = CanvasPosToLocal( Gwen::Point( x, y ) ); int dir = GetDroppedTabDirection( pPos.x, pPos.y ); DockedTabControl* pAddTo = m_DockedTabControl; if ( dir == Pos::Fill && pAddTo == NULL ) return false; if ( dir != Pos::Fill ) { DockBase* pDock = GetChildDock( dir ); pAddTo = pDock->m_DockedTabControl; if ( !m_bDropFar ) pDock->BringToFront(); else pDock->SendToBack(); } if ( pPackage->name == "TabButtonMove" ) { TabButton* pTabButton = DragAndDrop::SourceControl->DynamicCastTabButton(); if ( !pTabButton ) return false; AddTabToDock( pTabButton, pAddTo ); } if ( pPackage->name == "TabWindowMove" ) { DockedTabControl* pTabControl = DragAndDrop::SourceControl->DynamicCastDockedTabControl(); if ( !pTabControl ) return false; if ( pTabControl == pAddTo ) return false; pTabControl->MoveTabsTo( pAddTo ); } Invalidate(); return true; }