MCPcopy Create free account
hub / github.com/MITK/MITK / PaneDragStart

Method PaneDragStart

Plugins/org.blueberry.ui.qt/src/internal/berryPartStack.cpp:1493–1550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1491}
1492
1493void PartStack::PaneDragStart(PartPane::Pointer pane, QPoint& initialLocation,
1494 bool keyboard)
1495{
1496 if (pane == 0)
1497 {
1498 if (this->CanMoveFolder())
1499 {
1500 if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED)
1501 {
1502 // Calculate where the initial location was BEFORE the 'restore'...as a percentage
1503 QRect bounds = Geometry::ToDisplay(this->GetParent(),
1504 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
1505 float xpct = (initialLocation.x() - bounds.x()) / (float)(bounds.width());
1506 float ypct = (initialLocation.y() - bounds.y()) / (float)(bounds.height());
1507
1508 // Only restore if we're dragging views/view stacks
1509 if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
1510 this->SetState(IStackPresentationSite::STATE_RESTORED);
1511
1512 // Now, adjust the initial location to be within the bounds of the restored rect
1513 bounds = Geometry::ToDisplay(this->GetParent(),
1514 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
1515 initialLocation.setX((int) (bounds.x() + (xpct * bounds.width())));
1516 initialLocation.setY((int) (bounds.y() + (ypct * bounds.height())));
1517 }
1518
1519 DragUtil::PerformDrag(Object::Pointer(this), Geometry::ToDisplay(this->GetParent(),
1520 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())),
1521 initialLocation, !keyboard);
1522 }
1523 }
1524 else
1525 {
1526 if (presentationSite->GetState() == IStackPresentationSite::STATE_MAXIMIZED)
1527 {
1528 // Calculate where the initial location was BEFORE the 'restore'...as a percentage
1529 QRect bounds = Geometry::ToDisplay(this->GetParent(),
1530 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
1531 float xpct = (initialLocation.x() - bounds.x()) / (float)(bounds.width());
1532 float ypct = (initialLocation.y() - bounds.y()) / (float)(bounds.height());
1533
1534 // Only restore if we're dragging views/view stacks
1535 if (this->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR)
1536 this->SetState(IStackPresentationSite::STATE_RESTORED);
1537
1538 // Now, adjust the initial location to be within the bounds of the restored rect
1539 // See bug 100908
1540 bounds = Geometry::ToDisplay(this->GetParent(),
1541 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl()));
1542 initialLocation.setX((int) (bounds.x() + (xpct * bounds.width())));
1543 initialLocation.setY((int) (bounds.y() + (ypct * bounds.height())));
1544 }
1545
1546 DragUtil::PerformDrag(pane, Geometry::ToDisplay(this->GetParent(),
1547 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetBounds(this->GetPresentation()->GetControl())),
1548 initialLocation, !keyboard);
1549 }
1550}

Callers 1

DragStartMethod · 0.95

Calls 9

CanMoveFolderMethod · 0.95
GetParentMethod · 0.95
GetPresentationMethod · 0.95
GetAppearanceMethod · 0.95
GetFunction · 0.70
GetStateMethod · 0.45
GetBoundsMethod · 0.45
GetControlMethod · 0.45
SetStateMethod · 0.45

Tested by

no test coverage detected