aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.h
diff options
context:
space:
mode:
authorOri Avtalion2016-03-23 21:24:43 +0200
committerOri Avtalion2016-03-27 23:29:37 +0300
commit031e062252d00fc7e6d930287b6dbd4a845d2a2f (patch)
tree2ba4d9ab80f92e917b761b771c6b138100d07ebc /gui/widget.h
parentc5b8adb370d9d707aee4b00cf1c711dcd7419d17 (diff)
downloadscummvm-rg350-031e062252d00fc7e6d930287b6dbd4a845d2a2f.tar.gz
scummvm-rg350-031e062252d00fc7e6d930287b6dbd4a845d2a2f.tar.bz2
scummvm-rg350-031e062252d00fc7e6d930287b6dbd4a845d2a2f.zip
GUI: Improve handling of button presses while moving the cursor
Keep track of where a mouse press started when deciding how mouse-over and mouse-up should behave. This handles the following situations: 1) If a mouse press starts outside a button (e.g. the UI background), mouse-up inside the button has no effect. Previously, it triggered a button click. 2) If a mouse press starts inside a button, the cursor moves outside of its region, then back inside, the button will show as pressed. Previously, it showed as highlighted instead of pressed.
Diffstat (limited to 'gui/widget.h')
-rw-r--r--gui/widget.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gui/widget.h b/gui/widget.h
index 9891f32b36..7c1437de0a 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -198,7 +198,7 @@ public:
void handleMouseUp(int x, int y, int button, int clickCount);
void handleMouseDown(int x, int y, int button, int clickCount);
- void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
+ void handleMouseEntered(int button) { if (_duringPress) { setFlags(WIDGET_PRESSED); } else { setFlags(WIDGET_HILITED); } draw(); }
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED | WIDGET_PRESSED); draw(); }
void handleTickle();
@@ -211,6 +211,7 @@ public:
protected:
void drawWidget();
void wantTickle(bool tickled);
+ bool _duringPress;
private:
uint32 _lastTime;
};