diff options
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r-- | gui/widget.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp index d11ebda821..82007c588f 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -23,6 +23,7 @@ #include "common/system.h" #include "common/rect.h" #include "common/textconsole.h" +#include "common/translation.h" #include "graphics/pixelformat.h" #include "gui/widget.h" #include "gui/gui-manager.h" @@ -302,6 +303,27 @@ void ButtonWidget::setLabel(const Common::String &label) { StaticTextWidget::setLabel(cleanupHotkey(label)); } +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()) { + 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 + 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; +} + #pragma mark - PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd, uint8 hotkey) |