From 015b14f8e60d64da2999da9c753af62ec1ffdf72 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Oct 2012 02:37:02 +0300 Subject: Add palette inheritance to radiobutton class. --- src/gui/charcreatedialog.cpp | 6 +++--- src/gui/quitdialog.cpp | 10 ++++++---- src/gui/registerdialog.cpp | 6 +++--- src/gui/textcommandeditor.cpp | 4 ++-- src/gui/widgets/progressindicator.cpp | 1 + src/gui/widgets/radiobutton.cpp | 4 +++- src/gui/widgets/radiobutton.h | 4 ++-- src/gui/widgets/radiogroup.cpp | 3 ++- 8 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 560f565f4..5dc856da5 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -86,9 +86,9 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mHairStyleNameLabel(new Label(this, "")), mActionButton(new Button(this, _("^"), "action", this)), mRotateButton(new Button(this, _(">"), "rotate", this)), - mMale(new RadioButton(_("Male"), "gender")), - mFemale(new RadioButton(_("Female"), "gender")), - mOther(new RadioButton(_("Other"), "gender")), + mMale(new RadioButton(this, _("Male"), "gender")), + mFemale(new RadioButton(this, _("Female"), "gender")), + mOther(new RadioButton(this, _("Other"), "gender")), mAttributesLeft(new Label(this, strprintf(_("Please distribute %d points"), 99))), mMaxPoints(0), diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 184479e57..f2c6602cd 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -51,10 +51,12 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): Window(_("Quit"), true, nullptr, "quit.xml"), gcn::ActionListener(), gcn::KeyListener(), - mLogoutQuit(new RadioButton(_("Quit"), "quitdialog")), - mForceQuit(new RadioButton(_("Quit"), "quitdialog")), - mSwitchAccountServer(new RadioButton(_("Switch server"), "quitdialog")), - mSwitchCharacter(new RadioButton(_("Switch character"), "quitdialog")), + mLogoutQuit(new RadioButton(this, _("Quit"), "quitdialog")), + mForceQuit(new RadioButton(this, _("Quit"), "quitdialog")), + mSwitchAccountServer(new RadioButton(this, + _("Switch server"), "quitdialog")), + mSwitchCharacter(new RadioButton(this, + _("Switch character"), "quitdialog")), mOkButton(new Button(this, _("OK"), "ok", this)), mCancelButton(new Button(this, _("Cancel"), "cancel", this)), mMyPointer(pointerToMe) diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index 54d6dc149..4f865daad 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -98,11 +98,11 @@ RegisterDialog::RegisterDialog(LoginData *const data): if (optionalActions & Net::LoginHandler::SetGenderOnRegister) { - mMaleButton = new RadioButton(_("Male"), "sex", true); - mFemaleButton = new RadioButton(_("Female"), "sex", false); + mMaleButton = new RadioButton(this, _("Male"), "sex", true); + mFemaleButton = new RadioButton(this, _("Female"), "sex", false); if (serverVersion >= 5) { - mOtherButton = new RadioButton(_("Other"), "sex", false); + mOtherButton = new RadioButton(this, _("Other"), "sex", false); placer(0, row, mMaleButton); placer(1, row, mFemaleButton); placer(2, row, mOtherButton); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index f8db77d6d..156c6c60d 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -168,8 +168,8 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : gcn::ActionListener(), mIsMagicCommand(command->getCommandType() == TEXT_COMMAND_MAGIC), mCommand(command), - mIsMagic(new RadioButton(_("magic"), "magic", mIsMagicCommand)), - mIsOther(new RadioButton(_("other"), "magic", !mIsMagicCommand)), + mIsMagic(new RadioButton(this, _("magic"), "magic", mIsMagicCommand)), + mIsOther(new RadioButton(this, _("other"), "magic", !mIsMagicCommand)), mSymbolLabel(new Label(this, _("Symbol:"))), mSymbolTextField(new TextField(this)), mCommandLabel(new Label(this, _("Command:"))), diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 9b6726ce9..8ddd755ff 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -34,6 +34,7 @@ ProgressIndicator::ProgressIndicator() : gcn::Widget(), + Widget2(), mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index d7b1769ba..062c426d3 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -40,9 +40,11 @@ int RadioButton::instances = 0; Skin *RadioButton::mSkin = nullptr; float RadioButton::mAlpha = 1.0; -RadioButton::RadioButton(const std::string &caption, const std::string &group, +RadioButton::RadioButton(const Widget2 *const widget, + const std::string &caption, const std::string &group, const bool marked): gcn::RadioButton(caption, group, marked), + Widget2(widget), mHasMouse(false), mPadding(0), mImagePadding(0), diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index a511a806f..8607c891b 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -42,8 +42,8 @@ class RadioButton final : public gcn::RadioButton, /** * Constructor. */ - RadioButton(const std::string &caption, const std::string &group, - const bool marked = false); + RadioButton(const Widget2 *const widget, const std::string &caption, + const std::string &group, const bool marked = false); A_DELETE_COPY(RadioButton) diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp index 6e759cba8..3d20b7248 100644 --- a/src/gui/widgets/radiogroup.cpp +++ b/src/gui/widgets/radiogroup.cpp @@ -35,7 +35,8 @@ RadioGroup::RadioGroup(const Widget2 *const widget, gcn::Widget *RadioGroup::createWidget(const std::string &text) { - RadioButton *const widget = new RadioButton(text, mGroup, mCount == 0); + RadioButton *const widget = new RadioButton( + this, text, mGroup, mCount == 0); widget->adjustSize(); return widget; } -- cgit v1.2.3-70-g09d2