12#include "Draggable_p.h"
13#include "DragController_p.h"
14#include "WidgetResizeHandler_p.h"
17#include "kddockwidgets/core/Platform.h"
18#include "kddockwidgets/core/FloatingWindow.h"
23class Draggable::Private
26 explicit Private(
View *_thisView,
bool _enabled)
33 ObjectGuard<WidgetResizeHandler> widgetResizeHandler;
38Draggable::Draggable(
View *thisView,
bool enabled)
39 : d(new Private(thisView, enabled))
41 if (thisView && d->enabled)
42 DragController::instance()->registerDraggable(
this);
45Draggable::~Draggable()
47 if (d->thisView && d->enabled)
48 DragController::instance()->unregisterDraggable(
this);
50 delete d->widgetResizeHandler;
54View *Draggable::asView()
const
61 if (
auto v = d->thisView)
62 return v->controller();
67bool Draggable::dragCanStart(Point pressPos, Point globalPos)
const
72void Draggable::setWidgetResizeHandler(WidgetResizeHandler *w)
74 assert(!d->widgetResizeHandler);
76 d->widgetResizeHandler = w;
79bool Draggable::isInProgrammaticDrag()
const
81 return DragController::instance()->isInProgrammaticDrag();