Exemple #1
0
void TrackBox::mouseDown (const MouseEvent& e)
{
    //[UserCode_mouseDown] -- Add your code here...
    DragAndDropContainer* dragContainer = DragAndDropContainer::findParentDragContainerFor(this);
    startingDragPositionRelativeToSelf = e.getPosition();
    dragContainer->startDragging ("TrackBox", this);
    //[/UserCode_mouseDown]
}
//=================================================================================================
void SelectableComponent::mouseDrag (const MouseEvent& /*event*/)
{
    DragAndDropContainer* dc = findParentComponentOfClass<DragAndDropContainer>();

    if (dc != nullptr)  // 拖拽时产生的描述为父组件的名称
        dc->startDragging(parent->getName(), this, Image(Image::ARGB, 1, 1, true), true);

    setMouseCursor(MouseCursor::DraggingHandCursor);
}