diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-20 00:52:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:43 +0300 |
commit | 41adf71a823f475b7f12b00e06056b778311da84 (patch) | |
tree | 55925f737e884f756d05a71238f207c03070a7ad /src/gui/widgets | |
parent | 504219f9df4b9dda139dd832e263a136e51c4851 (diff) | |
download | mv-41adf71a823f475b7f12b00e06056b778311da84.tar.gz mv-41adf71a823f475b7f12b00e06056b778311da84.tar.bz2 mv-41adf71a823f475b7f12b00e06056b778311da84.tar.xz mv-41adf71a823f475b7f12b00e06056b778311da84.zip |
Add palette inheritance to button class.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/button.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/button.h | 10 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/sliderlist.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabstrip.cpp | 2 |
6 files changed, 25 insertions, 20 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 9b0f0578f..f157f1096 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -64,9 +64,9 @@ static std::string const data[BUTTON_COUNT] = Skin *Button::button[BUTTON_COUNT]; -Button::Button() : +Button::Button(const Widget2 *const widget) : gcn::Button(), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), mTag(0), @@ -86,10 +86,11 @@ Button::Button() : adjustSize(); } -Button::Button(const std::string &caption, const std::string &actionEventId, +Button::Button(const Widget2 *const widget, + const std::string &caption, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(caption), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), @@ -114,12 +115,13 @@ Button::Button(const std::string &caption, const std::string &actionEventId, addActionListener(listener); } -Button::Button(const std::string &caption, const std::string &imageName, +Button::Button(const Widget2 *const widget, + const std::string &caption, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(caption), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), @@ -145,12 +147,12 @@ Button::Button(const std::string &caption, const std::string &imageName, addActionListener(listener); } -Button::Button(const std::string &imageName, +Button::Button(const Widget2 *const widget, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(""), - Widget2(), + Widget2(widget), gcn::WidgetListener(), mDescription(""), mClickCount(0), diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 3519a5fc7..59fda30e6 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -52,20 +52,22 @@ class Button final : public gcn::Button, /** * Default constructor. */ - Button(); + Button(const Widget2 *const widget); /** * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &caption, const std::string &actionEventId, + Button(const Widget2 *const widget, + const std::string &caption, const std::string &actionEventId, gcn::ActionListener *const listener); /** * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &caption, const std::string &imageName, + Button(const Widget2 *const widget, + const std::string &caption, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener); @@ -74,7 +76,7 @@ class Button final : public gcn::Button, * Constructor, sets the caption of the button to the given string and * adds the given action listener. */ - Button(const std::string &imageName, + Button(const Widget2 *const widget, const std::string &imageName, const int imageWidth, const int imageHeight, const std::string &actionEventId, gcn::ActionListener *const listener); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 3a01e1436..92cc93d6e 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -287,7 +287,7 @@ void SetupItemTextField::createControls() mLabel = new Label(mText); mTextField = new TextField(mValue, true, mParent, mEventName); - mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); + mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(200); fixFirstItemSize(mLabel); @@ -411,7 +411,7 @@ void SetupItemIntTextField::createControls() mTextField->setActionEventId(mEventName); mTextField->addActionListener(mParent); - mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); + mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; mTextField->setWidth(50); fixFirstItemSize(mLabel); @@ -1012,7 +1012,8 @@ SetupItemSound::SetupItemSound(std::string text, std::string description, void SetupItemSound::addMoreControls() { - mButton = new Button(BUTTON_PLAY, 16, 16, mEventName + "_PLAY", this); + mButton = new Button(this, BUTTON_PLAY, 16, 16, + mEventName + "_PLAY", this); mHorizont->add(mButton); } diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 1a6d97de3..fb94155c1 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -56,8 +56,8 @@ SliderList::SliderList(const Widget2 *const widget, setHeight(sliderHeight); - mButtons[0] = new Button("<", mPrevEventId, this); - mButtons[1] = new Button(">", mNextEventId, this); + mButtons[0] = new Button(this, "<", mPrevEventId, this); + mButtons[1] = new Button(this, ">", mNextEventId, this); add(mButtons[0]); add(mLabel); add(mButtons[1]); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index a25a4e422..d6c73b642 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -64,8 +64,8 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : mWidgetContainer->setOpaque(false); addWidgetListener(this); - mArrowButton[0] = new Button("<", "shift_left", this); - mArrowButton[1] = new Button(">", "shift_right", this); + mArrowButton[0] = new Button(this, "<", "shift_left", this); + mArrowButton[1] = new Button(this, ">", "shift_right", this); widgetResized(nullptr); } diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 13a4a4ad0..aa8f3d91f 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -42,7 +42,7 @@ TabStrip::TabStrip(const Widget2 *const widget, gcn::Widget *TabStrip::createWidget(const std::string &text) { - Button *const widget = new Button(); + Button *const widget = new Button(this); widget->setStick(true); widget->setCaption(text); widget->adjustSize(); |