diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-19 23:56:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:42 +0300 |
commit | d59cd9111c1e86b224ea62cc975c49b157e2b3cf (patch) | |
tree | d7186479633c0269573e92b5a5213d04b84b3995 /src/gui/widgets | |
parent | 71d2b482d84246b8456ea863f94a9a766d33f197 (diff) | |
download | plus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.gz plus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.bz2 plus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.xz plus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.zip |
Add to some controls palette inheritance from other controls.
Diffstat (limited to 'src/gui/widgets')
55 files changed, 138 insertions, 92 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index b1eda9ed4..5dd7277df 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -45,8 +45,9 @@ int AvatarListBox::instances = 0; Image *AvatarListBox::onlineIcon = nullptr; Image *AvatarListBox::offlineIcon = nullptr; -AvatarListBox::AvatarListBox(AvatarListModel *const model) : - ListBox(model), +AvatarListBox::AvatarListBox(const Widget2 *const widget, + AvatarListModel *const model) : + ListBox(widget, model), mShowGender(config.getBoolValue("showgender")), mShowLevel(config.getBoolValue("showlevel")), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)) diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index e79515bd4..ae9e2c734 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -46,7 +46,7 @@ public: class AvatarListBox final : public ListBox, public ConfigListener { public: - AvatarListBox(AvatarListModel *const model); + AvatarListBox(const Widget2 *const widget, AvatarListModel *const model); A_DELETE_COPY(AvatarListBox) diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp index 3f313b0e1..2e060dca1 100644 --- a/src/gui/widgets/battletab.cpp +++ b/src/gui/widgets/battletab.cpp @@ -39,8 +39,8 @@ #include "debug.h" -BattleTab::BattleTab() : - ChatTab(_("Battle")) +BattleTab::BattleTab(const Widget2 *const widget) : + ChatTab(widget, _("Battle")) { loadFromLogFile("#Battle"); } diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h index 95042c9ea..d8fe49314 100644 --- a/src/gui/widgets/battletab.h +++ b/src/gui/widgets/battletab.h @@ -31,7 +31,7 @@ class BattleTab final : public ChatTab { public: - BattleTab(); + BattleTab(const Widget2 *const widget); A_DELETE_COPY(BattleTab) diff --git a/src/gui/widgets/channeltab.cpp b/src/gui/widgets/channeltab.cpp index b9ea96650..bcb5b1002 100644 --- a/src/gui/widgets/channeltab.cpp +++ b/src/gui/widgets/channeltab.cpp @@ -31,8 +31,8 @@ #include "debug.h" -ChannelTab::ChannelTab(Channel *const channel) : - ChatTab(channel->getName()), +ChannelTab::ChannelTab(const Widget2 *const widget, Channel *const channel) : + ChatTab(widget, channel->getName()), mChannel(channel) { channel->setTab(this); diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h index e02da3b1e..f2a42f03c 100644 --- a/src/gui/widgets/channeltab.h +++ b/src/gui/widgets/channeltab.h @@ -49,7 +49,7 @@ class ChannelTab final : public ChatTab /** * Constructor. */ - ChannelTab(Channel *const channel); + ChannelTab(const Widget2 *const widget, Channel *const channel); /** * Destructor. diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index a0b31d040..63b5f8e05 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -49,8 +49,8 @@ static const unsigned int MAX_WORD_SIZE = 50; -ChatTab::ChatTab(const std::string &name) : - Tab(), +ChatTab::ChatTab(const Widget2 *const widget, const std::string &name) : + Tab(widget), mTextOutput(new BrowserBox(BrowserBox::AUTO_WRAP)), mScrollArea(new ScrollArea(mTextOutput, false)), mAllowHightlight(true), diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index bd90e4d2e..2a6b826f6 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -53,7 +53,7 @@ class ChatTab : public Tab /** * Constructor. */ - ChatTab(const std::string &name); + ChatTab(const Widget2 *const widget, const std::string &name); A_DELETE_COPY(ChatTab) diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 074f6f53d..3cd68a6c5 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -24,9 +24,9 @@ #include "debug.h" -Container::Container() : +Container::Container(const Widget2 *const widget) : gcn::Container(), - Widget2() + Widget2(widget) { setOpaque(false); } diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h index 9ecbbf145..43a267c6b 100644 --- a/src/gui/widgets/container.h +++ b/src/gui/widgets/container.h @@ -45,7 +45,7 @@ class Container : public gcn::Container, public Widget2 { public: - Container(); + Container(const Widget2 *const widget); ~Container(); diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 0a49d8e31..fca9d9ff9 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -38,8 +38,8 @@ #include "debug.h" -Desktop::Desktop() : - Container(), +Desktop::Desktop(const Widget2 *const widget) : + Container(widget), gcn::WidgetListener(), mWallpaper(nullptr), mBackgroundColor(getThemeColor(Theme::BACKGROUND, 128)), diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 253f22010..41328b44b 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -47,7 +47,7 @@ class Label; class Desktop final : public Container, private gcn::WidgetListener { public: - Desktop(); + Desktop(const Widget2 *const widget); A_DELETE_COPY(Desktop) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 749b3565e..5c4c02259 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -57,11 +57,12 @@ static std::string const dropdownFiles[2] = "dropdown_pressed.xml" }; -DropDown::DropDown(gcn::ListModel *const listModel, +DropDown::DropDown(const Widget2 *const widget, + gcn::ListModel *const listModel, gcn::ActionListener *const listener, const std::string &eventId): gcn::DropDown::DropDown(listModel, - new ScrollArea, new ListBox(listModel)), + new ScrollArea, new ListBox(widget, listModel)), mShadowColor(getThemeColor(Theme::DROPDOWN_SHADOW)), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mPadding(1), diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 102263ffb..ac1b23484 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -52,7 +52,8 @@ class DropDown final : public gcn::DropDown, * @param listBox the listBox to use. * @see ListModel, ScrollArea, ListBox. */ - DropDown(gcn::ListModel *const listModel = nullptr, + DropDown(const Widget2 *const widget, + gcn::ListModel *const listModel = nullptr, gcn::ActionListener *const listener = nullptr, const std::string &eventId = ""); diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index eb1e93303..1091c957f 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -38,8 +38,9 @@ #include "debug.h" -ExtendedListBox::ExtendedListBox(gcn::ListModel *const listModel): - ListBox(listModel), +ExtendedListBox::ExtendedListBox(const Widget2 *const widget, + gcn::ListModel *const listModel) : + ListBox(widget, listModel), mRowHeight(13), mImagePadding(mSkin ? mSkin->getOption("imagePadding") : 0), mSpacing(mSkin ? mSkin->getOption("spacing") : 0) diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h index f9563c6c4..07280da5a 100644 --- a/src/gui/widgets/extendedlistbox.h +++ b/src/gui/widgets/extendedlistbox.h @@ -29,7 +29,8 @@ class ExtendedListBox final : public ListBox /** * Constructor. */ - ExtendedListBox(gcn::ListModel *const listModel); + ExtendedListBox(const Widget2 *const widget, + gcn::ListModel *const listModel); A_DELETE_COPY(ExtendedListBox) diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index 753fea2ea..9c5716506 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -23,8 +23,9 @@ #include "debug.h" -FlowContainer::FlowContainer(const int boxWidth, const int boxHeight) : - Container(), +FlowContainer::FlowContainer(const Widget2 *const widget, + const int boxWidth, const int boxHeight) : + Container(widget), gcn::WidgetListener(), mBoxWidth(boxWidth), mBoxHeight(boxHeight), diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index 2279a6376..744ee25d8 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -40,7 +40,8 @@ class FlowContainer final : public Container, /** * Constructor. Initializes the shortcut container. */ - FlowContainer(const int boxWidth, const int boxHeight); + FlowContainer(const Widget2 *const widget, + const int boxWidth, const int boxHeight); A_DELETE_COPY(FlowContainer) diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index 9fcce8f58..1b80801cb 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -38,8 +38,8 @@ #include "debug.h" -GuildChatTab::GuildChatTab() : - ChatTab(_("Guild")) +GuildChatTab::GuildChatTab(const Widget2 *const widget) : + ChatTab(widget, _("Guild")) { setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB)); setHighlightedTabColor(&getThemeColor( diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index 74a1d0949..603088a43 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -31,7 +31,7 @@ class GuildChatTab final : public ChatTab { public: - GuildChatTab(); + GuildChatTab(const Widget2 *const widget); A_DELETE_COPY(GuildChatTab) diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index d08b8adcc..ead98f729 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -23,8 +23,9 @@ #include "debug.h" -HorizontContainer::HorizontContainer(const int height, const int spacing) : - Container(), +HorizontContainer::HorizontContainer(const Widget2 *const widget, + const int height, const int spacing) : + Container(widget), gcn::WidgetListener(), mSpacing(spacing), mCount(0), diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index 7730c9bcf..2abe8a056 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -36,7 +36,8 @@ class HorizontContainer final : public Container, public gcn::WidgetListener { public: - HorizontContainer(const int height, const int spacing); + HorizontContainer(const Widget2 *const widget, + const int height, const int spacing); A_DELETE_COPY(HorizontContainer) diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index ddb6cfcb9..a323d154c 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -43,9 +43,10 @@ float ListBox::mAlpha = 1.0; Skin *ListBox::mSkin = nullptr; int ListBox::mInstances = 0; -ListBox::ListBox(gcn::ListModel *const listModel): +ListBox::ListBox(const Widget2 *const widget, + gcn::ListModel *const listModel) : gcn::ListBox(listModel), - Widget2(), + Widget2(widget), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mDistributeMousePressed(true), mOldSelected(-1), diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 11d1871c4..442840a29 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -46,7 +46,7 @@ class ListBox : public gcn::ListBox, /** * Constructor. */ - ListBox(gcn::ListModel *const listModel); + ListBox(const Widget2 *const widget, gcn::ListModel *const listModel); A_DELETE_COPY(ListBox) diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index eb3bcd64b..cd50bfe1b 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -36,8 +36,9 @@ #include "debug.h" -Popup::Popup(const std::string &name, std::string skin) : - Container(), +Popup::Popup(const std::string &name, + std::string skin) : + Container(nullptr), gcn::MouseListener(), gcn::WidgetListener(), mPopupName(name), @@ -65,7 +66,10 @@ Popup::Popup(const std::string &name, std::string skin) : { mSkin = Theme::instance()->load(skin, "popup.xml"); if (mSkin) + { setPadding(mSkin->getPadding()); + // init Widget2 fields + } } else { diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index d798966fd..278980322 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -58,7 +58,8 @@ class Popup : public Container, public gcn::MouseListener, * debugging purposes. * @param skin The location where the Popup's skin XML can be found. */ - Popup(const std::string &name = "", std::string skin = ""); + Popup(const std::string &name = "", + std::string skin = ""); A_DELETE_COPY(Popup) diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp index e07b3782c..6e759cba8 100644 --- a/src/gui/widgets/radiogroup.cpp +++ b/src/gui/widgets/radiogroup.cpp @@ -26,9 +26,10 @@ #include "debug.h" -RadioGroup::RadioGroup(const std::string &group, const int height, +RadioGroup::RadioGroup(const Widget2 *const widget, + const std::string &group, const int height, const int spacing) : - WidgetGroup(group, height, spacing) + WidgetGroup(widget, group, height, spacing) { } diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h index cdc9d8d0b..57555c771 100644 --- a/src/gui/widgets/radiogroup.h +++ b/src/gui/widgets/radiogroup.h @@ -28,7 +28,8 @@ class RadioGroup final : public WidgetGroup { public: - RadioGroup(const std::string &group, const int height, + RadioGroup(const Widget2 *const widget, + const std::string &group, const int height, const int spacing); A_DELETE_COPY(RadioGroup) diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 3a1db94bd..3a01e1436 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -51,6 +51,7 @@ SetupItem::SetupItem(std::string text, std::string description, std::string keyName, SetupTabScroll *const parent, std::string eventName, const bool mainConfig) : gcn::ActionListener(), + Widget2(), mText(text), mDescription(description), mKeyName(keyName), @@ -70,6 +71,7 @@ SetupItem::SetupItem(std::string text, std::string description, std::string eventName, std::string def, const bool mainConfig) : gcn::ActionListener(), + Widget2(), mText(text), mDescription(description), mKeyName(keyName), @@ -281,7 +283,7 @@ SetupItemTextField::~SetupItemTextField() void SetupItemTextField::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); mTextField = new TextField(mValue, true, mParent, mEventName); @@ -402,7 +404,7 @@ SetupItemIntTextField::~SetupItemIntTextField() void SetupItemIntTextField::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); mTextField = new IntTextField(atoi(mValue.c_str()), mMin, mMax, true, 30); @@ -575,10 +577,10 @@ SetupItemDropDown::~SetupItemDropDown() void SetupItemDropDown::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); - mDropDown = new DropDown(mModel); + mDropDown = new DropDown(this, mModel); mDropDown->setActionEventId(mEventName); mDropDown->addActionListener(mParent); @@ -663,7 +665,7 @@ SetupItemSlider::~SetupItemSlider() void SetupItemSlider::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); mSlider = new Slider(mMin, mMax); @@ -781,7 +783,7 @@ SetupItemSlider2::~SetupItemSlider2() void SetupItemSlider2::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); const int width = getMaxWidth(); @@ -942,10 +944,10 @@ SetupItemSliderList::~SetupItemSliderList() void SetupItemSliderList::createControls() { load(); - mHorizont = new HorizontContainer(32, 2); + mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(mText); - mSlider = new SliderList(mModel, mParent, mEventName); + mSlider = new SliderList(this, mModel, mParent, mEventName); mSlider->setSelectedString(mValue); mSlider->adjustSize(); diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 13540386f..87e32bdaa 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -49,7 +49,8 @@ namespace gcn class ListModel; } -class SetupItem : public gcn::ActionListener +class SetupItem : public gcn::ActionListener, + public Widget2 { public: enum diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp index 9f2560134..7b45329e6 100644 --- a/src/gui/widgets/setuptab.cpp +++ b/src/gui/widgets/setuptab.cpp @@ -24,8 +24,8 @@ #include "debug.h" -SetupTab::SetupTab() : - Container(), +SetupTab::SetupTab(const Widget2 *const widget) : + Container(widget), gcn::ActionListener() { setOpaque(false); diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h index caec8ab3f..dfcb3b315 100644 --- a/src/gui/widgets/setuptab.h +++ b/src/gui/widgets/setuptab.h @@ -37,7 +37,7 @@ class SetupTab : public Container, public gcn::ActionListener { public: - SetupTab(); + SetupTab(const Widget2 *const widget); A_DELETE_COPY(SetupTab) diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index 554ee5f62..d786399ce 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -27,9 +27,9 @@ #include "debug.h" -SetupTabScroll::SetupTabScroll() : - SetupTab(), - mContainer(new VertContainer(25, false, 8)), +SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : + SetupTab(widget), + mContainer(new VertContainer(this, 25, false, 8)), mScroll(new ScrollArea(mContainer, false)), mPreferredFirstItemSize(200) { diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h index 9e974cbe5..ab8d7e5d9 100644 --- a/src/gui/widgets/setuptabscroll.h +++ b/src/gui/widgets/setuptabscroll.h @@ -35,7 +35,7 @@ class VertContainer; class SetupTabScroll : public SetupTab { public: - SetupTabScroll(); + SetupTabScroll(const Widget2 *const widget); A_DELETE_COPY(SetupTabScroll) diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 06627f1a4..b81e3aced 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -44,8 +44,9 @@ const int ITEM_ICON_SIZE = 32; float ShopListBox::mAlpha = 1.0; -ShopListBox::ShopListBox(gcn::ListModel *const listModel) : - ListBox(listModel), +ShopListBox::ShopListBox(const Widget2 *const widget, + gcn::ListModel *const listModel) : + ListBox(widget, listModel), mPlayerMoney(0), mShopItems(nullptr), mItemPopup(new ItemPopup), @@ -58,9 +59,10 @@ ShopListBox::ShopListBox(gcn::ListModel *const listModel) : mForegroundColor = getThemeColor(Theme::LISTBOX); } -ShopListBox::ShopListBox(gcn::ListModel *const listModel, +ShopListBox::ShopListBox(const Widget2 *const widget, + gcn::ListModel *const listModel, ShopItems *const shopListModel) : - ListBox(listModel), + ListBox(widget, listModel), mPlayerMoney(0), mShopItems(shopListModel), mItemPopup(new ItemPopup), diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index d5d649e8b..cafa88d66 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -41,12 +41,14 @@ class ShopListBox final : public ListBox /** * Constructor. */ - ShopListBox(gcn::ListModel *const listModel); + ShopListBox(const Widget2 *const widget, + gcn::ListModel *const listModel); /** * Constructor with shopitems */ - ShopListBox(gcn::ListModel *const listModel, + ShopListBox(const Widget2 *const widget, + gcn::ListModel *const listModel, ShopItems *const shopListModel); A_DELETE_COPY(ShopListBox) diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index bd10988fa..1a6d97de3 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -39,10 +39,11 @@ static const int buttonWidth = 27; static const int buttonSpace = 30; static const int sliderHeight = 30; -SliderList::SliderList(gcn::ListModel *const listModel, +SliderList::SliderList(const Widget2 *const widget, + gcn::ListModel *const listModel, gcn::ActionListener *const listener, std::string eventId) : - Container(), + Container(widget), gcn::ActionListener(), gcn::MouseListener(), mLabel(new Label), diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 3295a87cd..1e57b1101 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -37,7 +37,8 @@ class SliderList final : public Container, public gcn::MouseListener { public: - SliderList(gcn::ListModel *const listModel = nullptr, + SliderList(const Widget2 *const widget, + gcn::ListModel *const listModel = nullptr, gcn::ActionListener *const listener = nullptr, std::string eventId = ""); diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 74e68c74e..c68223d08 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -60,9 +60,9 @@ static std::string const data[TAB_COUNT] = Skin *Tab::tabImg[TAB_COUNT]; -Tab::Tab() : +Tab::Tab(const Widget2 *const widget) : gcn::BasicContainer(), - Widget2(), + Widget2(widget), gcn::MouseListener(), gcn::WidgetListener(), mLabel(new Label), diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 9aca4f4dc..7947ea01a 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -47,7 +47,7 @@ class Tab : public gcn::BasicContainer, public gcn::WidgetListener { public: - Tab(); + Tab(const Widget2 *const widget); A_DELETE_COPY(Tab) diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index ab48113bd..a25a4e422 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -34,8 +34,8 @@ #include "debug.h" -TabbedArea::TabbedArea() : - Widget2(), +TabbedArea::TabbedArea(const Widget2 *const widget) : + Widget2(widget), gcn::ActionListener(), gcn::BasicContainer(), gcn::KeyListener(), @@ -189,7 +189,7 @@ void TabbedArea::addTab(Tab* tab, gcn::Widget* widget) void TabbedArea::addTab(const std::string &caption, gcn::Widget *const widget) { - Tab *const tab = new Tab; + Tab *const tab = new Tab(this); tab->setCaption(caption); mTabsToDelete.push_back(tab); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 40d3458e9..81d19777e 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -50,7 +50,7 @@ class TabbedArea final : public Widget2, /** * Constructor. */ - TabbedArea(); + TabbedArea(const Widget2 *const widget); A_DELETE_COPY(TabbedArea) diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 8eb32e038..13a4a4ad0 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -27,14 +27,16 @@ #include "debug.h" -TabStrip::TabStrip(const std::string &group, const int height, +TabStrip::TabStrip(const Widget2 *const widget, + const std::string &group, const int height, const int spacing) : - WidgetGroup(group, height, spacing) + WidgetGroup(widget, group, height, spacing) { } -TabStrip::TabStrip(const int height, const int spacing) : - WidgetGroup("", height, spacing) +TabStrip::TabStrip(const Widget2 *const widget, + const int height, const int spacing) : + WidgetGroup(widget, "", height, spacing) { } diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h index 2524b95e8..7af9cbd78 100644 --- a/src/gui/widgets/tabstrip.h +++ b/src/gui/widgets/tabstrip.h @@ -29,10 +29,12 @@ class TabStrip final : public WidgetGroup { public: - TabStrip(const std::string &group, const int height, + TabStrip(const Widget2 *const widget, + const std::string &group, const int height, const int spacing = 0); - TabStrip(const int height, const int spacing = 0); + TabStrip(const Widget2 *const widget, + const int height, const int spacing = 0); A_DELETE_COPY(TabStrip) diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp index 6416fcd8a..8ead199a3 100644 --- a/src/gui/widgets/tradetab.cpp +++ b/src/gui/widgets/tradetab.cpp @@ -38,8 +38,8 @@ #include "debug.h" -TradeTab::TradeTab() : - ChatTab(_("Trade")) +TradeTab::TradeTab(const Widget2 *const widget) : + ChatTab(widget, _("Trade")) { } diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h index 79f9a5d0c..a7d1bb0c7 100644 --- a/src/gui/widgets/tradetab.h +++ b/src/gui/widgets/tradetab.h @@ -31,7 +31,7 @@ class TradeTab final : public ChatTab { public: - TradeTab(); + TradeTab(const Widget2 *const widget); A_DELETE_COPY(TradeTab) diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 026a2f6f9..7eeb98675 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -23,9 +23,10 @@ #include "debug.h" -VertContainer::VertContainer(const int verticalItemSize, const bool resizable, +VertContainer::VertContainer(const Widget2 *const widget, + const int verticalItemSize, const bool resizable, const int leftSpacing) : - Container(), + Container(widget), gcn::WidgetListener(), mVerticalItemSize(verticalItemSize), mCount(0), diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index f81fdc90b..d01562280 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -38,7 +38,8 @@ class VertContainer final : public Container, public gcn::WidgetListener { public: - VertContainer(const int verticalItemSize, const bool resizable = true, + VertContainer(const Widget2 *const widget, + const int verticalItemSize, const bool resizable = true, const int leftSpacing = 0); A_DELETE_COPY(VertContainer) diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 4960d356a..0e5d3bfcd 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -35,8 +35,8 @@ #include "debug.h" -WhisperTab::WhisperTab(const std::string &nick) : - ChatTab(nick), +WhisperTab::WhisperTab(const Widget2 *const widget, const std::string &nick) : + ChatTab(widget, nick), mNick(nick) { setWhisperTabColors(); diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index d97c961e4..cef656816 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -61,7 +61,7 @@ class WhisperTab final : public ChatTab * * @param nick the name of the player this tab is whispering to */ - WhisperTab(const std::string &nick); + WhisperTab(const Widget2 *const widget, const std::string &nick); ~WhisperTab(); diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 314b95105..8a602be63 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -31,6 +31,11 @@ class Widget2 { } + Widget2(const Widget2 *const widget) : + mPalette(widget ? widget->mPalette : 1) + { + } + ~Widget2() { } diff --git a/src/gui/widgets/widgetgroup.cpp b/src/gui/widgets/widgetgroup.cpp index aacabd0f1..2861fa6fc 100644 --- a/src/gui/widgets/widgetgroup.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -24,9 +24,10 @@ #include "debug.h" -WidgetGroup::WidgetGroup(const std::string &group, const int height, +WidgetGroup::WidgetGroup(const Widget2 *const widget, + const std::string &group, const int height, const int spacing) : - Container(), + Container(widget), gcn::WidgetListener(), gcn::ActionListener(), mSpacing(spacing), diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index 7f1b7c8d5..40b472a7b 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -33,7 +33,8 @@ class WidgetGroup : public Container, public gcn::ActionListener { public: - WidgetGroup(const std::string &group, const int height, + WidgetGroup(const Widget2 *const widget, + const std::string &group, const int height, const int spacing); A_DELETE_COPY(WidgetGroup) diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index 41aed2ba3..9acba77b2 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -30,6 +30,11 @@ WindowContainer *windowContainer = nullptr; +WindowContainer::WindowContainer(const Widget2 *const widget) : + Container(widget) +{ +} + void WindowContainer::logic() { delete_all(mDeathList); diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index e1b74be1c..7a7b77fe1 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -36,6 +36,8 @@ class WindowContainer : public Container { public: + WindowContainer(const Widget2 *const widget); + /** * Do GUI logic. This functions adds automatic deletion of objects that * volunteered to be deleted. |