From be0f8407b69f7878cd2e0a42856fd4ccd0c695e0 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 12 Dec 2011 21:26:00 -0600 Subject: 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. --- gui/widget.cpp | 12 +++++++++--- gui/widget.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gui') 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 -- cgit v1.2.3