summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/attrs/changedisplay.cpp2
-rw-r--r--src/gui/widgets/button.cpp23
-rw-r--r--src/gui/widgets/button.h12
-rw-r--r--src/gui/widgets/characterviewsmall.cpp4
-rw-r--r--src/gui/widgets/pincode.cpp7
-rw-r--r--src/gui/widgets/selldialog.cpp41
-rw-r--r--src/gui/widgets/setupbuttonitem.cpp6
-rw-r--r--src/gui/widgets/setupitem.cpp24
-rw-r--r--src/gui/widgets/setupquickitem.cpp6
-rw-r--r--src/gui/widgets/sliderlist.cpp12
-rw-r--r--src/gui/widgets/tabbedarea.cpp12
-rw-r--r--src/gui/widgets/tabs/setup_input.cpp12
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp6
-rw-r--r--src/gui/widgets/tabs/setup_relations.cpp3
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp3
-rw-r--r--src/gui/widgets/tabstrip.cpp3
17 files changed, 131 insertions, 47 deletions
diff --git a/src/gui/widgets/attrs/changedisplay.cpp b/src/gui/widgets/attrs/changedisplay.cpp
index bcde30bfd..c094eafb3 100644
--- a/src/gui/widgets/attrs/changedisplay.cpp
+++ b/src/gui/widgets/attrs/changedisplay.cpp
@@ -47,7 +47,7 @@ ChangeDisplay::ChangeDisplay(const Widget2 *const widget,
// TRANSLATORS: status window label
mPoints(new Label(this, _("Max"))),
// TRANSLATORS: status window label (plus sign)
- mInc(new Button(this, _("+"), "inc", this))
+ mInc(new Button(this, _("+"), "inc", BUTTON_SKIN, this))
{
// Do the layout
ContainerPlacer place = mLayout->getPlacer(0, 0);
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 7a0fdef7d..dc3a7d063 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -95,7 +95,8 @@ static std::string const data[Button::BUTTON_COUNT] =
"_disabled.xml"
};
-Button::Button(const Widget2 *const widget) :
+Button::Button(const Widget2 *const widget,
+ const std::string &restrict skinName) :
Widget(widget),
MouseListener(),
KeyListener(),
@@ -104,7 +105,7 @@ Button::Button(const Widget2 *const widget) :
mSkin(),
mCaption(),
mDescription(),
- mSkinName(BUTTON_SKIN),
+ mSkinName(skinName),
mTextChunk(),
mVertexes2(new ImageCollection),
mEnabledColor(getThemeColor(ThemeColorId::BUTTON, 255U)),
@@ -142,6 +143,7 @@ Button::Button(const Widget2 *const widget) :
Button::Button(const Widget2 *const widget,
const std::string &restrict caption,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener) :
Widget(widget),
MouseListener(),
@@ -151,7 +153,7 @@ Button::Button(const Widget2 *const widget,
mSkin(),
mCaption(caption),
mDescription(),
- mSkinName(BUTTON_SKIN),
+ mSkinName(skinName),
mTextChunk(),
mVertexes2(new ImageCollection),
mEnabledColor(getThemeColor(ThemeColorId::BUTTON, 255U)),
@@ -193,8 +195,10 @@ Button::Button(const Widget2 *const widget,
Button::Button(const Widget2 *const widget,
const std::string &restrict caption,
const std::string &restrict imageName,
- const int imageWidth, const int imageHeight,
+ const int imageWidth,
+ const int imageHeight,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener) :
Widget(widget),
MouseListener(),
@@ -204,7 +208,7 @@ Button::Button(const Widget2 *const widget,
mSkin(),
mCaption(caption),
mDescription(),
- mSkinName(BUTTON_SKIN),
+ mSkinName(skinName),
mTextChunk(),
mVertexes2(new ImageCollection),
mEnabledColor(getThemeColor(ThemeColorId::BUTTON, 255U)),
@@ -246,8 +250,10 @@ Button::Button(const Widget2 *const widget,
Button::Button(const Widget2 *const widget,
const std::string &restrict imageName,
- const int imageWidth, const int imageHeight,
+ const int imageWidth,
+ const int imageHeight,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener) :
Widget(widget),
MouseListener(),
@@ -257,7 +263,7 @@ Button::Button(const Widget2 *const widget,
mSkin(),
mCaption(),
mDescription(),
- mSkinName(BUTTON_SKIN),
+ mSkinName(skinName),
mTextChunk(),
mVertexes2(new ImageCollection),
mEnabledColor(getThemeColor(ThemeColorId::BUTTON, 255U)),
@@ -301,6 +307,7 @@ Button::Button(const Widget2 *const widget,
const std::string &restrict caption,
const std::string &restrict imageName,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener) :
Widget(widget),
MouseListener(),
@@ -310,7 +317,7 @@ Button::Button(const Widget2 *const widget,
mSkin(),
mCaption(caption),
mDescription(),
- mSkinName(BUTTON_SKIN),
+ mSkinName(skinName),
mTextChunk(),
mVertexes2(new ImageCollection),
mEnabledColor(getThemeColor(ThemeColorId::BUTTON, 255U)),
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index bd0766323..92ab1fa41 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -102,7 +102,8 @@ class Button final : public Widget,
/**
* Default constructor.
*/
- explicit Button(const Widget2 *const widget);
+ Button(const Widget2 *const widget,
+ const std::string &restrict skinName);
/**
* Constructor, sets the caption of the button to the given string and
@@ -111,6 +112,7 @@ class Button final : public Widget,
Button(const Widget2 *const widget,
const std::string &restrict caption,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener);
/**
@@ -121,7 +123,8 @@ class Button final : public Widget,
const std::string &restrict caption,
const std::string &restrict imageName,
const int imageWidth, const int imageHeight,
- const std::string &actionEventId,
+ const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener);
/**
@@ -130,8 +133,10 @@ class Button final : public Widget,
*/
Button(const Widget2 *const widget,
const std::string &restrict imageName,
- const int imageWidth, const int imageHeight,
+ const int imageWidth,
+ const int imageHeight,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener);
/**
@@ -142,6 +147,7 @@ class Button final : public Widget,
const std::string &restrict imageName,
const std::string &restrict caption,
const std::string &restrict actionEventId,
+ const std::string &restrict skinName,
ActionListener *const listener);
A_DELETE_COPY(Button)
diff --git a/src/gui/widgets/characterviewsmall.cpp b/src/gui/widgets/characterviewsmall.cpp
index e2b359e66..9d8a937e3 100644
--- a/src/gui/widgets/characterviewsmall.cpp
+++ b/src/gui/widgets/characterviewsmall.cpp
@@ -35,8 +35,8 @@ CharacterViewSmall::CharacterViewSmall(CharSelectDialog *const widget,
const int padding) :
CharacterViewBase(widget, padding),
mSelectedEntry(nullptr),
- mPrevious(new Button(this, "<", "prev", this)),
- mNext(new Button(this, ">", "next", this)),
+ mPrevious(new Button(this, "<", "prev", BUTTON_SKIN, this)),
+ mNext(new Button(this, ">", "next", BUTTON_SKIN, this)),
mNumber(new Label(this, "??")),
mCharacterEntries(entries)
{
diff --git a/src/gui/widgets/pincode.cpp b/src/gui/widgets/pincode.cpp
index d05684056..e0f0ce3d8 100644
--- a/src/gui/widgets/pincode.cpp
+++ b/src/gui/widgets/pincode.cpp
@@ -94,7 +94,11 @@ void Pincode::addButtons()
for (int f = 0; f < 10; f ++)
{
const std::string str = toString(f);
- mButtons[f] = new Button(this, str, str, this);
+ mButtons[f] = new Button(this,
+ str,
+ str,
+ BUTTON_SKIN,
+ this);
mButtons[f]->adjustSize();
const Rect &rect = mButtons[f]->getDimension();
if (rect.width > buttonWidth)
@@ -122,6 +126,7 @@ void Pincode::addButtons()
// TRANSLATORS: clear pin code button
_("Clear"),
"clear",
+ BUTTON_SKIN,
this);
mButtons[10]->adjustSize();
add(mButtons[10]);
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 1d2b7a91c..dc612c0ac 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -114,9 +114,14 @@ void SellDialog::postInit()
// TRANSLATORS: sell dialog button
mAdvanced == Advanced_true ? _("Add") : _("Sell"),
"presell",
+ BUTTON_SKIN,
+ this);
+ mQuitButton = new Button(this,
+ // TRANSLATORS: sell dialog button
+ _("Quit"),
+ "quit",
+ BUTTON_SKIN,
this);
- // TRANSLATORS: sell dialog button
- mQuitButton = new Button(this, _("Quit"), "quit", this);
initButtons();
@@ -133,12 +138,24 @@ void SellDialog::postInit()
if (mIsSell == IsSell_true)
{
- // TRANSLATORS: sell dialog button
- mIncreaseButton = new Button(this, _("+"), "inc", this);
- // TRANSLATORS: sell dialog button
- mDecreaseButton = new Button(this, _("-"), "dec", this);
- // TRANSLATORS: sell dialog button
- mAddMaxButton = new Button(this, _("Max"), "max", this);
+ mIncreaseButton = new Button(this,
+ // TRANSLATORS: sell dialog button
+ _("+"),
+ "inc",
+ BUTTON_SKIN,
+ this);
+ mDecreaseButton = new Button(this,
+ // TRANSLATORS: sell dialog button
+ _("-"),
+ "dec",
+ BUTTON_SKIN,
+ this);
+ mAddMaxButton = new Button(this,
+ // TRANSLATORS: sell dialog button
+ _("Max"),
+ "max",
+ BUTTON_SKIN,
+ this);
mSlider = new Slider(this, 1.0, 1.0);
mQuantityLabel = new Label(this, strprintf(
@@ -149,8 +166,12 @@ void SellDialog::postInit()
"", ""));
if (mAdvanced == Advanced_true)
{
- // TRANSLATORS: sell dialog button
- mConfirmButton = new Button(this, _("Sell"), "confirm", this);
+ mConfirmButton = new Button(this,
+ // TRANSLATORS: sell dialog button
+ _("Sell"),
+ "confirm",
+ BUTTON_SKIN,
+ this);
mConfirmButton->setEnabled(false);
}
diff --git a/src/gui/widgets/setupbuttonitem.cpp b/src/gui/widgets/setupbuttonitem.cpp
index 00ebe9fd8..c3c5c0d93 100644
--- a/src/gui/widgets/setupbuttonitem.cpp
+++ b/src/gui/widgets/setupbuttonitem.cpp
@@ -39,7 +39,11 @@ SetupButtonItem::SetupButtonItem(const std::string &restrict text,
mButton(nullptr)
{
mValueType = VSTR;
- mWidget = new Button(this, text, actionEventId, listener);
+ mWidget = new Button(this,
+ text,
+ actionEventId,
+ BUTTON_SKIN,
+ listener);
createControls();
}
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 507baab7d..7634a5dc9 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -373,8 +373,12 @@ void SetupItemTextField::createControls()
mParent,
mEventName,
false);
- // TRANSLATORS: setup item button
- mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent);
+ mButton = new Button(this,
+ // TRANSLATORS: setup item button
+ _("Edit"),
+ mEventName + "_EDIT",
+ BUTTON_SKIN,
+ mParent);
mWidget = mTextField;
mTextField->setWidth(200);
fixFirstItemSize(mLabel);
@@ -514,8 +518,12 @@ void SetupItemIntTextField::createControls()
mTextField->setActionEventId(mEventName);
mTextField->addActionListener(mParent);
- // TRANSLATORS: setup item button
- mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent);
+ mButton = new Button(this,
+ // TRANSLATORS: setup item button
+ _("Edit"),
+ mEventName + "_EDIT",
+ BUTTON_SKIN,
+ mParent);
mWidget = mTextField;
mTextField->setWidth(50);
fixFirstItemSize(mLabel);
@@ -1293,8 +1301,12 @@ SetupItemSound::SetupItemSound(const std::string &restrict text,
void SetupItemSound::addMoreControls()
{
- mButton = new Button(this, BUTTON_PLAY, 16, 16,
- mEventName + "_PLAY", this);
+ mButton = new Button(this,
+ BUTTON_PLAY,
+ 16, 16,
+ mEventName + "_PLAY",
+ BUTTON_SKIN,
+ this);
if (mHorizont != nullptr)
mHorizont->add(mButton);
}
diff --git a/src/gui/widgets/setupquickitem.cpp b/src/gui/widgets/setupquickitem.cpp
index 09fadab9b..c5911506d 100644
--- a/src/gui/widgets/setupquickitem.cpp
+++ b/src/gui/widgets/setupquickitem.cpp
@@ -73,7 +73,11 @@ void SetupQuickItem::createControls()
{
mHorizont = new HorizontContainer(this, 32, 2);
- mWidget = new Button(this, ">", mEventName + "_CHANGE", nullptr);
+ mWidget = new Button(this,
+ ">",
+ mEventName + "_CHANGE",
+ BUTTON_SKIN,
+ nullptr);
mLabel = new Label(this, std::string());
mLabel->setToolTip(mDescription);
mLabel->adjustSize();
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index cbe65684b..b55496815 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -58,8 +58,16 @@ void SliderList::postInit2(ActionListener *const listener,
mPrevEventId = eventId + "_prev";
mNextEventId = eventId + "_next";
- mButtons[0] = new Button(this, "<", mPrevEventId, this);
- mButtons[1] = new Button(this, ">", mNextEventId, this);
+ mButtons[0] = new Button(this,
+ "<",
+ mPrevEventId,
+ BUTTON_SKIN,
+ this);
+ mButtons[1] = new Button(this,
+ ">",
+ mNextEventId,
+ BUTTON_SKIN,
+ this);
add(mButtons[0]);
add(mLabel);
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 18e2607a0..6e9fa5e19 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -113,8 +113,16 @@ void TabbedArea::postInit()
mWidgetContainer->setOpaque(Opaque_false);
addWidgetListener(this);
- mArrowButton[0] = new Button(this, "<", "shift_left", this);
- mArrowButton[1] = new Button(this, ">", "shift_right", this);
+ mArrowButton[0] = new Button(this,
+ "<",
+ "shift_left",
+ BUTTON_SKIN,
+ this);
+ mArrowButton[1] = new Button(this,
+ ">",
+ "shift_right",
+ BUTTON_SKIN,
+ this);
widgetResized(Event(nullptr));
}
diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp
index c2e451aed..adf9245bf 100644
--- a/src/gui/widgets/tabs/setup_input.cpp
+++ b/src/gui/widgets/tabs/setup_input.cpp
@@ -62,13 +62,17 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mKeyListModel(new KeyListModel),
mKeyList(CREATEWIDGETR(ListBox, this, mKeyListModel, "")),
// TRANSLATORS: button in input settings tab
- mAssignKeyButton(new Button(this, _("Assign"), "assign", this)),
+ mAssignKeyButton(new Button(this, _("Assign"), "assign",
+ BUTTON_SKIN, this)),
// TRANSLATORS: button in input settings tab
- mUnassignKeyButton(new Button(this, _("Unassign"), "unassign", this)),
+ mUnassignKeyButton(new Button(this, _("Unassign"), "unassign",
+ BUTTON_SKIN, this)),
// TRANSLATORS: button in input settings tab
- mDefaultButton(new Button(this, _("Default"), "default", this)),
+ mDefaultButton(new Button(this, _("Default"), "default",
+ BUTTON_SKIN, this)),
// TRANSLATORS: button in input settings tab
- mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)),
+ mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys",
+ BUTTON_SKIN, this)),
mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10, 0)),
mScrollArea(new ScrollArea(this, mKeyList,
Opaque_true, "setup_input_background.xml")),
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index a856f552e..e3dd95caf 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -46,9 +46,11 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
// TRANSLATORS: joystick settings tab label
_("Press the button to start calibration"))),
// TRANSLATORS: joystick settings tab button
- mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)),
+ mCalibrateButton(new Button(this, _("Calibrate"), "calibrate",
+ BUTTON_SKIN, this)),
// TRANSLATORS: joystick settings tab button
- mDetectButton(new Button(this, _("Detect joysticks"), "detect", this)),
+ mDetectButton(new Button(this, _("Detect joysticks"), "detect",
+ BUTTON_SKIN, this)),
// TRANSLATORS: joystick settings tab checkbox
mJoystickEnabled(new CheckBox(this, _("Enable joystick"),
false, nullptr, std::string())),
diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp
index 55a53e482..85a861109 100644
--- a/src/gui/widgets/tabs/setup_relations.cpp
+++ b/src/gui/widgets/tabs/setup_relations.cpp
@@ -78,7 +78,8 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
(playerRelations.getDefault() & PlayerRelation::WHISPER) != 0u,
nullptr, std::string())),
// TRANSLATORS: relation dialog button
- mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, this)),
+ mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE,
+ BUTTON_SKIN, this)),
mIgnoreActionChoicesModel(new IgnoreChoicesListModel),
mIgnoreActionChoicesBox(new DropDown(widget, mIgnoreActionChoicesModel,
false, Modal_false, nullptr, std::string()))
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index 218536469..080573c3c 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -126,7 +126,7 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) :
mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel,
false, Modal_false, nullptr, std::string())),
// TRANSLATORS: button name with information about selected theme
- mInfoButton(new Button(this, _("i"), ACTION_INFO, this)),
+ mInfoButton(new Button(this, _("i"), ACTION_INFO, BUTTON_SKIN, this)),
mThemeInfo()
{
// TRANSLATORS: theme settings tab name
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 561685dc2..557cdffce 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -86,7 +86,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
mAltFpsLabel(new Label(this, _("Alt FPS limit: "))),
#if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__)
// TRANSLATORS: video settings button
- mDetectButton(new Button(this, _("Detect best mode"), "detect", this)),
+ mDetectButton(new Button(this, _("Detect best mode"), "detect",
+ BUTTON_SKIN, this)),
#endif // !defined(ANDROID) && !defined(__APPLE__) &&
// !defined(__native_client__)
mDialog(nullptr),
diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp
index d32b1414e..e0945b7b0 100644
--- a/src/gui/widgets/tabstrip.cpp
+++ b/src/gui/widgets/tabstrip.cpp
@@ -48,7 +48,8 @@ TabStrip::TabStrip(const Widget2 *const widget,
Widget *TabStrip::createWidget(const std::string &text,
const bool pressed) const
{
- Button *const widget = new Button(this);
+ Button *const widget = new Button(this,
+ BUTTON_SKIN);
widget->setStick(true);
widget->setCaption(text);
widget->adjustSize();