aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
authorEugene Sandulenko2019-10-02 19:25:31 +0200
committerEugene Sandulenko2019-10-03 00:05:12 +0200
commit1ced332fdee22366023d6c8f9d8a6825fddc46a8 (patch)
tree91b121d8100d26186c51cb1fe9493b9fbff3e9f4 /graphics/macgui
parent62f186b4996b24451995e7c85ee39bea181cec9d (diff)
downloadscummvm-rg350-1ced332fdee22366023d6c8f9d8a6825fddc46a8.tar.gz
scummvm-rg350-1ced332fdee22366023d6c8f9d8a6825fddc46a8.tar.bz2
scummvm-rg350-1ced332fdee22366023d6c8f9d8a6825fddc46a8.zip
GRAPHICS: MACGUI: Render nested submenus
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macmenu.cpp27
-rw-r--r--graphics/macgui/macmenu.h2
2 files changed, 16 insertions, 13 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 0079cedcb1..b4c1a60abc 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -792,43 +792,46 @@ bool MacMenu::mouseClick(int x, int y) {
if (_bbox.contains(x, y)) {
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->bbox.contains(x, y)) {
- if ((uint)_activeItem == i)
+ if ((uint)_activeItem == i)
return false;
if (_activeItem != -1) { // Restore background
if (_items[_activeItem]->submenu != nullptr) {
- Common::Rect r(_items[_activeItem]->submenu->bbox);
- r.right += 3;
- r.bottom += 3;
-
_wm->setFullRefresh(true);
+
+ _menustack.pop_back(); // Drop previous submenu
}
}
_activeItem = i;
_activeSubItem = -1;
+ if (_items[_activeItem]->submenu != nullptr) {
+ _menustack.push_back(_items[_activeItem]->submenu);
+ }
+
_menuActivated = true;
_contentIsDirty = true;
return true;
}
- } else if (_menuActivated && _items[_activeItem]->submenu != nullptr &&
- _items[_activeItem]->submenu->bbox.contains(x, y)) {
- MacMenuSubMenu *it = _items[_activeItem]->submenu;
+ } else if (_menuActivated && _menustack.size() > 0 && _menustack.back()->bbox.contains(x, y)) {
+ MacMenuSubMenu *it = _menustack.back();
int numSubItem = (y - it->bbox.top) / kMenuDropdownItemHeight;
if (numSubItem != _activeSubItem) {
_activeSubItem = numSubItem;
- renderSubmenu(_items[_activeItem]->submenu);
+ renderSubmenu(it);
_contentIsDirty = true;
}
- } else if (_menuActivated && _activeItem != -1) {
+ } else if (_menuActivated && _activeItem != -1 && _activeSubItem != -1) {
_activeSubItem = -1;
- renderSubmenu(_items[_activeItem]->submenu);
- _contentIsDirty = true;
+ if (_menustack.size()) {
+ renderSubmenu(_menustack.back());
+ _contentIsDirty = true;
+ }
}
return false;
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index 1239cebcd7..208e93d99c 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -117,7 +117,7 @@ private:
bool _isVisible;
int _activeItem;
- Common::Array<int> _menustack;
+ Common::Array<MacMenuSubMenu *> _menustack;
int _activeSubItem;
void (*_ccallback)(int action, Common::String &text, void *data);