diff options
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/gui.cpp | 13 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 21 | ||||
-rw-r--r-- | engines/wage/menu.h | 5 |
3 files changed, 37 insertions, 2 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index e40b7af01c..0771cb0d31 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -576,6 +576,13 @@ void Gui::loadFonts() { } void Gui::mouseMove(int x, int y) { + if (_menu->_menuActivated) { + if (_menu->mouseMove(x, y)) + _menuDirty = true; + + return; + } + if (_consoleTextArea.contains(x, y)) { if (_cursorIsArrow) { CursorMan.replaceCursor(macCursorBeam, 11, 16, 3, 8, 3); @@ -588,6 +595,12 @@ void Gui::mouseMove(int x, int y) { } Designed *Gui::getClickTarget(int x, int y) { + if (_menu->_menuActivated) { + if (_menu->mouseRelease(x, y)) + _menuDirty = true; + + return NULL; + } if (_sceneArea.contains(x, y)) { if (!_sceneIsActive) { _sceneIsActive = true; diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index 25bd3b9d8f..f775a4d64c 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -212,6 +212,8 @@ bool Menu::mouseClick(int x, int y) { for (int i = 0; i < _items.size(); i++) if (_items[i]->bbox.contains(x, y)) { _activeItem = i; + _activeSubItem = -1; + _menuActivated = true; return true; } @@ -220,4 +222,23 @@ bool Menu::mouseClick(int x, int y) { return false; } +bool Menu::mouseMove(int x, int y) { + if (_menuActivated) + if (mouseClick(x, y)) + return true; + + return false; +} + +bool Menu::mouseRelease(int x, int y) { + if (_menuActivated) { + _menuActivated = false; + _activeItem = -1; + + return true; + } + + return false; +} + } // End of namespace Wage diff --git a/engines/wage/menu.h b/engines/wage/menu.h index 255f2e8294..e444c1a161 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -59,7 +59,10 @@ public: void render(); bool mouseClick(int x, int y); + bool mouseRelease(int x, int y); + bool mouseMove(int x, int y); + bool _menuActivated; Common::Rect _bbox; private: @@ -69,8 +72,6 @@ private: const Graphics::Font *getMenuFont(); Common::Array<MenuItem *> _items; - bool _menuActivated; - int _activeItem; int _activeSubItem; }; |