diff options
author | Eugene Sandulenko | 2019-10-02 20:19:10 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-03 00:05:12 +0200 |
commit | d3df14fce121460ae7ee810fc751e66c17a04b16 (patch) | |
tree | b4cdf8f33592ca27f8628259306b3f8e27d92eb8 /graphics/macgui | |
parent | b157a27e2bcfe04bcdfae539304509f859ec17d0 (diff) | |
download | scummvm-rg350-d3df14fce121460ae7ee810fc751e66c17a04b16.tar.gz scummvm-rg350-d3df14fce121460ae7ee810fc751e66c17a04b16.tar.bz2 scummvm-rg350-d3df14fce121460ae7ee810fc751e66c17a04b16.zip |
GRAPHICS: MACGUI: Finish implementation for nested submenus drawing
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 19 | ||||
-rw-r--r-- | graphics/macgui/macmenu.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 5be18ac931..48db04293f 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -591,10 +591,10 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) { submenu->bbox.bottom = y2; for (uint i = 0; i < submenu->subitems.size(); i++) { - MacMenuSubMenu *submenu = submenu->subitems[i]->submenu; + MacMenuSubMenu *menu = submenu->subitems[i]->submenu; - if (submenu != nullptr) - calcSubMenuBounds(submenu, x2 - 4, y1 + i * kMenuDropdownItemHeight + 1); + if (menu != nullptr) + calcSubMenuBounds(menu, x2 - 4, y1 + i * kMenuDropdownItemHeight + 1); } } @@ -647,9 +647,6 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) { _screen.fillRect(hbox, _wm->_colorBlack); color = _wm->_colorWhite; - - if (it->submenu != nullptr) - renderSubmenu(it->submenu); } if (it->unicode) { @@ -661,6 +658,10 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) { } } + for (uint i = 0; i < _menustack.size(); i++) { + renderSubmenu(_menustack[i], (i == _menustack.size() - 1)); + } + g->transBlitFrom(_screen, kColorGreen); g_system->copyRectToScreen(g->getPixels(), g->pitch, 0, 0, g->w, g->h); @@ -668,7 +669,7 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) { return true; } -void MacMenu::renderSubmenu(MacMenuSubMenu *menu) { +void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) { Common::Rect *r = &menu->bbox; if (r->width() == 0 || r->height() == 0) @@ -752,8 +753,8 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu) { y += kMenuDropdownItemHeight; } - if (_activeSubItem != -1 && menu->subitems[_activeSubItem]->submenu != nullptr) - renderSubmenu(menu->subitems[_activeSubItem]->submenu); + if (recursive && _activeSubItem != -1 && menu->subitems[_activeSubItem]->submenu != nullptr) + renderSubmenu(menu->subitems[_activeSubItem]->submenu, false); _contentIsDirty = true; //g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2); diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h index 224ec667ae..3b21647842 100644 --- a/graphics/macgui/macmenu.h +++ b/graphics/macgui/macmenu.h @@ -96,7 +96,7 @@ private: const Common::String getAcceleratorString(MacMenuSubItem *item, const char *prefix); int calcSubMenuWidth(MacMenuSubMenu *menu); void calcSubMenuBounds(MacMenuSubMenu *menu, int x, int y); - void renderSubmenu(MacMenuSubMenu *menu); + void renderSubmenu(MacMenuSubMenu *menu, bool recursive = true); bool keyEvent(Common::Event &event); bool mouseClick(int x, int y); |