diff options
Diffstat (limited to 'src/DragWidget.cpp')
-rw-r--r-- | src/DragWidget.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/DragWidget.cpp b/src/DragWidget.cpp index 8517b99..d6e495c 100644 --- a/src/DragWidget.cpp +++ b/src/DragWidget.cpp @@ -4,33 +4,47 @@ DragWidget::DragWidget(TQWidget *parent, const char *name, WFlags f) : TQWidget( { dragP=TQPoint(0,0); drag=false; - + locked=false; } + DragWidget::~DragWidget() { - } void DragWidget::mousePressEvent(TQMouseEvent *e) { dragP=e->pos(); gpress=e->globalPos(); + if (locked) + { + return; + } drag=true; - } + void DragWidget::mouseReleaseEvent(TQMouseEvent *) { - drag=false; } + void DragWidget::mouseMoveEvent(TQMouseEvent *e) { - if (!drag) { + if (!drag) + { return; } TQPoint curr(e->globalPos().x()-dragP.x(),e->globalPos().y()-dragP.y()); TQWidget::move(curr); - +} + +void DragWidget::setLocked(bool mode) +{ + locked=mode; +} + +const bool DragWidget::isLocked() const +{ + return locked; } #include "DragWidget.moc" |