mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
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.
This commit is contained in:
parent
c6e001a1f5
commit
be0f8407b6
@ -303,17 +303,23 @@ void ButtonWidget::setLabel(const Common::String &label) {
|
|||||||
StaticTextWidget::setLabel(cleanupHotkey(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;
|
ButtonWidget *button;
|
||||||
|
|
||||||
#ifndef DISABLE_FANCY_THEMES
|
#ifndef DISABLE_FANCY_THEMES
|
||||||
if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
|
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)->useThemeTransparency(true);
|
||||||
((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
|
((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
|
||||||
} else
|
} else
|
||||||
#endif
|
#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;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ protected:
|
|||||||
void drawWidget();
|
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
|
} // End of namespace GUI
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user