diff options
| author | Eugene Sandulenko | 2016-04-25 19:54:26 +0200 | 
|---|---|---|
| committer | Eugene Sandulenko | 2016-04-25 19:54:26 +0200 | 
| commit | 98061bdc4c802f9e025f4047bc7d24186365b75d (patch) | |
| tree | 8fe4cdcc656f12f5236c8347d4d381d066cff195 | |
| parent | df6ee166311e47e77d2b50aee87e233412f6d23a (diff) | |
| download | scummvm-rg350-98061bdc4c802f9e025f4047bc7d24186365b75d.tar.gz scummvm-rg350-98061bdc4c802f9e025f4047bc7d24186365b75d.tar.bz2 scummvm-rg350-98061bdc4c802f9e025f4047bc7d24186365b75d.zip | |
WAGE: Move menu event processing to WindowManager
| -rw-r--r-- | engines/wage/gui.cpp | 42 | ||||
| -rw-r--r-- | engines/wage/gui.h | 4 | ||||
| -rw-r--r-- | engines/wage/menu.cpp | 7 | ||||
| -rw-r--r-- | engines/wage/menu.h | 8 | 
4 files changed, 13 insertions, 48 deletions
| diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 92002fff5a..6fcbbc3678 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -474,15 +474,6 @@ void Gui::processMenuShortCut(byte flags, uint16 ascii) {  	_menu->processMenuShortCut(flags, ascii);  } -void Gui::mouseMove(int x, int y) { -	if (_menu->hasAllFocus()) { -		if (_menu->mouseMove(x, y)) -			_menu->setDirty(true); - -		return; -	} -} -  void Gui::pushArrowCursor() {  	CursorMan.pushCursor(macCursorArrow, 11, 16, 1, 1, 3);  } @@ -492,38 +483,7 @@ void Gui::popCursor() {  }  bool Gui::processEvent(Common::Event &event) { -	if (_wm.processEvent(event)) -		return true; - -	switch (event.type) { -	case Common::EVENT_MOUSEMOVE: -		mouseMove(event.mouse.x, event.mouse.y); -		break; -	case Common::EVENT_LBUTTONDOWN: -		mouseDown(event.mouse.x, event.mouse.y); -		break; -	case Common::EVENT_LBUTTONUP: -		mouseUp(event.mouse.x, event.mouse.y); -		break; - -	default: -		return false; -	} - -	return true; -} - -void Gui::mouseUp(int x, int y) { -	if (_menu->hasAllFocus()) -		_menu->mouseRelease(x, y); - -	return; -} - -void Gui::mouseDown(int x, int y) { -	if (_menu->mouseClick(x, y)) { -		_menu->setDirty(true); -	} +	return _wm.processEvent(event);  }  int Gui::calcTextX(int x, int textLine) { diff --git a/engines/wage/gui.h b/engines/wage/gui.h index bec308d38c..cfc7a09b76 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -90,9 +90,7 @@ public:  	void appendText(const char *str);  	void clearOutput();  	bool processEvent(Common::Event &event); -	void mouseMove(int x, int y); -	void mouseDown(int x, int y); -	void mouseUp(int x, int y); +  	void drawInput();  	void setSceneDirty() { _sceneDirty = true; }  	const Graphics::Font *getFont(const char *name, Graphics::FontManager::FontUsage fallback); diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index 40dbbbbf50..425f2d6cb0 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -447,6 +447,13 @@ void Menu::renderSubmenu(MenuItem *menu) {  }  bool Menu::processEvent(Common::Event &event) { +	if (event.type == Common::EVENT_LBUTTONDOWN) +		return mouseClick(event.mouse.x, event.mouse.y); +	else if (event.type == Common::EVENT_LBUTTONUP) +		return mouseRelease(event.mouse.x, event.mouse.y); +	else if (event.type == Common::EVENT_MOUSEMOVE) +		return mouseMove(event.mouse.x, event.mouse.y); +  	return false;  } diff --git a/engines/wage/menu.h b/engines/wage/menu.h index fed5c5c66c..511811265a 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -98,10 +98,6 @@ public:  	bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false);  	bool processEvent(Common::Event &event); -	bool mouseClick(int x, int y); -	bool mouseRelease(int x, int y); -	bool mouseMove(int x, int y); -  	void regenCommandsMenu();  	void regenWeaponsMenu();  	void processMenuShortCut(byte flags, uint16 ascii); @@ -128,6 +124,10 @@ private:  	void createWeaponsMenu(MenuItem *menu);  	void executeCommand(MenuSubItem *subitem); +	bool mouseClick(int x, int y); +	bool mouseRelease(int x, int y); +	bool mouseMove(int x, int y); +  	Common::Array<MenuItem *> _items;  	MenuItem *_weapons;  	MenuItem *_commands; | 
