aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
authorMax Horn2003-11-02 14:50:53 +0000
committerMax Horn2003-11-02 14:50:53 +0000
commite9ae86bb76bf6087a1bb11f6158fd96676572866 (patch)
tree6d2035662a6c88338b15e5e884f7a2da8a4fe155 /gui/widget.cpp
parent70a1d438154a2becf5f55224cb34ba44317c2e86 (diff)
downloadscummvm-rg350-e9ae86bb76bf6087a1bb11f6158fd96676572866.tar.gz
scummvm-rg350-e9ae86bb76bf6087a1bb11f6158fd96676572866.tar.bz2
scummvm-rg350-e9ae86bb76bf6087a1bb11f6158fd96676572866.zip
introduced common base class GuiObject for Dialog/Widget -> step towards making it possible to nest widgets (needed for TabWidget)
svn-id: r11052
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index f20dbf4624..b0ab5889b0 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -23,8 +23,9 @@
#include "dialog.h"
#include "newgui.h"
-Widget::Widget(Dialog *boss, int x, int y, int w, int h)
- : _type(0), _boss(boss), _x(x), _y(y), _w(w), _h(h),
+
+Widget::Widget(GuiObject *boss, int x, int y, int w, int h)
+ : GuiObject(x, y, w, h), _type(0), _boss(boss),
_id(0), _flags(0), _hasFocus(false) {
// Insert into the widget list of the boss
_next = _boss->_firstWidget;
@@ -72,9 +73,10 @@ void Widget::draw() {
_y -= _boss->_y;
}
+
#pragma mark -
-StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text, int align)
+StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, int align)
: Widget(boss, x, y, w, h), _align(align) {
_type = kStaticTextWidget;
setLabel(text);
@@ -93,7 +95,7 @@ void StaticTextWidget::drawWidget(bool hilite) {
#pragma mark -
-ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
+ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
: StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter), CommandSender(boss),
_cmd(cmd), _hotkey(hotkey) {
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
@@ -114,7 +116,7 @@ void ButtonWidget::drawWidget(bool hilite) {
#pragma mark -
-PushButtonWidget::PushButtonWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
+PushButtonWidget::PushButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) {
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
_type = kButtonWidget;
@@ -142,7 +144,7 @@ static uint32 checked_img[8] = {
0x00000000,
};
-CheckboxWidget::CheckboxWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
+CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
: PushButtonWidget(boss, x, y, w, h, label, cmd, hotkey) {
_flags = WIDGET_ENABLED;
_type = kCheckboxWidget;
@@ -173,7 +175,7 @@ void CheckboxWidget::drawWidget(bool hilite) {
#pragma mark -
-SliderWidget::SliderWidget(Dialog *boss, int x, int y, int w, int h, uint32 cmd, uint8 hotkey)
+SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd, uint8 hotkey)
: ButtonWidget(boss, x, y, w, h, "", cmd, hotkey),
_value(0), _oldValue(0),_valueMin(0), _valueMax(100), _isDragging(false) {
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;