diff options
author | Eugene Sandulenko | 2016-04-18 19:03:11 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-04-19 09:35:49 +0200 |
commit | e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e (patch) | |
tree | f09ca7a129b42b48f41c2c3ebdf9f8ce1f31918e | |
parent | e5a64e7b7fae4e87d509724fcac3e5fa6d5c815e (diff) | |
download | scummvm-rg350-e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e.tar.gz scummvm-rg350-e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e.tar.bz2 scummvm-rg350-e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e.zip |
WAGE: Started mouse processing in the WM
-rw-r--r-- | engines/wage/gui.cpp | 2 | ||||
-rw-r--r-- | engines/wage/macwindow.cpp | 6 | ||||
-rw-r--r-- | engines/wage/macwindow.h | 14 | ||||
-rw-r--r-- | engines/wage/macwindowmanager.cpp | 25 | ||||
-rw-r--r-- | engines/wage/macwindowmanager.h | 2 |
5 files changed, 42 insertions, 7 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 3afdb48853..8833f7f63d 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -645,6 +645,8 @@ Designed *Gui::mouseUp(int x, int y) { void Gui::mouseDown(int x, int y) { int borderClick; + _wm.mouseDown(x, y); + if (_menu->mouseClick(x, y)) { _menuDirty = true; } else if (_consoleTextArea.contains(x, y)) { diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index 83907400c4..e517b7230b 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -53,7 +53,7 @@ namespace Wage { -MacWindow::MacWindow(bool scrollable) : _scrollable(scrollable) { +MacWindow::MacWindow(int id, bool scrollable) : _scrollable(scrollable), _id(id) { _active = false; _borderIsDirty = true; @@ -235,4 +235,8 @@ void MacWindow::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h g->fillRect(r, color); } +WindowClick MacWindow::mouseDown(int x, int y) { + return kBorderNone; +} + } // End of namespace Wage diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index 51bc9dfe16..c47675ef83 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -61,16 +61,17 @@ enum { kBorderWidth = 17 }; -enum BorderHighlight { +enum WindowClick { kBorderNone = 0, kBorderScrollUp, kBorderScrollDown, - kBorderCloseButton + kBorderCloseButton, + kBorderInner }; class MacWindow { public: - MacWindow(bool scrollable); + MacWindow(int id, bool scrollable); ~MacWindow(); void move(int x, int y); void resize(int w, int h); @@ -80,9 +81,11 @@ public: void setActive(bool active); Graphics::ManagedSurface *getSurface() { return &_surface; } void setTitle(Common::String &title) { _title = title; } - void setHighlight(BorderHighlight highlightedPart) { _highlightedPart = highlightedPart; } + void setHighlight(WindowClick highlightedPart) { _highlightedPart = highlightedPart; } void setScroll(float scrollPos, float scrollSize) { _scrollPos = scrollPos; _scrollSize = scrollSize; } void setDirty(bool dirty) { _contentIsDirty = dirty; } + int getId() { return _id; } + WindowClick mouseDown(int x, int y); private: void drawBorder(); @@ -99,8 +102,9 @@ private: bool _active; bool _borderIsDirty; bool _contentIsDirty; + int _id; - BorderHighlight _highlightedPart; + WindowClick _highlightedPart; float _scrollPos, _scrollSize; Common::Rect _dims; diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp index d33fb3355b..78ca6aded4 100644 --- a/engines/wage/macwindowmanager.cpp +++ b/engines/wage/macwindowmanager.cpp @@ -69,7 +69,7 @@ MacWindowManager::~MacWindowManager() { } int MacWindowManager::add(bool scrollable) { - MacWindow *w = new MacWindow(scrollable); + MacWindow *w = new MacWindow(_lastId, scrollable); _windows.push_back(w); _windowStack.push_back(w); @@ -113,4 +113,27 @@ void MacWindowManager::draw() { _fullRefresh = false; } +bool MacWindowManager::mouseDown(int x, int y) { + for (Common::List<MacWindow *>::const_iterator it = _windowStack.end(); it != _windowStack.begin();) { + it--; + MacWindow *w = *it; + + if (w->getDimensions().contains(x, y)) { + setActive(w->getId()); + + WindowClick click = w->mouseDown(x, y); + + if (click == kBorderInner) { + + } else { + w->setHighlight(click); + } + + return true; + } + } + + return false; +} + } // End of namespace Wage diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h index d840799961..adb086df8a 100644 --- a/engines/wage/macwindowmanager.h +++ b/engines/wage/macwindowmanager.h @@ -66,6 +66,8 @@ public: void draw(); + bool mouseDown(int x, int y); + MacWindow *getWindow(int id) { return _windows[id]; } private: |