diff options
author | Eugene Sandulenko | 2016-02-05 11:05:00 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:13:02 +0100 |
commit | 7e8c1028d31e8b86fb6bc4cc05ac8dcf1e772eb2 (patch) | |
tree | 931c9b624f98a1b697ba613dcea1c14f93c24ab2 | |
parent | c02c36ce88f6de4cb3442898deb4f051364fb52e (diff) | |
download | scummvm-rg350-7e8c1028d31e8b86fb6bc4cc05ac8dcf1e772eb2.tar.gz scummvm-rg350-7e8c1028d31e8b86fb6bc4cc05ac8dcf1e772eb2.tar.bz2 scummvm-rg350-7e8c1028d31e8b86fb6bc4cc05ac8dcf1e772eb2.zip |
WAGE: Implement API to enable/disable menu items
-rw-r--r-- | engines/wage/gui.cpp | 2 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 24 | ||||
-rw-r--r-- | engines/wage/menu.h | 20 |
3 files changed, 27 insertions, 19 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 4e52801c76..2564f67af2 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -707,6 +707,8 @@ Designed *Gui::mouseUp(int x, int y) { (_selectionEndX == _selectionStartX && _selectionEndY == _selectionStartY)) { _selectionStartY = _selectionEndY = -1; _consoleFullRedraw = true; + } else { + } } diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index a814934a23..69ac07b019 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -79,25 +79,6 @@ struct MenuItem { MenuItem(const char *n) : name(n) {} }; -enum { - kMenuActionAbout, - kMenuActionNew, - kMenuActionOpen, - kMenuActionClose, - kMenuActionSave, - kMenuActionSaveAs, - kMenuActionRevert, - kMenuActionQuit, - - kMenuActionUndo, - kMenuActionCut, - kMenuActionCopy, - kMenuActionPaste, - kMenuActionClear, - - kMenuActionCommand -}; - struct MenuData { int menunum; const char *title; @@ -568,5 +549,10 @@ void Menu::processMenuShortCut(byte flags, uint16 ascii) { } } +void Menu::enableCommand(int menunum, int action, bool state) { + for (int i = 0; i < _items[menunum]->subitems.size(); i++) + if (_items[menunum]->subitems[i]->action == action) + _items[menunum]->subitems[i]->enabled = state; +} } // End of namespace Wage diff --git a/engines/wage/menu.h b/engines/wage/menu.h index d817cf3734..a37e6b037c 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -63,6 +63,25 @@ enum { kFontStyleExtended = 64 }; +enum { + kMenuActionAbout, + kMenuActionNew, + kMenuActionOpen, + kMenuActionClose, + kMenuActionSave, + kMenuActionSaveAs, + kMenuActionRevert, + kMenuActionQuit, + + kMenuActionUndo, + kMenuActionCut, + kMenuActionCopy, + kMenuActionPaste, + kMenuActionClear, + + kMenuActionCommand +}; + class Menu { public: Menu(Gui *gui); @@ -76,6 +95,7 @@ public: void regenCommandsMenu(); void regenWeaponsMenu(); void processMenuShortCut(byte flags, uint16 ascii); + void enableCommand(int menunum, int action, bool state); bool _menuActivated; Common::Rect _bbox; |