From a843a902075ae118cd7e0ef0a4110e431c350acd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Oct 2019 20:30:56 +0200 Subject: GRAPHICS: MACGUI: Implement nested submenu navigation --- graphics/macgui/macmenu.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'graphics/macgui/macmenu.cpp') diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 48db04293f..aaa86ae5f4 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -836,13 +836,25 @@ bool MacMenu::mouseClick(int x, int y) { renderSubmenu(it); _contentIsDirty = true; } - } else if (_menuActivated && _activeItem != -1 && _activeSubItem != -1) { + } else if (_menuActivated && _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; + + return true; + } + } + } else if (_menuActivated && _activeItem != -1) { _activeSubItem = -1; if (_menustack.size()) { renderSubmenu(_menustack.back()); _contentIsDirty = true; } + + return true; } return false; -- cgit v1.2.3