From f239185e8368da2a9307af11c98a09d1e47d79bb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 23:20:45 +0300 Subject: move virtual member calls from sliderlist constuctor into postInit. --- src/gui/widgets/setupitem.cpp | 3 ++- src/gui/widgets/sliderlist.cpp | 16 +++++++++++----- src/gui/widgets/sliderlist.h | 7 ++++--- 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 862fc11d6..043d0870f 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -979,7 +979,8 @@ void SetupItemSliderList::createControls() mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(this, mText); - mSlider = new SliderList(this, mModel, mParent, mEventName); + mSlider = new SliderList(this, mModel); + mSlider->postInit(mParent, mEventName); mSlider->setSelectedString(mValue); mSlider->adjustSize(); diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 3356e8f27..d41927f82 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -34,16 +34,14 @@ static const int buttonSpace = 30; static const int sliderHeight = 30; SliderList::SliderList(const Widget2 *const widget, - gcn::ListModel *const listModel, - gcn::ActionListener *const listener, - const std::string &eventId) : + gcn::ListModel *const listModel) : Container(widget), gcn::ActionListener(), gcn::MouseListener(), mLabel(new Label(this)), mListModel(listModel), - mPrevEventId(eventId + "_prev"), - mNextEventId(eventId + "_next"), + mPrevEventId(), + mNextEventId(), mOldWidth(0), mSelectedIndex(0) { @@ -51,6 +49,14 @@ SliderList::SliderList(const Widget2 *const widget, mButtons[0] = new Button(this, "<", mPrevEventId, this); mButtons[1] = new Button(this, ">", mNextEventId, this); +} + +void SliderList::postInit(gcn::ActionListener *const listener, + const std::string &eventId) +{ + mPrevEventId = eventId + "_prev"; + mNextEventId = eventId + "_next"; + add(mButtons[0]); add(mLabel); add(mButtons[1]); diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 9209a4f55..8427ad2d5 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -38,14 +38,15 @@ class SliderList final : public Container, { public: SliderList(const Widget2 *const widget, - gcn::ListModel *const listModel = nullptr, - gcn::ActionListener *const listener = nullptr, - const std::string &eventId = ""); + gcn::ListModel *const listModel = nullptr); A_DELETE_COPY(SliderList) ~SliderList(); + void postInit(gcn::ActionListener *const listener, + const std::string &eventId); + void updateAlpha(); void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override; -- cgit v1.2.3-70-g09d2