summaryrefslogtreecommitdiffstats
path: root/src/DragWidget.cpp
diff options
context:
space:
mode:
authorRay-V <ray-v@inbox.lv>2021-02-11 11:37:04 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-02-11 11:37:04 +0900
commit0da79dd6ef5eae251828d32568aedb01240590b3 (patch)
treea41922a2bef3cfc3f112996d35f2fa2ea0ae9a76 /src/DragWidget.cpp
parentd1fca948cfde3b711652e69e03084908facc9f83 (diff)
downloadkvkbd-0da79dd6ef5eae251828d32568aedb01240590b3.tar.gz
kvkbd-0da79dd6ef5eae251828d32568aedb01240590b3.zip
Added 'lock on screen' functionality.
Signed-off-by: Ray-V <ray-v@inbox.lv> Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/DragWidget.cpp')
-rw-r--r--src/DragWidget.cpp26
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"