From 9b40bd5c6aa8110e7b3a13eec2550a4c6f201668 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 15:25:14 -1000 Subject: XEEN: More UI loading code, refactored Dialog base to ButtonContainer --- engines/xeen/dialogs.h | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'engines/xeen/dialogs.h') diff --git a/engines/xeen/dialogs.h b/engines/xeen/dialogs.h index 1f8f2fb624..61ae73473d 100644 --- a/engines/xeen/dialogs.h +++ b/engines/xeen/dialogs.h @@ -26,36 +26,39 @@ #include "common/array.h" #include "common/stack.h" #include "common/rect.h" -#include "xeen/xeen.h" +#include "xeen/sprites.h" namespace Xeen { -class DialogButton { +class XeenEngine; + +class UIButton { public: Common::Rect _bounds; SpriteResource *_sprites; - char _c; + int _value; bool _draw; - DialogButton(const Common::Rect &bounds, char c, SpriteResource *sprites, bool draw) : - _bounds(bounds), _c(c), _sprites(sprites), _draw(draw) {} + UIButton(const Common::Rect &bounds, int value, SpriteResource *sprites, bool draw) : + _bounds(bounds), _value(value), _sprites(sprites), _draw(draw) {} - DialogButton() : _c('\0'), _sprites(nullptr), _draw(false) {} + UIButton() : _value(0), _sprites(nullptr), _draw(false) {} }; -class Dialog { +class ButtonContainer { private: - Common::Stack< Common::Array > _savedButtons; + Common::Stack< Common::Array > _savedButtons; protected: - XeenEngine *_vm; - Common::Array _buttons; - char _key; + Common::Array _buttons; + int _buttonValue; - void doScroll(bool drawFlag, bool doFade); + void doScroll(XeenEngine *vm, bool drawFlag, bool doFade); - void checkEvents(); + void checkEvents(XeenEngine *vm); + + void drawButtons(XSurface *surface); public: - Dialog(XeenEngine *vm): _vm(vm), _key('\0') {} + ButtonContainer() : _buttonValue(0) {} void saveButtons(); @@ -63,19 +66,23 @@ public: void restoreButtons(); - void addButton(const Common::Rect &bounds, char c, SpriteResource *sprites, bool draw); + void addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw); }; -class SettingsBaseDialog : public Dialog { +class SettingsBaseDialog : public ButtonContainer { protected: + XeenEngine *_vm; + virtual void showContents(SpriteResource &title1, bool mode); public: - SettingsBaseDialog(XeenEngine *vm) : Dialog(vm) {} + SettingsBaseDialog(XeenEngine *vm) : ButtonContainer(), _vm(vm) {} }; -class CreditsScreen: public Dialog { +class CreditsScreen: public ButtonContainer { private: - CreditsScreen(XeenEngine *vm) : Dialog(vm) {} + XeenEngine *_vm; + + CreditsScreen(XeenEngine *vm) : ButtonContainer(), _vm(vm) {} void execute(); public: -- cgit v1.2.3