aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJohannes Schickel2009-01-02 02:48:06 +0000
committerJohannes Schickel2009-01-02 02:48:06 +0000
commit1b41a49fc55c1b6348f4bdcc59441a5c05a723ae (patch)
tree72b0ac76f1bae02f6c900e9f847ecbb0d23846f0 /gui
parent826094426073e69a6aa9ba377f4848d0314cde6c (diff)
downloadscummvm-rg350-1b41a49fc55c1b6348f4bdcc59441a5c05a723ae.tar.gz
scummvm-rg350-1b41a49fc55c1b6348f4bdcc59441a5c05a723ae.tar.bz2
scummvm-rg350-1b41a49fc55c1b6348f4bdcc59441a5c05a723ae.zip
Modified the way button highlights are processed when a widget is in dragging mode. This allows for example unhighlighting of a button when the user clicked on it but moved the mouse away.
svn-id: r35666
Diffstat (limited to 'gui')
-rw-r--r--gui/dialog.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 9fd9d19fac..0cead248c9 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -250,9 +250,6 @@ void Dialog::handleKeyUp(Common::KeyState state) {
void Dialog::handleMouseMoved(int x, int y, int button) {
Widget *w;
- //if (!button)
- // _dragWidget = 0;
-
if (_focusedWidget && !_dragWidget) {
w = _focusedWidget;
int wx = w->getAbsX() - _x;
@@ -271,27 +268,38 @@ void Dialog::handleMouseMoved(int x, int y, int button) {
w->handleMouseLeft(button);
}
- w->handleMouseMoved(x - wx, y - wy, button);
+ if (w->getFlags() & WIDGET_TRACK_MOUSE)
+ w->handleMouseMoved(x - wx, y - wy, button);
}
- // While a "drag" is in process (i.e. mouse is moved while a button is pressed),
- // only deal with the widget in which the click originated.
- if (_dragWidget)
- w = _dragWidget;
- else
+ // We process mouseEntered/Left events if we don't have any
+ // currently active dragged widget or if the currently dragged widget
+ // does not want to be informed about the mouse mouse events.
+ if (!_dragWidget || !(_dragWidget->getFlags() & WIDGET_TRACK_MOUSE))
w = findWidget(x, y);
+ else
+ w = _dragWidget;
if (_mouseWidget != w) {
if (_mouseWidget)
_mouseWidget->handleMouseLeft(button);
+
+ // If we have a widget in drag mode we prevent mouseEntered
+ // events from being sent to other widgets.
+ if (_dragWidget && w != _dragWidget)
+ w = 0;
+
if (w)
w->handleMouseEntered(button);
_mouseWidget = w;
}
- if (w && (w->getFlags() & WIDGET_TRACK_MOUSE)) {
+ // We only sent mouse move events under the following conditions:
+ // 1) We have a widget in drag mode
+ // 2) The widget wants to track the mouse movement
+ w = _dragWidget;
+ if (w && (w->getFlags() & WIDGET_TRACK_MOUSE))
w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button);
- }
}
void Dialog::handleTickle() {