예제 #1
0
파일: DockBase.cpp 프로젝트: MegaThorx/GWEN
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;
}
예제 #2
0
파일: DockBase.cpp 프로젝트: 20-sim/bullet3
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;
}