aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2011-10-24 18:34:51 +0100
committerEugene Sandulenko2011-10-25 14:56:04 +0100
commitb0fe2bbaf9dc1eece04b0acb63973adf6a1f8595 (patch)
tree2b9e2e8eb75f6141afa6e4e6e40b2e9e677f281b /gui
parent25766500c090aada2f96d05824d369acb89a77fc (diff)
downloadscummvm-rg350-b0fe2bbaf9dc1eece04b0acb63973adf6a1f8595.tar.gz
scummvm-rg350-b0fe2bbaf9dc1eece04b0acb63973adf6a1f8595.tar.bz2
scummvm-rg350-b0fe2bbaf9dc1eece04b0acb63973adf6a1f8595.zip
GUI: Made PicButtonWidget derivative of ButtonWidget
Diffstat (limited to 'gui')
-rw-r--r--gui/widget.cpp13
-rw-r--r--gui/widget.h13
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();