summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-20 01:00:19 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:43 +0300
commit79b4bbbe0ead006bec273c247eaa50c2fd585863 (patch)
tree4e4515e5623b74ae3de48fd6f5dac2b7c2a493d5
parent41adf71a823f475b7f12b00e06056b778311da84 (diff)
downloadmv-79b4bbbe0ead006bec273c247eaa50c2fd585863.tar.gz
mv-79b4bbbe0ead006bec273c247eaa50c2fd585863.tar.bz2
mv-79b4bbbe0ead006bec273c247eaa50c2fd585863.tar.xz
mv-79b4bbbe0ead006bec273c247eaa50c2fd585863.zip
Add palette inheritance to checkbox class.
-rw-r--r--src/gui/didyouknowwindow.cpp2
-rw-r--r--src/gui/logindialog.cpp5
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/serverdialog.cpp7
-rw-r--r--src/gui/setup_joystick.cpp4
-rw-r--r--src/gui/setup_relations.cpp4
-rw-r--r--src/gui/setup_video.cpp10
-rw-r--r--src/gui/shopwindow.cpp2
-rw-r--r--src/gui/widgets/checkbox.cpp5
-rw-r--r--src/gui/widgets/checkbox.h3
-rw-r--r--src/gui/widgets/setupitem.cpp2
11 files changed, 26 insertions, 22 deletions
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index 3e47a3952..1ca184b78 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -55,7 +55,7 @@ DidYouKnowWindow::DidYouKnowWindow():
true, "didyouknow_background.xml")),
mButtonPrev(new Button(this, _("< Previous"), "prev", this)),
mButtonNext(new Button(this, _("Next >"), "next", this)),
- mOpenAgainCheckBox(new CheckBox(_("Auto open this window"),
+ mOpenAgainCheckBox(new CheckBox(this, _("Auto open this window"),
config.getBoolValue("showDidYouKnow"), this, "openagain"))
{
setMinWidth(300);
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index d4affa6c7..a1db2a953 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -122,7 +122,8 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mLoginData(data),
mUserField(new TextField(mLoginData->username)),
mPassField(new PasswordField(mLoginData->password)),
- mKeepCheck(new CheckBox(_("Remember username"), mLoginData->remember)),
+ mKeepCheck(new CheckBox(this, _("Remember username"),
+ mLoginData->remember)),
mUpdateTypeLabel(new Label(_("Update:"))),
mUpdateHostLabel(nullptr),
mUpdateTypeModel(new UpdateTypeModel()),
@@ -130,7 +131,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mServerButton(new Button(this, _("Change Server"), "server", this)),
mLoginButton(new Button(this, _("Login"), "login", this)),
mRegisterButton(new Button(this, _("Register"), "register", this)),
- mCustomUpdateHost(new CheckBox(_("Custom update host"),
+ mCustomUpdateHost(new CheckBox(this, _("Custom update host"),
mLoginData->updateType & LoginData::Upd_Custom, this, "customhost")),
mUpdateHostText(new TextField(serverConfig.getValue(
"customUpdateHost", ""))),
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index dfc7dbd94..9f9c05565 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -62,9 +62,9 @@ OutfitWindow::OutfitWindow():
mNextButton(new Button(this, _(">"), "next", this)),
mEquipButtom(new Button(this, _("Equip"), "equip", this)),
mCurrentLabel(new Label(strprintf(_("Outfit: %d"), 1))),
- mUnequipCheck(new CheckBox(_("Unequip first"),
+ mUnequipCheck(new CheckBox(this, _("Unequip first"),
serverConfig.getValueBool("OutfitUnequip0", true))),
- mAwayOutfitCheck(new CheckBox(_("Away outfit"),
+ mAwayOutfitCheck(new CheckBox(this, _("Away outfit"),
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1))),
mKeyLabel(new Label(strprintf(_("Key: %s"),
keyName(mCurrentOutfit).c_str()))),
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 63c03b0a2..6aec0d6de 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -269,9 +269,10 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
setWindowName("ServerDialog");
- mPersistentIPCheckBox = new CheckBox(_("Use same ip for game sub servers"),
- config.getBoolValue("usePersistentIP"),
- this, "persitent ip");
+ mPersistentIPCheckBox = new CheckBox(this,
+ _("Use same ip for game sub servers"),
+ config.getBoolValue("usePersistentIP"),
+ this, "persitent ip");
loadCustomServers();
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index f910ca0af..96dbbd917 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -45,10 +45,10 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
SetupTab(widget),
mCalibrateLabel(new Label(_("Press the button to start calibration"))),
mCalibrateButton(new Button(this, _("Calibrate"), "calibrate", this)),
- mJoystickEnabled(new CheckBox(_("Enable joystick"))),
+ mJoystickEnabled(new CheckBox(this, _("Enable joystick"))),
mNamesModel(new NamesModel()),
mNamesDropDown(new DropDown(this, mNamesModel)),
- mUseInactiveCheckBox(new CheckBox(_("Use joystick if client "
+ mUseInactiveCheckBox(new CheckBox(this, _("Use joystick if client "
"window inactive"), config.getBoolValue("useInactiveJoystick")))
{
setName(_("Joystick"));
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index a73621933..74a440434 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -243,9 +243,9 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
mPlayerTable(new GuiTable(mPlayerTableModel)),
mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)),
mPlayerScrollArea(new ScrollArea(mPlayerTable)),
- mDefaultTrading(new CheckBox(_("Allow trading"),
+ mDefaultTrading(new CheckBox(this, _("Allow trading"),
player_relations.getDefault() & PlayerRelation::TRADE)),
- mDefaultWhisper(new CheckBox(_("Allow whispers"),
+ mDefaultWhisper(new CheckBox(this, _("Allow whispers"),
player_relations.getDefault() & PlayerRelation::WHISPER)),
mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, this))
{
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 6c28c6e1e..3da6167c0 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -231,12 +231,12 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
mNoFrame(config.getBoolValue("noframe")),
mModeListModel(new ModeListModel),
mModeList(new ListBox(widget, mModeListModel)),
- mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
- mCustomCursorCheckBox(new CheckBox(_("Custom cursor"),
+ mFsCheckBox(new CheckBox(this, _("Full screen"), mFullScreenEnabled)),
+ mCustomCursorCheckBox(new CheckBox(this, _("Custom cursor"),
mCustomCursorEnabled)),
- mEnableResizeCheckBox(new CheckBox(_("Enable resize"), mEnableResize)),
- mNoFrameCheckBox(new CheckBox(_("No frame"), mNoFrame)),
- mFpsCheckBox(new CheckBox(_("FPS limit:"))),
+ mEnableResizeCheckBox(new CheckBox(this,_("Enable resize"), mEnableResize)),
+ mNoFrameCheckBox(new CheckBox(this,_("No frame"), mNoFrame)),
+ mFpsCheckBox(new CheckBox(this,_("FPS limit:"))),
mFpsSlider(new Slider(2, 160)),
mFpsLabel(new Label),
mAltFpsSlider(new Slider(2, 160)),
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 3aab00ea8..a0e91dd26 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -94,7 +94,7 @@ ShopWindow::ShopWindow():
mSellDeleteButton(new Button(this, _("Delete"), "delete sell", this)),
mSellAnnounceButton(new Button(this, _("Announce"), "announce sell", this)),
mSellAuctionButton(nullptr),
- mAnnounceLinks(new CheckBox(_("Show links in announce"), false,
+ mAnnounceLinks(new CheckBox(this, _("Show links in announce"), false,
this, "link announce")),
mSelectedItem(-1),
mAnnonceTime(0),
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 71e718fed..7377a5325 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -42,11 +42,12 @@ int CheckBox::instances = 0;
Skin *CheckBox::mSkin = nullptr;
float CheckBox::mAlpha = 1.0;
-CheckBox::CheckBox(const std::string &caption, const bool selected,
+CheckBox::CheckBox(const Widget2 *const widget,
+ const std::string &caption, const bool selected,
gcn::ActionListener *const listener,
const std::string &eventId) :
gcn::CheckBox(caption, selected),
- Widget2(),
+ Widget2(widget),
mHasMouse(false),
mPadding(0),
mImagePadding(0),
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index 4bb675f65..91c713b9e 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -44,7 +44,8 @@ class CheckBox final : public gcn::CheckBox,
/**
* Constructor.
*/
- CheckBox(const std::string &caption, bool selected = false,
+ CheckBox(const Widget2 *const widget,
+ const std::string &caption, bool selected = false,
gcn::ActionListener *const listener = nullptr,
const std::string &eventId = "");
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 92cc93d6e..937ce79d2 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -209,7 +209,7 @@ SetupItemCheckBox::~SetupItemCheckBox()
void SetupItemCheckBox::createControls()
{
load();
- mCheckBox = new CheckBox(mText, mValue != "0", mParent, mEventName);
+ mCheckBox = new CheckBox(this, mText, mValue != "0", mParent, mEventName);
mWidget = mCheckBox;
mParent->getContainer()->add1(mWidget);
mParent->addControl(this);