aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/dialog.cpp5
-rw-r--r--gui/dialog.h2
-rw-r--r--gui/widget.cpp30
-rw-r--r--gui/widget.h19
4 files changed, 17 insertions, 39 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 65c1e62c06..58d308795b 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -275,8 +275,3 @@ Widget *Dialog::findWidget(int x, int y) {
ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey) {
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
}
-
-PushButtonWidget *Dialog::addPushButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey) {
- return new PushButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
-}
-
diff --git a/gui/dialog.h b/gui/dialog.h
index 81e519d3b3..46cf2bac7e 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -28,7 +28,6 @@
class NewGui;
class ButtonWidget;
-class PushButtonWidget;
// Some "common" commands sent to handleCommand()
enum {
@@ -77,7 +76,6 @@ protected:
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
ButtonWidget *addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey);
- PushButtonWidget *addPushButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey);
void setResult(int result) { _result = result; }
};
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 35e8535479..41926de51f 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -135,24 +135,8 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
void ButtonWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
gui->drawString(_label, _x, _y, _w,
- !isEnabled() ? gui->_color :
- hilite ? gui->_textcolorhi : gui->_textcolor, _align);
-}
-
-#pragma mark -
-
-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;
-}
-
-void PushButtonWidget::setState(bool state) {
- if (_state != state) {
- _state = state;
- _flags ^= WIDGET_INV_BORDER;
- draw();
- }
+ !isEnabled() ? gui->_color :
+ hilite ? gui->_textcolorhi : gui->_textcolor, _align);
}
#pragma mark -
@@ -170,7 +154,7 @@ static uint32 checked_img[8] = {
};
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) {
+ : ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) {
_flags = WIDGET_ENABLED;
_type = kCheckboxWidget;
}
@@ -182,6 +166,14 @@ void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) {
}
}
+void CheckboxWidget::setState(bool state) {
+ if (_state != state) {
+ _state = state;
+ _flags ^= WIDGET_INV_BORDER;
+ draw();
+ }
+}
+
void CheckboxWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
diff --git a/gui/widget.h b/gui/widget.h
index fe6ae0b8c3..37382c1914 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -159,21 +159,10 @@ protected:
void drawWidget(bool hilite);
};
-/* PushButtonWidget */
-class PushButtonWidget : public ButtonWidget {
-protected:
- bool _state;
-public:
- PushButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
-
- void setState(bool state);
- void toggleState() { setState(!_state); }
- bool getState() const { return _state; }
-};
-
/* CheckboxWidget */
-class CheckboxWidget : public PushButtonWidget {
+class CheckboxWidget : public ButtonWidget {
protected:
+ bool _state;
public:
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
@@ -181,6 +170,10 @@ public:
virtual void handleMouseEntered(int button) {}
virtual void handleMouseLeft(int button) {}
+ void setState(bool state);
+ void toggleState() { setState(!_state); }
+ bool getState() const { return _state; }
+
protected:
void drawWidget(bool hilite);
};