aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.h
diff options
context:
space:
mode:
authorMax Horn2002-07-10 22:49:41 +0000
committerMax Horn2002-07-10 22:49:41 +0000
commitc60670d561b0ad8106cd54adf163a0c39412575e (patch)
tree63cf3e40942ca6e8f8bc61649abc5beb286fb657 /gui/widget.h
parent9b3784ef6dcb26e4864844cc626e472ae49393b2 (diff)
downloadscummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.tar.gz
scummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.tar.bz2
scummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.zip
added prototype ListWidget (doesn't do anything yet, only serves to demo how it might look); renamed various NewGui methods and added frameRect method; made NewGui use our 'own' GUI colors (no worries if you don't like them, this is just an experiment); StaticTextWidget now clones its label (preventing problems when a game was loaded, thus invalidating string locations in memory)
svn-id: r4513
Diffstat (limited to 'gui/widget.h')
-rw-r--r--gui/widget.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/gui/widget.h b/gui/widget.h
index 651b86a12d..a061e31c85 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -40,7 +40,8 @@ enum {
kStaticTextWidget = 'TEXT',
kButtonWidget = 'BTTN',
kCheckboxWidget = 'CHKB',
- kSliderWidget = 'SLDE'
+ kSliderWidget = 'SLDE',
+ kListWidget = 'LIST'
};
/* Widget */
@@ -56,11 +57,13 @@ protected:
int _flags;
public:
Widget(Dialog *boss, int x, int y, int w, int h);
+ virtual ~Widget() {}
- virtual void handleClick(int button) {}
- virtual void handleMouseEntered(int button) {}
- virtual void handleMouseLeft(int button) {}
+ virtual void handleClick(int button) {}
+ virtual void handleMouseEntered(int button) {}
+ virtual void handleMouseLeft(int button) {}
virtual void handleMouseMoved(int x, int y, int button) {}
+ virtual void handleKey(char key, int modifiers) {}
void draw();
void setFlags(int flags) { _flags |= flags; }
@@ -75,11 +78,12 @@ protected:
/* StaticTextWidget */
class StaticTextWidget : public Widget {
protected:
- const char *_text;
+ char *_text;
public:
StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text);
+ ~StaticTextWidget();
void setText(const char *text);
- const char *getText();
+ const char *getText() const { return _text; }
protected:
void drawWidget(bool hilite);
@@ -95,7 +99,7 @@ protected:
public:
ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd = 0, uint8 hotkey = 0);
void setCmd(uint32 cmd) { _cmd = cmd; }
- uint32 getCmd() { return _cmd; }
+ uint32 getCmd() const { return _cmd; }
void handleClick(int button);
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
@@ -109,7 +113,7 @@ protected:
public:
CheckboxWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd = 0, uint8 hotkey = 0);
void setState(bool state) { _state = state; }
- bool getState() { return _state; }
+ bool getState() const { return _state; }
void handleClick(int button);
virtual void handleMouseEntered(int button) {}
@@ -126,7 +130,7 @@ protected:
public:
SliderWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd = 0, uint8 hotkey = 0);
void setValue(uint8 value) { _value = value; }
- uint8 getValue() { return _value; }
+ uint8 getValue() const { return _value; }
void handleMouseMoved(int x, int y, int button);
@@ -135,5 +139,4 @@ protected:
};
-
#endif