diff options
-rw-r--r-- | gui/widget.cpp | 13 | ||||
-rw-r--r-- | gui/widget.h | 13 |
2 files changed, 5 insertions, 21 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp index c4d288eb11..d11ebda821 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -305,16 +305,16 @@ void ButtonWidget::setLabel(const Common::String &label) { #pragma mark - PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd, uint8 hotkey) - : Widget(boss, x, y, w, h, tooltip), CommandSender(boss), - _cmd(cmd), _hotkey(hotkey), _gfx(), _alpha(256), _transparency(false) { + : ButtonWidget(boss, x, y, w, h, "", tooltip, cmd, hotkey), + _gfx(), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); _type = kButtonWidget; } PicButtonWidget::PicButtonWidget(GuiObject *boss, const Common::String &name, const char *tooltip, uint32 cmd, uint8 hotkey) - : Widget(boss, name, tooltip), CommandSender(boss), - _cmd(cmd), _gfx(), _alpha(256), _transparency(false) { + : ButtonWidget(boss, name, "", tooltip, cmd, hotkey), + _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); _type = kButtonWidget; } @@ -323,11 +323,6 @@ PicButtonWidget::~PicButtonWidget() { _gfx.free(); } -void PicButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) { - if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) - sendCommand(_cmd, 0); -} - void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); diff --git a/gui/widget.h b/gui/widget.h index acd575a90b..428ab7981e 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -197,28 +197,17 @@ protected: }; /* PicButtonWidget */ -class PicButtonWidget : public Widget, public CommandSender { - friend class Dialog; // Needed for the hotkey handling -protected: - uint32 _cmd; - uint8 _hotkey; +class PicButtonWidget : public ButtonWidget { public: PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip = 0, uint32 cmd = 0, uint8 hotkey = 0); PicButtonWidget(GuiObject *boss, const Common::String &name, const char *tooltip = 0, uint32 cmd = 0, uint8 hotkey = 0); ~PicButtonWidget(); - void setCmd(uint32 cmd) { _cmd = cmd; } - uint32 getCmd() const { return _cmd; } - void setGfx(const Graphics::Surface *gfx); void useAlpha(int alpha) { _alpha = alpha; } void useThemeTransparency(bool enable) { _transparency = enable; } - void handleMouseUp(int x, int y, int button, int clickCount); - void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); } - void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); } - protected: void drawWidget(); |