aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
authorEugene Sandulenko2019-10-02 20:36:29 +0200
committerEugene Sandulenko2019-10-03 00:05:12 +0200
commit571a455c6a8f3e5b7d2ff1a149c52fa379ec0f7d (patch)
tree2fb4b208c4b9c315e81d46a4a3d1a5687f90d985 /graphics/macgui
parenta843a902075ae118cd7e0ef0a4110e431c350acd (diff)
downloadscummvm-rg350-571a455c6a8f3e5b7d2ff1a149c52fa379ec0f7d.tar.gz
scummvm-rg350-571a455c6a8f3e5b7d2ff1a149c52fa379ec0f7d.tar.bz2
scummvm-rg350-571a455c6a8f3e5b7d2ff1a149c52fa379ec0f7d.zip
GRAPHICS: MACGUI: Close nested submenus on hover
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macmenu.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index aaa86ae5f4..895f097d27 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -826,7 +826,12 @@ bool MacMenu::mouseClick(int x, int y) {
return true;
}
- } else if (_menuActivated && _menustack.size() > 0 && _menustack.back()->bbox.contains(x, y)) {
+ }
+
+ if (!_menuActivated)
+ return false;
+
+ if (_menustack.size() > 0 && _menustack.back()->bbox.contains(x, y)) {
MacMenuSubMenu *it = _menustack.back();
int numSubItem = (y - it->bbox.top) / kMenuDropdownItemHeight;
@@ -836,17 +841,36 @@ bool MacMenu::mouseClick(int x, int y) {
renderSubmenu(it);
_contentIsDirty = true;
}
- } else if (_menuActivated && _activeSubItem != -1) {
+
+ return true;
+ }
+
+ if (_activeSubItem != -1) {
if (_menustack.back()->subitems[_activeSubItem]->submenu != nullptr) {
if (_menustack.back()->subitems[_activeSubItem]->submenu->bbox.contains(x, y)) {
_menustack.push_back(_menustack.back()->subitems[_activeSubItem]->submenu);
_activeSubItem = 0;
+ _contentIsDirty = true;
return true;
}
}
- } else if (_menuActivated && _activeItem != -1) {
+
+ if (_menustack.size() > 1) {
+ if (_menustack[_menustack.size() - 2]->bbox.contains(x, y)) {
+ _menustack.pop_back();
+
+ _activeSubItem = (y - _menustack.back()->bbox.top) / kMenuDropdownItemHeight;
+
+ _contentIsDirty = true;
+
+ return true;
+ }
+ }
+ }
+
+ if (_activeItem != -1) {
_activeSubItem = -1;
if (_menustack.size()) {