From 0da79dd6ef5eae251828d32568aedb01240590b3 Mon Sep 17 00:00:00 2001 From: Ray-V Date: Thu, 11 Feb 2021 11:37:04 +0900 Subject: Added 'lock on screen' functionality. Signed-off-by: Ray-V Signed-off-by: Michele Calgaro --- src/DragWidget.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/DragWidget.cpp') 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" -- cgit v1.2.1