diff options
author | Borja Lorente | 2016-07-29 11:21:56 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:05:14 +0200 |
commit | 941617fc3829d545cd35ada87f770655004e9914 (patch) | |
tree | e97eeaf8067d7e4a9d6718d113cdd2bfabcd0308 | |
parent | ffbc6b0c783b5d86a91ef15a4974cde7f606c585 (diff) | |
download | scummvm-rg350-941617fc3829d545cd35ada87f770655004e9914.tar.gz scummvm-rg350-941617fc3829d545cd35ada87f770655004e9914.tar.bz2 scummvm-rg350-941617fc3829d545cd35ada87f770655004e9914.zip |
GRAPHICS: Create wrapper namespace for MacWindow constants
-rw-r--r-- | engines/wage/gui-console.cpp | 40 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 10 | ||||
-rw-r--r-- | engines/wage/gui.h | 6 | ||||
-rw-r--r-- | graphics/macgui/macwindow.h | 41 |
4 files changed, 51 insertions, 46 deletions
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 87c84adc64..1cf98ab991 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -348,7 +348,7 @@ void Gui::actionCopy() { } } - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionPaste, true); + _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); } void Gui::actionPaste() { @@ -357,14 +357,14 @@ void Gui::actionPaste() { drawInput(); _engine->_inputText = _out.back(); // Set last part of the multiline text - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); } void Gui::actionUndo() { _engine->_inputText = _undobuffer; drawInput(); - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, false); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, false); } void Gui::actionClear() { @@ -381,7 +381,7 @@ void Gui::actionClear() { _engine->_inputText = beg + end; drawInput(); - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); _selectionStartY = -1; _selectionEndY = -1; @@ -403,15 +403,15 @@ void Gui::actionCut() { _clipboard = mid; drawInput(); - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionPaste, true); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); + _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); _selectionStartY = -1; _selectionEndY = -1; } void Gui::disableUndo() { - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, false); + _menu->enableCommand(kMenuEdit, kMenuActionUndo, false); } void Gui::disableAllMenus() { @@ -419,13 +419,13 @@ void Gui::disableAllMenus() { } void Gui::enableNewGameMenus() { - _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionNew, true); - _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionOpen, true); - _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionQuit, true); + _menu->enableCommand(kMenuFile, kMenuActionNew, true); + _menu->enableCommand(kMenuFile, kMenuActionOpen, true); + _menu->enableCommand(kMenuFile, kMenuActionQuit, true); } -bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event) { - if (click == Graphics::kBorderScrollUp || click == Graphics::kBorderScrollDown) { +bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) { + if (click == kBorderScrollUp || click == kBorderScrollDown) { if (event.type == Common::EVENT_LBUTTONDOWN) { int consoleHeight = _consoleWindow->getInnerDimensions().height(); int textFullSize = _lines.size() * _consoleLineHeight + consoleHeight; @@ -439,14 +439,14 @@ bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event int oldScrollPos = _scrollPos; switch (click) { - case Graphics::kBorderScrollUp: + case kBorderScrollUp: _scrollPos = MAX<int>(0, _scrollPos - _consoleLineHeight); undrawCursor(); _cursorY -= (_scrollPos - oldScrollPos); _consoleDirty = true; _consoleFullRedraw = true; break; - case Graphics::kBorderScrollDown: + case kBorderScrollDown: _scrollPos = MIN<int>((_lines.size() - 2) * _consoleLineHeight, _scrollPos + _consoleLineHeight); undrawCursor(); _cursorY -= (_scrollPos - oldScrollPos); @@ -463,14 +463,14 @@ bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event return false; } - if (click == Graphics::kBorderResizeButton) { + if (click == kBorderResizeButton) { _consoleDirty = true; _consoleFullRedraw = true; return true; } - if (click == Graphics::kBorderInner) { + if (click == kBorderInner) { if (event.type == Common::EVENT_LBUTTONDOWN) { startMarking(event.mouse.x, event.mouse.y); @@ -483,17 +483,17 @@ bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event (_selectionEndX == _selectionStartX && _selectionEndY == _selectionStartY)) { _selectionStartY = _selectionEndY = -1; _consoleFullRedraw = true; - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCopy, false); + _menu->enableCommand(kMenuEdit, kMenuActionCopy, false); } else { - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCopy, true); + _menu->enableCommand(kMenuEdit, kMenuActionCopy, true); bool cutAllowed = false; if (_selectionStartY == _selectionEndY && _selectionStartY == (int)_lines.size() - 1) cutAllowed = true; - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCut, cutAllowed); - _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionClear, cutAllowed); + _menu->enableCommand(kMenuEdit, kMenuActionCut, cutAllowed); + _menu->enableCommand(kMenuEdit, kMenuActionClear, cutAllowed); } } diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index d74b77bb0c..49f56f3669 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -110,8 +110,8 @@ static void cursorTimerHandler(void *refCon) { gui->_cursorDirty = true; } -static bool sceneWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui); -static bool consoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui); +static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *gui); +static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *gui); static void menuCommandsCallback(int action, Common::String &text, void *data); @@ -235,13 +235,13 @@ void Gui::drawScene() { _consoleFullRedraw = true; } -static bool sceneWindowCallback(Graphics::WindowClick click, Common::Event &event, void *g) { +static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *g) { Gui *gui = (Gui *)g; return gui->processSceneEvents(click, event); } -bool Gui::processSceneEvents(Graphics::WindowClick click, Common::Event &event) { +bool Gui::processSceneEvents(WindowClick click, Common::Event &event) { if (click == Graphics::kBorderInner && event.type == Common::EVENT_LBUTTONUP) { Designed *obj = _scene->lookUpEntity(event.mouse.x - _sceneWindow->getDimensions().left, event.mouse.y - _sceneWindow->getDimensions().top); @@ -265,7 +265,7 @@ void Gui::drawConsole() { _consoleWindow->setDirty(true); } -static bool consoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *g) { +static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *g) { Gui *gui = (Gui *)g; return gui->processConsoleEvents(click, event); diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 4c9580d372..7a2edb57c6 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -60,7 +60,9 @@ namespace Wage { +// Import the enum definitions using namespace Graphics::MacMenuConstants; +using namespace Graphics::MacWindowConstants; class Scene; class WageEngine; @@ -93,8 +95,8 @@ public: void disableAllMenus(); void enableNewGameMenus(); - bool processSceneEvents(Graphics::WindowClick click, Common::Event &event); - bool processConsoleEvents(Graphics::WindowClick click, Common::Event &event); + bool processSceneEvents(WindowClick click, Common::Event &event); + bool processConsoleEvents(WindowClick click, Common::Event &event); void executeMenuCommand(int action, Common::String &text); private: diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h index 55f9d5c5ad..e614e61bff 100644 --- a/graphics/macgui/macwindow.h +++ b/graphics/macgui/macwindow.h @@ -54,25 +54,28 @@ namespace Graphics { class MacWindowManager; -enum WindowType { - kWindowUnknown, - kWindowWindow, - kWindowMenu -}; - -enum { - kBorderWidth = 17 -}; - -enum WindowClick { - kBorderNone = 0, - kBorderScrollUp, - kBorderScrollDown, - kBorderCloseButton, - kBorderInner, - kBorderBorder, - kBorderResizeButton -}; +namespace MacWindowConstants { + enum WindowType { + kWindowUnknown, + kWindowWindow, + kWindowMenu + }; + + enum { + kBorderWidth = 17 + }; + + enum WindowClick { + kBorderNone = 0, + kBorderScrollUp, + kBorderScrollDown, + kBorderCloseButton, + kBorderInner, + kBorderBorder, + kBorderResizeButton + }; +} +using namespace MacWindowConstants; class BaseMacWindow { public: |