本文整理汇总了C++中Base::CanvasPosToLocal方法的典型用法代码示例。如果您正苦于以下问题:C++ Base::CanvasPosToLocal方法的具体用法?C++ Base::CanvasPosToLocal怎么用?C++ Base::CanvasPosToLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::CanvasPosToLocal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DragAndDrop_HandleDrop
bool TabStrip::DragAndDrop_HandleDrop(Gwen::DragAndDrop::Package* /*pPackage*/, int x, int y)
{
Gwen::Point LocalPos = CanvasPosToLocal(Gwen::Point(x, y));
Base* el = DragAndDrop::SourceControl;
TabButton* pButton = el ? el->DynamicCastTabButton() : 0;
TabControl* pTabControl = GetParent() ? GetParent()->DynamicCastTabControl() : 0;
if (pTabControl && pButton)
{
if (pButton->GetTabControl() != pTabControl)
{
// We've moved tab controls!
pTabControl->AddPage(pButton);
}
}
Base* DroppedOn = GetControlAt(LocalPos.x, LocalPos.y);
if (DroppedOn)
{
Gwen::Point DropPos = DroppedOn->CanvasPosToLocal(Gwen::Point(x, y));
DragAndDrop::SourceControl->BringNextToControl(DroppedOn, DropPos.x > DroppedOn->Width() / 2);
}
else
{
DragAndDrop::SourceControl->BringToFront();
}
return true;
}
示例2: DragAndDrop_Hover
void TabStrip::DragAndDrop_Hover( gwen::DragAndDrop::Package* /*pPackage*/, int x, int y )
{
gwen::Point LocalPos = CanvasPosToLocal( gwen::Point( x, y ) );
Base* DroppedOn = GetControlAt( LocalPos.x, LocalPos.y );
if ( DroppedOn && DroppedOn != this )
{
gwen::Point DropPos = DroppedOn->CanvasPosToLocal( gwen::Point( x, y ) );
m_TabDragControl->SetBounds( gwen::Rect( 0, 0, 3, Height() ) );
m_TabDragControl->BringToFront();
m_TabDragControl->SetPos( DroppedOn->X() - 1, 0 );
if ( DropPos.x > DroppedOn->Width() / 2 )
{
m_TabDragControl->MoveBy( DroppedOn->Width() - 1, 0 );
}
m_TabDragControl->Dock( Pos::None );
}
else
{
m_TabDragControl->Dock( Pos::Left );
m_TabDragControl->BringToFront();
}
}