aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/gui.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-07-21 15:25:43 +0200
committerBorja Lorente2016-08-14 18:57:26 +0200
commit53a5fb6c546bee103526fe444ece0c2cda52d624 (patch)
tree1213c0fc597c94f535deb06cd475862e06718098 /engines/macventure/gui.cpp
parent91493aaeb860edbdc991bca679ad6cf8a9d513eb (diff)
downloadscummvm-rg350-53a5fb6c546bee103526fe444ece0c2cda52d624.tar.gz
scummvm-rg350-53a5fb6c546bee103526fe444ece0c2cda52d624.tar.bz2
scummvm-rg350-53a5fb6c546bee103526fe444ece0c2cda52d624.zip
MACVENTURE: Refactor dialogs and controls
Diffstat (limited to 'engines/macventure/gui.cpp')
-rw-r--r--engines/macventure/gui.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index d38a7a5c3d..d8db6656e5 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -20,14 +20,14 @@
*
*/
+
#include "common/file.h"
+#include "common/timer.h"
+#include "common/system.h"
#include "image/bmp.h"
-#include "macventure/macventure.h"
#include "macventure/gui.h"
-
-#include "common/timer.h"
-#include "common/system.h"
+#include "macventure/dialog.h"
namespace MacVenture {
@@ -36,12 +36,12 @@ namespace MacVenture {
enum MenuAction;
enum {
- kCursorWidth = 2, // HACK Arbitrary width to test
+ kCursorWidth = 2,
kCursorHeight = 2
};
enum {
- kExitButtonWidth = 10, // HACK Arbitrary width to test
+ kExitButtonWidth = 10,
kExitButtonHeight = 10
};
@@ -802,10 +802,20 @@ void Gui::printText(const Common::String & text) {
_consoleText->printLine(text, _outConsoleWindow->getDimensions().width());
}
+void Gui::showPrebuiltDialog(PrebuiltDialogs type) {
+ closeDialog();
+ _dialog = new Dialog(this, type);
+}
+
+bool Gui::isDialogOpen() {
+ return _dialog != nullptr;
+}
+
void Gui::setTextInput(Common::String str) {
_engine->setTextInput(str);
}
+
void Gui::closeDialog() {
delete _dialog;
_dialog = nullptr;
@@ -815,9 +825,7 @@ void Gui::getTextFromUser() {
if (_dialog) {
delete _dialog;
}
- _dialog = new Dialog(this, kSpeakDialog);
- // Hack to pause the engine
- _engine->clickToContinue();
+ showPrebuiltDialog(kSpeakDialog);
}
void Gui::loadGame(int slot) {
@@ -1046,8 +1054,7 @@ 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);
+ showPrebuiltDialog(kSaveAsDialog);
break;
case MacVenture::kMenuActionQuit:
debug("MacVenture Menu Action: Quit");
@@ -1140,6 +1147,7 @@ void Gui::invertWindowColors(WindowReference winID) {
}
}
+
bool Gui::tryCloseWindow(WindowReference winID) {
WindowData data = findWindowData(winID);
if (winID < 0x80) { // Inventory window