GUI: Allow scaling dialog and widget sizes in constructors
The resize() function has the option to do the scaling, but adding it to the construtor avoids having to then call resize(). Also this makes more explicit that by default the sizes are not scaled. The reason for not scaling by default is because values with get from the ThemeEngine are already scaled.
This commit is contained in:
parent
77728fcf73
commit
b1fcd15cad
12 changed files with 107 additions and 40 deletions
|
@ -37,8 +37,8 @@ namespace GUI {
|
|||
* ...
|
||||
*/
|
||||
|
||||
Dialog::Dialog(int x, int y, int w, int h)
|
||||
: GuiObject(x, y, w, h),
|
||||
Dialog::Dialog(int x, int y, int w, int h, bool scale)
|
||||
: GuiObject(x, y, w, h, scale),
|
||||
_mouseWidget(nullptr), _focusedWidget(nullptr), _dragWidget(nullptr), _tickleWidget(nullptr), _visible(false),
|
||||
_backgroundType(GUI::ThemeEngine::kDialogBackgroundDefault) {
|
||||
// Some dialogs like LauncherDialog use internally a fixed size, even though
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
int _result;
|
||||
|
||||
public:
|
||||
Dialog(int x, int y, int w, int h);
|
||||
Dialog(int x, int y, int w, int h, bool scale = false);
|
||||
Dialog(const Common::String &name);
|
||||
|
||||
virtual int runModal();
|
||||
|
|
|
@ -30,11 +30,18 @@ namespace GUI {
|
|||
|
||||
#define SCALEVALUE(val) (val > 0 ? val * g_gui.getScaleFactor() : val)
|
||||
|
||||
GuiObject::GuiObject(int x, int y, int w, int h) : _useRTL(true), _firstWidget(nullptr) {
|
||||
_x = x;
|
||||
_y = y;
|
||||
_w = w;
|
||||
_h = h;
|
||||
GuiObject::GuiObject(int x, int y, int w, int h, bool scale) : _useRTL(true), _firstWidget(nullptr) {
|
||||
if (scale) {
|
||||
_x = SCALEVALUE(x);
|
||||
_y = SCALEVALUE(y);
|
||||
_w = SCALEVALUE(w);
|
||||
_h = SCALEVALUE(h);
|
||||
} else {
|
||||
_x = x;
|
||||
_y = y;
|
||||
_w = w;
|
||||
_h = h;
|
||||
}
|
||||
}
|
||||
|
||||
GuiObject::GuiObject(const Common::String &name)
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
Widget *_firstWidget;
|
||||
|
||||
public:
|
||||
GuiObject(int x, int y, int w, int h);
|
||||
GuiObject(int x, int y, int w, int h, bool scale = false);
|
||||
GuiObject(const Common::String &name);
|
||||
~GuiObject() override;
|
||||
|
||||
|
|
|
@ -36,12 +36,16 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip)
|
||||
: GuiObject(x, y, w, h), _type(0), _boss(boss), _tooltip(tooltip),
|
||||
Widget::Widget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip)
|
||||
: GuiObject(x, y, w, h, scale), _type(0), _boss(boss), _tooltip(tooltip),
|
||||
_flags(0), _hasFocus(false), _state(ThemeEngine::kStateEnabled) {
|
||||
init();
|
||||
}
|
||||
|
||||
Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip)
|
||||
: Widget(boss, x, y, w, h, false, tooltip) {
|
||||
}
|
||||
|
||||
Widget::Widget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip)
|
||||
: GuiObject(name), _type(0), _boss(boss), _tooltip(tooltip),
|
||||
_flags(0), _hasFocus(false), _state(ThemeEngine::kStateDisabled) {
|
||||
|
@ -281,8 +285,8 @@ void Widget::read(const Common::U32String &str) {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
|
||||
: Widget(boss, x, y, w, h, tooltip) {
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
|
||||
: Widget(boss, x, y, w, h, scale, tooltip) {
|
||||
setFlags(WIDGET_ENABLED);
|
||||
_type = kStaticTextWidget;
|
||||
_label = text;
|
||||
|
@ -292,6 +296,10 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
|
|||
_useEllipsis = useEllipsis;
|
||||
}
|
||||
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
|
||||
: StaticTextWidget(boss, x, y, w, h, false, text, align, tooltip, font, lang, useEllipsis) {
|
||||
}
|
||||
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
|
||||
: Widget(boss, name, tooltip) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
|
||||
|
@ -347,8 +355,8 @@ void StaticTextWidget::setFont(ThemeEngine::FontStyle font, Common::Language lan
|
|||
|
||||
#pragma mark -
|
||||
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel)
|
||||
: StaticTextWidget(boss, x, y, w, h, cleanupHotkey(label), Graphics::kTextAlignCenter, tooltip), CommandSender(boss),
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel)
|
||||
: StaticTextWidget(boss, x, y, w, h, scale, cleanupHotkey(label), Graphics::kTextAlignCenter, tooltip), CommandSender(boss),
|
||||
_cmd(cmd), _hotkey(hotkey), _duringPress(false) {
|
||||
_lowresLabel = cleanupHotkey(lowresLabel);
|
||||
|
||||
|
@ -365,6 +373,10 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Co
|
|||
_type = kButtonWidget;
|
||||
}
|
||||
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel)
|
||||
: ButtonWidget(boss, x, y, w, h, false, label, tooltip, cmd, hotkey, lowresLabel) {
|
||||
}
|
||||
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel)
|
||||
: StaticTextWidget(boss, name, cleanupHotkey(label), tooltip), CommandSender(boss),
|
||||
_cmd(cmd), _hotkey(hotkey), _duringPress(false) {
|
||||
|
@ -427,7 +439,7 @@ const Common::U32String &ButtonWidget::getLabel() {
|
|||
return useLowres ? _lowresLabel : _label;
|
||||
}
|
||||
|
||||
ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x, int y, int w, int h) {
|
||||
ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x, int y, int w, int h, bool scale) {
|
||||
ButtonWidget *button;
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
|
@ -435,7 +447,7 @@ ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32
|
|||
if (!name.empty())
|
||||
button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
|
||||
else
|
||||
button = new PicButtonWidget(boss, x, y, w, h, _("Clear value"), cmd);
|
||||
button = new PicButtonWidget(boss, x, y, w, h, scale, _("Clear value"), cmd);
|
||||
((PicButtonWidget *)button)->useThemeTransparency(true);
|
||||
((PicButtonWidget *)button)->setGfxFromTheme(ThemeEngine::kImageEraser, kPicButtonStateEnabled, false);
|
||||
} else
|
||||
|
@ -443,7 +455,7 @@ ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32
|
|||
if (!name.empty())
|
||||
button = new ButtonWidget(boss, name, Common::U32String("C"), _("Clear value"), cmd);
|
||||
else
|
||||
button = new ButtonWidget(boss, x, y, w, h, Common::U32String("C"), _("Clear value"), cmd);
|
||||
button = new ButtonWidget(boss, x, y, w, h, scale, Common::U32String("C"), _("Clear value"), cmd);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -466,13 +478,17 @@ void ButtonWidget::setUnpressedState() {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
DropdownButtonWidget::DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel) :
|
||||
ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey, lowresLabel) {
|
||||
DropdownButtonWidget::DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel) :
|
||||
ButtonWidget(boss, x, y, w, h, scale, label, tooltip, cmd, hotkey, lowresLabel) {
|
||||
setFlags(getFlags() | WIDGET_TRACK_MOUSE);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
DropdownButtonWidget::DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel) :
|
||||
DropdownButtonWidget(boss, x, y, w, h, false, label, tooltip, cmd, hotkey, lowresLabel) {
|
||||
}
|
||||
|
||||
DropdownButtonWidget::DropdownButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey, const Common::U32String &lowresLabel) :
|
||||
ButtonWidget(boss, name, label, tooltip, cmd, hotkey, lowresLabel) {
|
||||
setFlags(getFlags() | WIDGET_TRACK_MOUSE);
|
||||
|
@ -593,14 +609,18 @@ const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, in
|
|||
return new Graphics::ManagedSurface(gfx->rawSurface().scale(w, h, filtering));
|
||||
}
|
||||
|
||||
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, Common::U32String(), tooltip, cmd, hotkey),
|
||||
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, scale, Common::U32String(), tooltip, cmd, hotkey),
|
||||
_alpha(255), _transparency(false), _showButton(true) {
|
||||
|
||||
setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
|
||||
_type = kButtonWidget;
|
||||
}
|
||||
|
||||
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: PicButtonWidget(boss, x, y, w, h, false, tooltip, cmd, hotkey) {
|
||||
}
|
||||
|
||||
PicButtonWidget::PicButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, name, Common::U32String(), tooltip, cmd, hotkey),
|
||||
_alpha(255), _transparency(false), _showButton(true) {
|
||||
|
@ -697,13 +717,17 @@ void PicButtonWidget::drawWidget() {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false), _overrideText(false) {
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, scale, label, tooltip, cmd, hotkey), _state(false), _overrideText(false) {
|
||||
setFlags(WIDGET_ENABLED);
|
||||
_type = kCheckboxWidget;
|
||||
_spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
|
||||
}
|
||||
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: CheckboxWidget(boss, x, y, w, h, false, label, tooltip, cmd, hotkey) {
|
||||
}
|
||||
|
||||
CheckboxWidget::CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
|
||||
: ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false), _overrideText(false) {
|
||||
setFlags(WIDGET_ENABLED);
|
||||
|
@ -766,14 +790,18 @@ void RadiobuttonGroup::setEnabled(bool ena) {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, label, tooltip, 0, hotkey), _state(false), _value(value), _group(group) {
|
||||
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip, uint8 hotkey)
|
||||
: ButtonWidget(boss, x, y, w, h, scale, label, tooltip, 0, hotkey), _state(false), _value(value), _group(group) {
|
||||
setFlags(WIDGET_ENABLED);
|
||||
_type = kRadiobuttonWidget;
|
||||
_group->addButton(this);
|
||||
_spacing = g_gui.xmlEval()->getVar("Globals.Radiobutton.Spacing", 15);
|
||||
}
|
||||
|
||||
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip, uint8 hotkey)
|
||||
: RadiobuttonWidget(boss, x, y, w, h, false, group, value, label, tooltip, hotkey) {
|
||||
}
|
||||
|
||||
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, const Common::String &name, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip, uint8 hotkey)
|
||||
: ButtonWidget(boss, name, label, tooltip, 0, hotkey), _state(false), _value(value), _group(group) {
|
||||
setFlags(WIDGET_ENABLED);
|
||||
|
@ -810,13 +838,17 @@ void RadiobuttonWidget::drawWidget() {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, x, y, w, h, tooltip), CommandSender(boss),
|
||||
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, x, y, w, h, scale, tooltip), CommandSender(boss),
|
||||
_cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false), _labelWidth(0) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG);
|
||||
_type = kSliderWidget;
|
||||
}
|
||||
|
||||
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: SliderWidget(boss, x, y, w, h, false, tooltip, cmd) {
|
||||
}
|
||||
|
||||
SliderWidget::SliderWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, name, tooltip), CommandSender(boss),
|
||||
_cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false), _labelWidth(0) {
|
||||
|
@ -896,12 +928,16 @@ int SliderWidget::posToValue(int pos) {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
GraphicsWidget::GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip)
|
||||
: Widget(boss, x, y, w, h, tooltip), _gfx(), _alpha(255), _transparency(false) {
|
||||
GraphicsWidget::GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip)
|
||||
: Widget(boss, x, y, w, h, scale, tooltip), _gfx(), _alpha(255), _transparency(false) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
|
||||
_type = kGraphicsWidget;
|
||||
}
|
||||
|
||||
GraphicsWidget::GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip)
|
||||
: GraphicsWidget(boss, x, y, w, h, false, tooltip) {
|
||||
}
|
||||
|
||||
GraphicsWidget::GraphicsWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip)
|
||||
: Widget(boss, name, tooltip), _gfx(), _alpha(255), _transparency(false) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
|
||||
|
@ -985,8 +1021,8 @@ void GraphicsWidget::drawWidget() {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
ContainerWidget::ContainerWidget(GuiObject *boss, int x, int y, int w, int h) :
|
||||
Widget(boss, x, y, w, h),
|
||||
ContainerWidget::ContainerWidget(GuiObject *boss, int x, int y, int w, int h, bool scale) :
|
||||
Widget(boss, x, y, w, h, scale),
|
||||
_backgroundType(ThemeEngine::kWidgetBackgroundBorder) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
|
||||
_type = kContainerWidget;
|
||||
|
|
13
gui/widget.h
13
gui/widget.h
|
@ -114,6 +114,7 @@ public:
|
|||
static bool containsWidgetInChain(Widget *start, Widget *search);
|
||||
|
||||
public:
|
||||
Widget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String());
|
||||
Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String());
|
||||
Widget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String());
|
||||
~Widget() override;
|
||||
|
@ -205,6 +206,7 @@ protected:
|
|||
bool _useEllipsis;
|
||||
|
||||
public:
|
||||
StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
|
||||
StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
|
||||
StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true);
|
||||
void setValue(int value);
|
||||
|
@ -231,6 +233,7 @@ protected:
|
|||
uint8 _lowresHotkey;
|
||||
Common::U32String _lowresLabel;
|
||||
public:
|
||||
ButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
ButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
|
||||
|
@ -260,6 +263,7 @@ protected:
|
|||
/* DropdownButtonWidget */
|
||||
class DropdownButtonWidget : public ButtonWidget {
|
||||
public:
|
||||
DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
DropdownButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
DropdownButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0, const Common::U32String &lowresLabel = Common::U32String());
|
||||
|
||||
|
@ -295,6 +299,7 @@ protected:
|
|||
/* PicButtonWidget */
|
||||
class PicButtonWidget : public ButtonWidget {
|
||||
public:
|
||||
PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
PicButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
~PicButtonWidget() override;
|
||||
|
@ -324,6 +329,7 @@ protected:
|
|||
bool _overrideText;
|
||||
int _spacing;
|
||||
public:
|
||||
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
|
||||
|
||||
|
@ -373,6 +379,7 @@ protected:
|
|||
int _value;
|
||||
|
||||
public:
|
||||
RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
|
||||
RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
|
||||
RadiobuttonWidget(GuiObject *boss, const Common::String &name, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint8 hotkey = 0);
|
||||
|
||||
|
@ -400,6 +407,7 @@ protected:
|
|||
bool _isDragging;
|
||||
uint _labelWidth;
|
||||
public:
|
||||
SliderWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
SliderWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
SliderWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
|
||||
|
@ -432,6 +440,7 @@ protected:
|
|||
/* GraphicsWidget */
|
||||
class GraphicsWidget : public Widget {
|
||||
public:
|
||||
GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String());
|
||||
GraphicsWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String());
|
||||
GraphicsWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String());
|
||||
~GraphicsWidget() override;
|
||||
|
@ -455,7 +464,7 @@ protected:
|
|||
/* ContainerWidget */
|
||||
class ContainerWidget : public Widget {
|
||||
public:
|
||||
ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
ContainerWidget(GuiObject *boss, int x, int y, int w, int h, bool scale = false);
|
||||
ContainerWidget(GuiObject *boss, const Common::String &name);
|
||||
~ContainerWidget() override;
|
||||
|
||||
|
@ -538,7 +547,7 @@ private:
|
|||
ScrollContainerWidget *_scrollContainer;
|
||||
};
|
||||
|
||||
ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0);
|
||||
ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0, bool scale = false);
|
||||
const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, int w, int h, bool filtering = false);
|
||||
|
||||
} // End of namespace GUI
|
||||
|
|
|
@ -28,12 +28,16 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, x, y, w, h, tooltip), CommandSender(boss), _cmd(cmd) {
|
||||
EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, x, y, w, h, scale, tooltip), CommandSender(boss), _cmd(cmd) {
|
||||
setFlags(WIDGET_TRACK_MOUSE);
|
||||
init();
|
||||
}
|
||||
|
||||
EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: EditableWidget(boss, x, y, w, h, false, tooltip, cmd) {
|
||||
}
|
||||
|
||||
EditableWidget::EditableWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip, uint32 cmd)
|
||||
: Widget(boss, name, tooltip), CommandSender(boss), _cmd(cmd) {
|
||||
setFlags(WIDGET_TRACK_MOUSE);
|
||||
|
|
|
@ -66,6 +66,7 @@ protected:
|
|||
ThemeEngine::TextInversionState _inversion;
|
||||
|
||||
public:
|
||||
EditableWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
EditableWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
EditableWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
~EditableWidget() override;
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, const Common::U32String &tooltip, uint32 cmd, uint32 finishCmd, ThemeEngine::FontStyle font)
|
||||
: EditableWidget(boss, x, y - 1, w, h + 2, tooltip, cmd) {
|
||||
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, const Common::U32String &tooltip, uint32 cmd, uint32 finishCmd, ThemeEngine::FontStyle font)
|
||||
: EditableWidget(boss, x, y - 1, w, h + 2, scale, tooltip, cmd) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
|
||||
_type = kEditTextWidget;
|
||||
_finishCmd = finishCmd;
|
||||
|
@ -40,6 +40,10 @@ EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, cons
|
|||
setFontStyle(font);
|
||||
}
|
||||
|
||||
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, const Common::U32String &tooltip, uint32 cmd, uint32 finishCmd, ThemeEngine::FontStyle font)
|
||||
: EditTextWidget(boss, x, y, w, h, false, text, tooltip, cmd, finishCmd, font) {
|
||||
}
|
||||
|
||||
EditTextWidget::EditTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, uint32 cmd, uint32 finishCmd, ThemeEngine::FontStyle font)
|
||||
: EditableWidget(boss, name, tooltip, cmd) {
|
||||
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE);
|
||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
|||
int _rightPadding;
|
||||
|
||||
public:
|
||||
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint32 finishCmd = 0, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleNormal);
|
||||
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint32 finishCmd = 0, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleNormal);
|
||||
EditTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint32 finishCmd = 0, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleNormal);
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ ListWidget::ListWidget(Dialog *boss, const Common::String &name, const Common::U
|
|||
_topPadding = _bottomPadding = 0;
|
||||
}
|
||||
|
||||
ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: EditableWidget(boss, x, y, w, h, tooltip), _cmd(cmd) {
|
||||
ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd)
|
||||
: EditableWidget(boss, x, y, w, h, scale, tooltip), _cmd(cmd) {
|
||||
|
||||
_entriesPerPage = 0;
|
||||
_scrollBarWidth = 0;
|
||||
|
@ -116,6 +116,10 @@ ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const Common::U
|
|||
_scrollBarWidth = 0;
|
||||
}
|
||||
|
||||
ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd)
|
||||
: ListWidget(boss, x, y, w, h, false, tooltip, cmd) {
|
||||
}
|
||||
|
||||
void ListWidget::copyListData(const Common::U32StringArray &list) {
|
||||
Common::U32String stripped;
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ protected:
|
|||
|
||||
public:
|
||||
ListWidget(Dialog *boss, const Common::String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
ListWidget(Dialog *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
ListWidget(Dialog *boss, int x, int y, int w, int h, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
|
||||
bool containsWidget(Widget *) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue