Skip to content

Commit

Permalink
GUI: Move addClearButton() from options.cpp to widget.cpp
Browse files Browse the repository at this point in the history
This is so it can be used outside options.cpp
  • Loading branch information
tsoliman committed Dec 13, 2011
1 parent d6ee598 commit c6e001a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
16 changes: 0 additions & 16 deletions gui/options.cpp
Expand Up @@ -1033,22 +1033,6 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se
ConfMan.removeKey(setting, _domain);
}

ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
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);
((PicButtonWidget *)button)->useThemeTransparency(true);
((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
} else
#endif
button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);

return button;
}


int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
if (_guioptions.contains(GUIO_NOSUBTITLES))
return kSubtitlesSpeech; // Speech only
Expand Down
2 changes: 0 additions & 2 deletions gui/options.h
Expand Up @@ -43,8 +43,6 @@ class GuiObject;
class RadiobuttonGroup;
class RadiobuttonWidget;

ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);

class OptionsDialog : public Dialog {
public:
OptionsDialog(const Common::String &domain, int x, int y, int w, int h);
Expand Down
16 changes: 16 additions & 0 deletions gui/widget.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -302,6 +303,21 @@ void ButtonWidget::setLabel(const Common::String &label) {
StaticTextWidget::setLabel(cleanupHotkey(label));
}

ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
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);
((PicButtonWidget *)button)->useThemeTransparency(true);
((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
} else
#endif
button = new ButtonWidget(boss, name, "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)
Expand Down
2 changes: 2 additions & 0 deletions gui/widget.h
Expand Up @@ -354,6 +354,8 @@ class ContainerWidget : public Widget {
void drawWidget();
};

ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);

} // End of namespace GUI

#endif
1 change: 1 addition & 0 deletions po/POTFILES
Expand Up @@ -13,6 +13,7 @@ gui/options.cpp
gui/saveload.cpp
gui/themebrowser.cpp
gui/ThemeEngine.cpp
gui/widget.cpp

base/main.cpp

Expand Down

0 comments on commit c6e001a

Please sign in to comment.