diff options
Diffstat (limited to 'src/gui/widgets')
23 files changed, 70 insertions, 51 deletions
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index bca1f1e12..fcb0f8ea1 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -40,8 +40,8 @@ #include "debug.h" -DropShortcutContainer::DropShortcutContainer(): - ShortcutContainer(), +DropShortcutContainer::DropShortcutContainer(Widget2 *const widget): + ShortcutContainer(widget), mItemClicked(false), mItemPopup(new ItemPopup), mEquipedColor(getThemeColor(Theme::ITEM_EQUIPPED)), diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 9880f526d..dbaac1d9c 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -38,7 +38,7 @@ class DropShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - DropShortcutContainer(); + DropShortcutContainer(Widget2 *const widget); A_DELETE_COPY(DropShortcutContainer) diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index f5d1c19f0..47c45c2dd 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -38,8 +38,8 @@ static const int MAX_ITEMS = 48; -EmoteShortcutContainer::EmoteShortcutContainer(): - ShortcutContainer(), +EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : + ShortcutContainer(widget), mEmoteImg(), mEmotePopup(new TextPopup), mEmoteClicked(false), diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index ed6b4c8b3..ec0e98675 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -41,7 +41,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - EmoteShortcutContainer(); + EmoteShortcutContainer(Widget2 *const widget); A_DELETE_COPY(EmoteShortcutContainer) diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 2496beaa6..83c8820ae 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -48,8 +48,9 @@ #include "debug.h" -ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : - ShortcutContainer(), +ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget, + const unsigned number) : + ShortcutContainer(widget), mItemClicked(false), mNumber(number), mItemPopup(new ItemPopup), diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index f01c2779c..dd95851a6 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -39,7 +39,8 @@ class ItemShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - explicit ItemShortcutContainer(const unsigned number); + ItemShortcutContainer(Widget2 *const widget, + const unsigned number); A_DELETE_COPY(ItemShortcutContainer) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 3bcb8476e..97fd4a713 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -30,9 +30,11 @@ #include "debug.h" -PlayerBox::PlayerBox(Being *const being, const std::string &skin, +PlayerBox::PlayerBox(Widget2 *const widget, + Being *const being, + const std::string &skin, const std::string &selectedSkin) : - Widget2(), + Widget2(widget), ScrollArea(), mBeing(being), mAlpha(1.0), @@ -48,8 +50,10 @@ PlayerBox::PlayerBox(Being *const being, const std::string &skin, init(skin, selectedSkin); } -PlayerBox::PlayerBox(const std::string &skin, +PlayerBox::PlayerBox(Widget2 *const widget, + const std::string &skin, const std::string &selectedSkin) : + Widget2(widget), ScrollArea(), mBeing(nullptr), mAlpha(1.0), diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 30d79ff2f..3669a23a9 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -45,10 +45,13 @@ class PlayerBox final : public Widget2, * Constructor. Takes the initial player character that this box should * display, which defaults to <code>NULL</code>. */ - explicit PlayerBox(Being *const being, const std::string &skin = "", + explicit PlayerBox(Widget2 *const widget, + Being *const being, + const std::string &skin = "", const std::string &selectedSkin = ""); - explicit PlayerBox(const std::string &skin = "", + explicit PlayerBox(Widget2 *const widget, + const std::string &skin = "", const std::string &selectedSkin = ""); A_DELETE_COPY(PlayerBox) diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index b3f5b0e54..198094b6d 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -28,9 +28,9 @@ #include "debug.h" -ProgressIndicator::ProgressIndicator() : +ProgressIndicator::ProgressIndicator(Widget2 *const widget) : gcn::Widget(), - Widget2(), + Widget2(widget), mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index 8dd33bf4d..7357931e9 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -38,7 +38,7 @@ class ProgressIndicator final : public gcn::Widget, public Widget2 { public: - ProgressIndicator(); + ProgressIndicator(Widget2 *const widget); A_DELETE_COPY(ProgressIndicator) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 0ee2c3357..708949f9c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -45,8 +45,11 @@ static std::string const buttonFiles[2] = "scrollbuttons_pressed.xml" }; -ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : +ScrollArea::ScrollArea(Widget2 *const widget, + const bool opaque, + const std::string &skin) : gcn::ScrollArea(), + Widget2(widget), WidgetListener(), mX(0), mY(0), @@ -66,9 +69,12 @@ ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : init(skin); } -ScrollArea::ScrollArea(gcn::Widget *const widget, const bool opaque, +ScrollArea::ScrollArea(Widget2 *const widget2, + gcn::Widget *const widget, + const bool opaque, const std::string &skin) : gcn::ScrollArea(widget), + Widget2(widget2), WidgetListener(), mX(0), mY(0), diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 3f6195271..bc25baa27 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -52,7 +52,8 @@ class ScrollArea final : public gcn::ScrollArea, * Constructor that takes no content. Needed for use with the DropDown * class. */ - explicit ScrollArea(const bool opaque = true, + explicit ScrollArea(Widget2 *const widget, + const bool opaque = true, const std::string &skin = ""); /** @@ -60,7 +61,8 @@ class ScrollArea final : public gcn::ScrollArea, * * @param content the initial content to show in the scroll area */ - explicit ScrollArea(gcn::Widget *const widget, + explicit ScrollArea(Widget2 *const widget2, + gcn::Widget *const widget, const bool opaque = true, const std::string &skin = ""); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index aeeb8e4bc..649388d04 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -50,7 +50,7 @@ SetupItem::SetupItem(const std::string &restrict text, const std::string &restrict eventName, const bool mainConfig) : ActionListener(), - Widget2(), + Widget2(parent), mText(text), mDescription(description), mKeyName(keyName), @@ -74,7 +74,7 @@ SetupItem::SetupItem(const std::string &restrict text, const std::string &restrict def, const bool mainConfig) : ActionListener(), - Widget2(), + Widget2(parent), mText(text), mDescription(description), mKeyName(keyName), @@ -762,7 +762,7 @@ void SetupItemSlider::createControls() mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(this, mText); - mSlider = new Slider(mMin, mMax); + mSlider = new Slider(this, mMin, mMax); mSlider->setActionEventId(mEventName); mSlider->addActionListener(mParent); mSlider->setValue2(atof(mValue.c_str())); @@ -886,7 +886,7 @@ void SetupItemSlider2::createControls() mLabel = new Label(this, mText); mLabel2 = new Label(this, ""); mLabel2->setWidth(width); - mSlider = new Slider(mMin, mMax); + mSlider = new Slider(this, mMin, mMax); mSlider->setActionEventId(mEventName); mSlider->addActionListener(mParent); mSlider->setValue2(atof(mValue.c_str())); diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 767a32974..866dde6f1 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -28,9 +28,9 @@ float ShortcutContainer::mAlpha = 1.0; -ShortcutContainer::ShortcutContainer() : +ShortcutContainer::ShortcutContainer(Widget2 *const widget) : gcn::Widget(), - Widget2(), + Widget2(widget), WidgetListener(), MouseListener(), mBackgroundImg(nullptr), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index e7ec2ff62..8df401775 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -102,7 +102,7 @@ class ShortcutContainer : public gcn::Widget, /** * Constructor. Initializes the shortcut container. */ - explicit ShortcutContainer(); + explicit ShortcutContainer(Widget2 *const widget); /** * Gets the index from the grid provided the point is in an item box. diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 02ebc2ccb..c5988ff54 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -43,9 +43,10 @@ static std::string const data[2] = "slider_highlighted.xml" }; -Slider::Slider(const double scaleEnd) : +Slider::Slider(Widget2 *const widget, + const double scaleEnd) : gcn::Slider(scaleEnd), - Widget2(), + Widget2(widget), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) @@ -53,9 +54,11 @@ Slider::Slider(const double scaleEnd) : init(); } -Slider::Slider(const double scaleStart, const double scaleEnd) : +Slider::Slider(Widget2 *const widget, + const double scaleStart, + const double scaleEnd) : gcn::Slider(scaleStart, scaleEnd), - Widget2(), + Widget2(widget), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 2d4853539..27b03976d 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -43,12 +43,15 @@ class Slider final : public gcn::Slider, /** * Constructor with scale start equal to 0. */ - explicit Slider(const double scaleEnd = 1.0); + explicit Slider(Widget2 *const widget, + const double scaleEnd = 1.0); /** * Constructor. */ - Slider(const double scaleStart, const double scaleEnd); + Slider(Widget2 *const widget, + const double scaleStart, + const double scaleEnd); A_DELETE_COPY(Slider) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index e8d34c9d8..5441c4d8a 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -39,8 +39,9 @@ #include "debug.h" -SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : - ShortcutContainer(), +SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget, + const unsigned number) : + ShortcutContainer(widget), mSpellPopup(new SpellPopup), mNumber(number), mSpellClicked(false) diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index d8f5d22b4..afff6dcf9 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -38,7 +38,8 @@ class SpellShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - explicit SpellShortcutContainer(const unsigned number); + explicit SpellShortcutContainer(Widget2 *const widget, + const unsigned number); A_DELETE_COPY(SpellShortcutContainer) diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index d29c56c85..8ea9d5fbb 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -58,23 +58,23 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mSelected(-1), // TRANSLATORS: colors tab. label. mGradTypeLabel(new Label(this, _("Type:"))), - mGradTypeSlider(new Slider(0, 3)), + mGradTypeSlider(new Slider(this, 0, 3)), mGradTypeText(new Label(this)), // TRANSLATORS: colors tab. label. mGradDelayLabel(new Label(this, _("Delay:"))), - mGradDelaySlider(new Slider(20, 100)), + mGradDelaySlider(new Slider(this, 20, 100)), mGradDelayText(new TextField(this)), // TRANSLATORS: colors tab. label. mRedLabel(new Label(this, _("Red:"))), - mRedSlider(new Slider(0, 255)), + mRedSlider(new Slider(this, 0, 255)), mRedText(new TextField(this)), // TRANSLATORS: colors tab. label. mGreenLabel(new Label(this, _("Green:"))), - mGreenSlider(new Slider(0, 255)), + mGreenSlider(new Slider(this, 0, 255)), mGreenText(new TextField(this)), // TRANSLATORS: colors tab. label. mBlueLabel(new Label(this, _("Blue:"))), - mBlueSlider(new Slider(0, 255)), + mBlueSlider(new Slider(this, 0, 255)), mBlueText(new TextField(this)) { mColorBox->postInit(); diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 589b08e5e..be00937f2 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -191,9 +191,9 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : mOpenGLDropDown(new DropDown(widget, mOpenGLListModel)), // TRANSLATORS: video settings checkbox mFpsCheckBox(new CheckBox(this, _("FPS limit:"))), - mFpsSlider(new Slider(2, 160)), + mFpsSlider(new Slider(this, 2, 160)), mFpsLabel(new Label(this)), - mAltFpsSlider(new Slider(2, 160)), + mAltFpsSlider(new Slider(this, 2, 160)), // TRANSLATORS: video settings label mAltFpsLabel(new Label(this, _("Alt FPS limit: "))), #if !defined(ANDROID) && !defined(__APPLE__) diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index f6e94556a..a57ccbb41 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -78,12 +78,6 @@ class Widget2 } protected: - Widget2() : - mPaletteOffset(0), - mForegroundColor2() - { - } - explicit Widget2(const Widget2 *const widget) : mPaletteOffset(widget ? widget->mPaletteOffset : 0), mForegroundColor2() diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 2ea86f9df..82c2d91f8 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -49,7 +49,7 @@ int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, Window *const parent, std::string skin) : gcn::Window(caption), - Widget2(), + Widget2(nullptr), WidgetListener(), mSkin(nullptr), mDefaultX(0), |