diff options
author | Borja Lorente | 2016-07-15 12:47:27 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 18:55:17 +0200 |
commit | 2a521bb22df9c5e5d477deb32ebc8b6a54e91fde (patch) | |
tree | b8b631f749258226c6c96cc8db9d649936655ff1 /engines/macventure/gui.cpp | |
parent | 8162483026ec52476a1106e72259c84e5476fd2d (diff) | |
download | scummvm-rg350-2a521bb22df9c5e5d477deb32ebc8b6a54e91fde.tar.gz scummvm-rg350-2a521bb22df9c5e5d477deb32ebc8b6a54e91fde.tar.bz2 scummvm-rg350-2a521bb22df9c5e5d477deb32ebc8b6a54e91fde.zip |
MACVENTURE: Add dialog system
Diffstat (limited to 'engines/macventure/gui.cpp')
-rw-r--r-- | engines/macventure/gui.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 02f603659e..4b01f8bca9 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -112,6 +112,7 @@ Gui::Gui(MacVentureEngine *engine, Common::MacResManager *resman) { _controlData = nullptr; _draggedObj.id = 0; _draggedObj.pos = Common::Point(0, 0); + _dialog = nullptr; _cursor = new Cursor(this); g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 500000, this, "macVentureCursor"); @@ -138,6 +139,9 @@ Gui::~Gui() { if (_consoleText) delete _consoleText; + if (_dialog) + delete _dialog; + Common::HashMap<ObjID, ImageAsset*>::const_iterator it = _assets.begin(); for (; it != _assets.end(); it++) { delete it->_value; @@ -181,7 +185,7 @@ void Gui::draw() { _wm.draw(); drawDraggedObject(); - + drawDialog(); //drawWindowTitle(kMainGameWindow, _mainGameWindow->getSurface()); } @@ -703,6 +707,10 @@ void Gui::drawDraggedObject() { } } +void Gui::drawDialog() { + if (_dialog) _dialog->draw(); +} + void Gui::updateWindow(WindowReference winID, bool containerOpen) { if (winID == kNoWindow) return; if (winID == kSelfWindow || containerOpen) { @@ -794,6 +802,11 @@ void Gui::printText(const Common::String & text) { _consoleText->printLine(text, _outConsoleWindow->getDimensions().width()); } +void Gui::closeDialog() { + delete _dialog; + _dialog = nullptr; +} + void Gui::moveDraggedObject(Common::Point target) { Common::Point newPos = target + _draggedObj.mouseOffset; bool movement = false; @@ -1006,6 +1019,8 @@ void Gui::handleMenuAction(MenuAction action) { break; case MacVenture::kMenuActionSaveAs: debug("MacVenture Menu Action: Save As"); + // HACK this should be wrapped in a function + _dialog = new Dialog(this, kSaveAsDialog); break; case MacVenture::kMenuActionQuit: debug("MacVenture Menu Action: Quit"); @@ -1120,6 +1135,8 @@ bool Gui::processEvent(Common::Event &event) { processed |= _cursor->processEvent(event); + if (_dialog && _dialog->processEvent(event)) return true; + if (event.type == Common::EVENT_MOUSEMOVE) { if (_draggedObj.id != 0) { moveDraggedObject(event.mouse); @@ -1247,8 +1264,6 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) { // Find the appropriate window WindowReference ref = findWindowAtPoint(event.mouse); - // TODO DELETE MEEEE! - debug("WindowFound: %d", ref); if (ref == kNoWindow) return false; Graphics::MacWindow *win = findWindow(ref); WindowData &data = findWindowData((WindowReference) ref); @@ -1267,11 +1282,14 @@ void Gui::processCursorTick() { void Gui::handleSingleClick(Common::Point pos) { debug("Single Click"); + // HACK + if (_dialog) return; handleDragRelease(pos, false, false); } void Gui::handleDoubleClick(Common::Point pos) { debug("Double Click"); + if (_dialog) return; handleDragRelease(pos, false, true); } |