aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorTarek Soliman2011-12-12 21:26:00 -0600
committerTarek Soliman2011-12-13 08:37:18 -0600
commitbe0f8407b69f7878cd2e0a42856fd4ccd0c695e0 (patch)
tree297fb77b3e3311879b01a5ec17ae9cd61bc06e82 /gui
parentc6e001a1f5f76735f695301a6a1faeda90c284e6 (diff)
downloadscummvm-rg350-be0f8407b69f7878cd2e0a42856fd4ccd0c695e0.tar.gz
scummvm-rg350-be0f8407b69f7878cd2e0a42856fd4ccd0c695e0.tar.bz2
scummvm-rg350-be0f8407b69f7878cd2e0a42856fd4ccd0c695e0.zip
GUI: Handle adding clear buttons that don't exist in layouts
The buttons in the keymapper are dynamically generated and don't exist in the layout; They have no name.
Diffstat (limited to 'gui')
-rw-r--r--gui/widget.cpp12
-rw-r--r--gui/widget.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 9fa864e7b9..82007c588f 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -303,17 +303,23 @@ void ButtonWidget::setLabel(const Common::String &label) {
StaticTextWidget::setLabel(cleanupHotkey(label));
}
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x, int y, int w, int h) {
ButtonWidget *button;
#ifndef DISABLE_FANCY_THEMES
if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
- button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
+ if (!name.empty())
+ button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
+ else
+ button = new PicButtonWidget(boss, x, y, w, h, _("Clear value"), cmd);
((PicButtonWidget *)button)->useThemeTransparency(true);
((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
} else
#endif
- button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
+ if (!name.empty())
+ button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
+ else
+ button = new ButtonWidget(boss, x, y, w, h, "C", _("Clear value"), cmd);
return button;
}
diff --git a/gui/widget.h b/gui/widget.h
index 9894dc4526..789fc09231 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -354,7 +354,7 @@ protected:
void drawWidget();
};
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0);
} // End of namespace GUI