aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/gui.h
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.h
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.h')
-rw-r--r--engines/macventure/gui.h124
1 files changed, 7 insertions, 117 deletions
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index b03ca2afe9..eb929cfcdd 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -29,9 +29,12 @@
#include "graphics/font.h"
+#include "macventure/macventure.h"
#include "macventure/container.h"
#include "macventure/image.h"
+#include "macventure/prebuilt_dialogs.h"
#include "macventure/dialog.h"
+#include "macventure/controls.h"
namespace MacVenture {
@@ -114,53 +117,6 @@ struct WindowData {
bool updateScroll;
};
-enum ControlType { // HACK, should correspond exactly with the types of controls (sliders etc)
- kControlExitBox = 0,
- kControlExamine = 1,
- kControlOpen = 2,
- kControlClose = 3,
- kControlSpeak = 4,
- kControlOperate = 5,
- kControlGo = 6,
- kControlHit = 7,
- kControlConsume = 8,
- kControlClickToContinue = 9
-};
-
-enum ControlAction { // HACK, figure out a way to put it in engine
- kNoCommand = 0,
- kStartOrResume = 1,
- kClose = 2,
- kTick = 3,
- kActivateObject = 4,
- kMoveObject = 5,
- kConsume = 6,
- kExamine = 7,
- kGo = 8,
- kHit = 9,
- kOpen = 10,
- kOperate = 11,
- kSpeak = 12,
- kBabble = 13,
- kTargetName = 14,
- kDebugObject = 15,
- kClickToContinue = 16
-};
-
-struct ControlData {
- Common::Rect bounds;
- uint16 scrollValue;
- uint8 visible;
- uint16 scrollMax;
- uint16 scrollMin;
- uint16 cdef;
- ControlAction refcon;
- ControlType type;
- uint8 titleLength;
- char* title;
- uint16 border;
-};
-
struct BorderBounds {
uint16 leftOffset;
uint16 topOffset;
@@ -204,6 +160,7 @@ public:
void updateWindow(WindowReference winID, bool containerOpen);
void invertWindowColors(WindowReference winID);
+
WindowReference createInventoryWindow(ObjID objRef);
bool tryCloseWindow(WindowReference winID);
@@ -223,8 +180,6 @@ public:
void processCursorTick();
- //bool processClickObject(ObjID obj, WindowReference win, Common::Event event, bool canDrag);
-
const WindowData& getWindowData(WindowReference reference);
const Graphics::Font& getCurrentFont();
@@ -248,6 +203,9 @@ public:
void printText(const Common::String &text);
//Dialog interactions
+ void showPrebuiltDialog(PrebuiltDialogs type);
+ bool isDialogOpen();
+
void getTextFromUser();
void setTextInput(Common::String str);
void closeDialog();
@@ -428,74 +386,6 @@ private:
};
-class CommandButton {
-
-enum {
- kCommandsLeftPadding = 0,
- kCommandsTopPadding = 0
-};
-
-public:
-
- CommandButton() {
- _gui = nullptr;
- }
-
- CommandButton(ControlData data, Gui *g) {
- _data = data;
- _gui = g;
- _selected = false;
- }
- ~CommandButton() {}
-
- void draw(Graphics::ManagedSurface &surface) const {
-
- uint colorFill = _selected ? kColorBlack : kColorWhite;
- uint colorText = _selected ? kColorWhite : kColorBlack;
-
- surface.fillRect(_data.bounds, colorFill);
- surface.frameRect(_data.bounds, kColorBlack);
-
- if (_data.titleLength > 0) {
- const Graphics::Font &font = _gui->getCurrentFont();
- Common::String title(_data.title);
- font.drawString(
- &surface,
- title,
- _data.bounds.left,
- _data.bounds.top,
- _data.bounds.right - _data.bounds.left,
- colorText,
- Graphics::kTextAlignCenter);
- }
- }
-
- bool isInsideBounds(const Common::Point point) const {
- return _data.bounds.contains(point);
- }
-
- const ControlData& getData() const {
- return _data;
- }
-
- void select() {
- _selected = true;
- }
-
- void unselect() {
- _selected = false;
- }
-
- bool isSelected() {
- return _selected;
- }
-
-private:
- bool _selected;
- ControlData _data;
- Gui *_gui;
-};
-
class ConsoleText {
public: