summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-19 23:56:04 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:42 +0300
commitd59cd9111c1e86b224ea62cc975c49b157e2b3cf (patch)
treed7186479633c0269573e92b5a5213d04b84b3995 /src
parent71d2b482d84246b8456ea863f94a9a766d33f197 (diff)
downloadplus-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')
-rw-r--r--src/channel.cpp5
-rw-r--r--src/channel.h5
-rw-r--r--src/client.cpp2
-rw-r--r--src/game.cpp10
-rw-r--r--src/gui/buydialog.cpp2
-rw-r--r--src/gui/charselectdialog.cpp10
-rw-r--r--src/gui/chatwindow.cpp6
-rw-r--r--src/gui/debugwindow.cpp20
-rw-r--r--src/gui/debugwindow.h10
-rw-r--r--src/gui/editserverdialog.cpp2
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/inventorywindow.cpp4
-rw-r--r--src/gui/itemamountwindow.cpp2
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/logindialog.cpp4
-rw-r--r--src/gui/npcdialog.cpp2
-rw-r--r--src/gui/questswindow.cpp2
-rw-r--r--src/gui/selldialog.cpp2
-rw-r--r--src/gui/serverdialog.cpp7
-rw-r--r--src/gui/setup.cpp26
-rw-r--r--src/gui/setup_audio.cpp4
-rw-r--r--src/gui/setup_audio.h2
-rw-r--r--src/gui/setup_chat.cpp4
-rw-r--r--src/gui/setup_chat.h2
-rw-r--r--src/gui/setup_colors.cpp6
-rw-r--r--src/gui/setup_colors.h2
-rw-r--r--src/gui/setup_input.cpp8
-rw-r--r--src/gui/setup_input.h2
-rw-r--r--src/gui/setup_joystick.cpp6
-rw-r--r--src/gui/setup_joystick.h2
-rw-r--r--src/gui/setup_other.cpp4
-rw-r--r--src/gui/setup_other.h2
-rw-r--r--src/gui/setup_perfomance.cpp4
-rw-r--r--src/gui/setup_perfomance.h2
-rw-r--r--src/gui/setup_players.cpp4
-rw-r--r--src/gui/setup_players.h2
-rw-r--r--src/gui/setup_relations.cpp17
-rw-r--r--src/gui/setup_relations.h2
-rw-r--r--src/gui/setup_theme.cpp24
-rw-r--r--src/gui/setup_theme.h2
-rw-r--r--src/gui/setup_video.cpp8
-rw-r--r--src/gui/setup_video.h2
-rw-r--r--src/gui/setup_visual.cpp4
-rw-r--r--src/gui/setup_visual.h2
-rw-r--r--src/gui/shopwindow.cpp4
-rw-r--r--src/gui/shortcutwindow.cpp9
-rw-r--r--src/gui/skilldialog.cpp19
-rw-r--r--src/gui/socialwindow.cpp85
-rw-r--r--src/gui/statuswindow.cpp32
-rw-r--r--src/gui/textcommandeditor.cpp6
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/gui/widgets/avatarlistbox.cpp5
-rw-r--r--src/gui/widgets/avatarlistbox.h2
-rw-r--r--src/gui/widgets/battletab.cpp4
-rw-r--r--src/gui/widgets/battletab.h2
-rw-r--r--src/gui/widgets/channeltab.cpp4
-rw-r--r--src/gui/widgets/channeltab.h2
-rw-r--r--src/gui/widgets/chattab.cpp4
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/container.cpp4
-rw-r--r--src/gui/widgets/container.h2
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/desktop.h2
-rw-r--r--src/gui/widgets/dropdown.cpp5
-rw-r--r--src/gui/widgets/dropdown.h3
-rw-r--r--src/gui/widgets/extendedlistbox.cpp5
-rw-r--r--src/gui/widgets/extendedlistbox.h3
-rw-r--r--src/gui/widgets/flowcontainer.cpp5
-rw-r--r--src/gui/widgets/flowcontainer.h3
-rw-r--r--src/gui/widgets/guildchattab.cpp4
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/gui/widgets/horizontcontainer.cpp5
-rw-r--r--src/gui/widgets/horizontcontainer.h3
-rw-r--r--src/gui/widgets/listbox.cpp5
-rw-r--r--src/gui/widgets/listbox.h2
-rw-r--r--src/gui/widgets/popup.cpp8
-rw-r--r--src/gui/widgets/popup.h3
-rw-r--r--src/gui/widgets/radiogroup.cpp5
-rw-r--r--src/gui/widgets/radiogroup.h3
-rw-r--r--src/gui/widgets/setupitem.cpp18
-rw-r--r--src/gui/widgets/setupitem.h3
-rw-r--r--src/gui/widgets/setuptab.cpp4
-rw-r--r--src/gui/widgets/setuptab.h2
-rw-r--r--src/gui/widgets/setuptabscroll.cpp6
-rw-r--r--src/gui/widgets/setuptabscroll.h2
-rw-r--r--src/gui/widgets/shoplistbox.cpp10
-rw-r--r--src/gui/widgets/shoplistbox.h6
-rw-r--r--src/gui/widgets/sliderlist.cpp5
-rw-r--r--src/gui/widgets/sliderlist.h3
-rw-r--r--src/gui/widgets/tab.cpp4
-rw-r--r--src/gui/widgets/tab.h2
-rw-r--r--src/gui/widgets/tabbedarea.cpp6
-rw-r--r--src/gui/widgets/tabbedarea.h2
-rw-r--r--src/gui/widgets/tabstrip.cpp10
-rw-r--r--src/gui/widgets/tabstrip.h6
-rw-r--r--src/gui/widgets/tradetab.cpp4
-rw-r--r--src/gui/widgets/tradetab.h2
-rw-r--r--src/gui/widgets/vertcontainer.cpp5
-rw-r--r--src/gui/widgets/vertcontainer.h3
-rw-r--r--src/gui/widgets/whispertab.cpp4
-rw-r--r--src/gui/widgets/whispertab.h2
-rw-r--r--src/gui/widgets/widget2.h5
-rw-r--r--src/gui/widgets/widgetgroup.cpp5
-rw-r--r--src/gui/widgets/widgetgroup.h3
-rw-r--r--src/gui/widgets/windowcontainer.cpp5
-rw-r--r--src/gui/widgets/windowcontainer.h2
-rw-r--r--src/gui/windowmenu.cpp4
-rw-r--r--src/gui/windowmenu.h2
-rw-r--r--src/gui/worldselectdialog.cpp2
-rw-r--r--src/guildmanager.cpp2
-rw-r--r--src/net/ea/gui/guildtab.cpp4
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp4
-rw-r--r--src/net/ea/gui/partytab.h2
-rw-r--r--src/net/ea/guildhandler.cpp2
-rw-r--r--src/net/ea/partyhandler.cpp2
-rw-r--r--src/net/eathena/gui/guildtab.cpp4
-rw-r--r--src/net/eathena/gui/guildtab.h2
-rw-r--r--src/net/eathena/gui/partytab.cpp4
-rw-r--r--src/net/eathena/gui/partytab.h2
-rw-r--r--src/net/tmwa/gui/guildtab.cpp4
-rw-r--r--src/net/tmwa/gui/guildtab.h2
-rw-r--r--src/net/tmwa/gui/partytab.cpp4
-rw-r--r--src/net/tmwa/gui/partytab.h2
124 files changed, 378 insertions, 301 deletions
diff --git a/src/channel.cpp b/src/channel.cpp
index 1fda46cc5..4b980ca17 100644
--- a/src/channel.cpp
+++ b/src/channel.cpp
@@ -26,13 +26,14 @@
#include "debug.h"
-Channel::Channel(const short id,
+Channel::Channel(const Widget2 *const widget,
+ const short id,
const std::string &name,
const std::string &announcement) :
mId(id),
mName(name),
mAnnouncement(announcement),
- mTab(new ChannelTab(this))
+ mTab(new ChannelTab(widget, this))
{
}
diff --git a/src/channel.h b/src/channel.h
index 3ffd5326e..7dae64722 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -23,6 +23,8 @@
#ifndef CHANNEL_H
#define CHANNEL_H
+#include "gui/widgets/widget2.h"
+
#include <string>
#include "localconsts.h"
@@ -39,7 +41,8 @@ class Channel final
* @param name the name of the channel.
* @param announcement a welcome message.
*/
- Channel(const short id,
+ Channel(const Widget2 *const widget,
+ const short id,
const std::string &name,
const std::string &announcement = std::string());
diff --git a/src/client.cpp b/src/client.cpp
index 2a2986dd0..8e28bea20 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -996,7 +996,7 @@ int Client::gameExec()
if (!top)
break;
- mDesktop = new Desktop;
+ mDesktop = new Desktop(nullptr);
top->add(mDesktop);
int x = top->getWidth();
mSetupButton = new Button(_("Setup"), "Setup", this);
diff --git a/src/game.cpp b/src/game.cpp
index 4aad0eec5..5d988f19f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -256,16 +256,16 @@ static void createGuiWindows()
if (serverVersion >= 6)
questsWindow = new QuestsWindow;
- localChatTab = new ChatTab(_("General"));
+ localChatTab = new ChatTab(chatWindow, _("General"));
localChatTab->setAllowHighlight(false);
localChatTab->loadFromLogFile("#General");
- debugChatTab = new ChatTab(_("Debug"));
+ debugChatTab = new ChatTab(chatWindow, _("Debug"));
debugChatTab->setAllowHighlight(false);
if (config.getBoolValue("enableTradeTab"))
{
- tradeChatTab = new TradeTab;
+ tradeChatTab = new TradeTab(chatWindow);
tradeChatTab->setAllowHighlight(false);
}
else
@@ -275,7 +275,7 @@ static void createGuiWindows()
if (config.getBoolValue("enableBattleTab"))
{
- battleChatTab = new BattleTab;
+ battleChatTab = new BattleTab(chatWindow);
battleChatTab->setAllowHighlight(false);
}
else
@@ -401,7 +401,7 @@ Game::Game():
createGuiWindows();
- windowMenu = new WindowMenu;
+ windowMenu = new WindowMenu(nullptr);
// mWindowMenu = windowMenu;
if (windowContainer)
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index e855c1b57..702a4b171 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -80,7 +80,7 @@ void BuyDialog::init()
mShopItems = new ShopItems;
- mShopItemList = new ShopListBox(mShopItems, mShopItems);
+ mShopItemList = new ShopListBox(this, mShopItems, mShopItems);
mScrollArea = new ScrollArea(mShopItemList,
getOptionBool("showbackground"), "buy_background.xml");
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index e778cd921..06997bc34 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -96,7 +96,8 @@ class CharDeleteConfirm final : public ConfirmDialog
class CharacterDisplay final : public Container
{
public:
- CharacterDisplay(CharSelectDialog *const charSelectDialog);
+ CharacterDisplay(const Widget2 *const widget,
+ CharSelectDialog *const charSelectDialog);
A_DELETE_COPY(CharacterDisplay)
@@ -184,7 +185,7 @@ CharSelectDialog::CharSelectDialog(LoginData *const data):
for (int i = 0; i < static_cast<int>(mLoginData->characterSlots); i++)
{
- mCharacterEntries.push_back(new CharacterDisplay(this));
+ mCharacterEntries.push_back(new CharacterDisplay(this, this));
placer(i % SLOTS_PER_ROW, static_cast<int>(i) / SLOTS_PER_ROW,
mCharacterEntries[i]);
}
@@ -555,8 +556,9 @@ bool CharSelectDialog::selectByName(const std::string &name,
}
-CharacterDisplay::CharacterDisplay(CharSelectDialog *const charSelectDialog) :
- Container(),
+CharacterDisplay::CharacterDisplay(const Widget2 *const widget,
+ CharSelectDialog *const charSelectDialog) :
+ Container(widget),
mCharacter(nullptr),
mPlayerBox(new PlayerBox(nullptr)),
mName(new Label("wwwwwwwwwwwwwwwwwwwwwwww")),
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index b32ff190f..5da35efaf 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -160,12 +160,12 @@ ChatWindow::ChatWindow():
gcn::ActionListener(),
gcn::KeyListener(),
mItemLinkHandler(new ItemLinkHandler),
- mChatTabs(new TabbedArea),
+ mChatTabs(new TabbedArea(this)),
mChatInput(new ChatInput(this, mChatTabs)),
mTmpVisible(false),
mReturnToggles(config.getBoolValue("ReturnToggles")),
mColorListModel(new ColorListModel),
- mColorPicker(new DropDown(mColorListModel)),
+ mColorPicker(new DropDown(this, mColorListModel)),
mChatColor(config.getIntValue("chatColor")),
mChatHistoryIndex(0),
mGMLoaded(false),
@@ -1126,7 +1126,7 @@ WhisperTab *ChatWindow::addWhisperTab(const std::string &nick,
}
else
{
- ret = new WhisperTab(nick);
+ ret = new WhisperTab(this, nick);
if (gui && !player_relations.isGoodName(nick))
ret->setLabelFont(gui->getSecureFont());
mWhispers[tempNick] = ret;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index a163ac1c6..120195aef 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -48,10 +48,10 @@
DebugWindow::DebugWindow():
Window(_("Debug"), false, nullptr, "debug.xml"),
- mTabs(new TabbedArea),
- mMapWidget(new MapDebugTab),
- mTargetWidget(new TargetDebugTab),
- mNetWidget(new NetDebugTab)
+ mTabs(new TabbedArea(this)),
+ mMapWidget(new MapDebugTab(this)),
+ mTargetWidget(new TargetDebugTab(this)),
+ mNetWidget(new NetDebugTab(this))
{
setWindowName("Debug");
if (setupWindow)
@@ -134,8 +134,8 @@ void DebugWindow::widgetResized(const gcn::Event &event)
mTabs->setDimension(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
-MapDebugTab::MapDebugTab() :
- DebugTab(),
+MapDebugTab::MapDebugTab(const Widget2 *const widget) :
+ DebugTab(widget),
mMusicFileLabel(new Label(strprintf(_("Music:")))),
mMapLabel(new Label(strprintf(_("Map:")))),
mMinimapLabel(new Label(strprintf(_("Minimap:")))),
@@ -258,8 +258,8 @@ void MapDebugTab::logic()
mLPSLabel->setCaption(strprintf(_("%d LPS"), lps));
}
-TargetDebugTab::TargetDebugTab() :
- DebugTab(),
+TargetDebugTab::TargetDebugTab(const Widget2 *const widget) :
+ DebugTab(widget),
mTargetLabel(new Label(strprintf("%s ?", _("Target:")))),
mTargetIdLabel(new Label(strprintf("%s ? ", _("Target Id:")))),
mTargetLevelLabel(new Label(strprintf("%s ?", _("Target level:")))),
@@ -362,8 +362,8 @@ void TargetDebugTab::logic()
mAttackDelayLabel->adjustSize();
}
-NetDebugTab::NetDebugTab() :
- DebugTab(),
+NetDebugTab::NetDebugTab(const Widget2 *const widget) :
+ DebugTab(widget),
mPingLabel(new Label(" ")),
mInPackets1Label(new Label(" ")),
mOutPackets1Label(new Label(" "))
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 8ed1bad74..5828269c3 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -37,8 +37,8 @@ class DebugTab : public Container
friend class DebugWindow;
public:
- DebugTab() :
- Container()
+ DebugTab(const Widget2 *const widget) :
+ Container(widget)
{ }
A_DELETE_COPY(DebugTab)
@@ -56,7 +56,7 @@ class MapDebugTab final : public DebugTab
friend class DebugWindow;
public:
- MapDebugTab();
+ MapDebugTab(const Widget2 *const widget);
A_DELETE_COPY(MapDebugTab)
@@ -82,7 +82,7 @@ class TargetDebugTab final : public DebugTab
friend class DebugWindow;
public:
- TargetDebugTab();
+ TargetDebugTab(const Widget2 *const widget);
A_DELETE_COPY(TargetDebugTab)
@@ -106,7 +106,7 @@ class NetDebugTab final : public DebugTab
friend class DebugWindow;
public:
- NetDebugTab();
+ NetDebugTab(const Widget2 *const widget);
A_DELETE_COPY(NetDebugTab)
diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp
index 93a0f00c9..0e9e976f4 100644
--- a/src/gui/editserverdialog.cpp
+++ b/src/gui/editserverdialog.cpp
@@ -74,7 +74,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent,
mOkButton(new Button(_("OK"), "addServer", this)),
mCancelButton(new Button(_("Cancel"), "cancel", this)),
mTypeListModel(new TypeListModel()),
- mTypeField(new DropDown(mTypeListModel)),
+ mTypeField(new DropDown(this, mTypeListModel)),
mServerDialog(parent),
mServer(server),
mIndex(index)
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b0d62fbff..5939345f0 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -97,7 +97,7 @@ Gui::Gui(Graphics *const graphics) :
mFocusHandler = new FocusHandler;
// Initialize top GUI widget
- WindowContainer *const guiTop = new WindowContainer;
+ WindowContainer *const guiTop = new WindowContainer(nullptr);
guiTop->setFocusable(true);
guiTop->setSize(graphics->mWidth, graphics->mHeight);
guiTop->setOpaque(false);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f0f619fae..4446d2958 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -109,7 +109,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
mSlotsBar(new ProgressBar(0.0f, 100, 0, Theme::PROG_INVY_SLOTS)),
mFilter(nullptr),
mSortModel(new SortListModel()),
- mSortDropDown(new DropDown(mSortModel, this, "sort")),
+ mSortDropDown(new DropDown(this, mSortModel, this, "sort")),
mNameFilter(new TextField("", true, this, "namefilter", true)),
mSortDropDownCell(nullptr),
mNameFilterCell(nullptr),
@@ -152,7 +152,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
const int size = config.getIntValue("fontSize");
- mFilter = new TabStrip("filter_" + getWindowName(), size + 8);
+ mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 8);
mFilter->addActionListener(this);
mFilter->setActionEventId("tag_");
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 299006e6f..4e6e80f88 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -198,7 +198,7 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
if (mUsage == ShopBuyAdd)
{
mItemsModal = new ItemsModal;
- mItemDropDown = new DropDown(mItemsModal);
+ mItemDropDown = new DropDown(this, mItemsModal);
mItemDropDown->setActionEventId("itemType");
mItemDropDown->addActionListener(this);
}
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 114738a15..cd2663079 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -45,7 +45,7 @@
#include "debug.h"
-ItemPopup::ItemPopup():
+ItemPopup::ItemPopup() :
Popup("ItemPopup", "itempopup.xml"),
mItemName(new Label),
mItemDesc(new TextBox),
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index e38e6291a..8ccb5ba04 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -126,7 +126,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateTypeLabel(new Label(_("Update:"))),
mUpdateHostLabel(nullptr),
mUpdateTypeModel(new UpdateTypeModel()),
- mUpdateTypeDropDown(new DropDown(mUpdateTypeModel)),
+ mUpdateTypeDropDown(new DropDown(this, mUpdateTypeModel)),
mServerButton(new Button(_("Change Server"), "server", this)),
mLoginButton(new Button(_("Login"), "login", this)),
mRegisterButton(new Button(_("Register"), "register", this)),
@@ -149,7 +149,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateHostLabel = new Label(strprintf(_("Update host: %s"),
mLoginData->updateHost.c_str()));
mUpdateListModel = new UpdateListModel(mLoginData);
- mUpdateHostDropDown = new DropDown(mUpdateListModel,
+ mUpdateHostDropDown = new DropDown(this, mUpdateListModel,
this, "updateselect");
const std::string str = serverConfig.getValue("updateHost2", "");
if (!str.empty())
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index d558c417b..566a44e0b 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -69,7 +69,7 @@ NpcDialog::NpcDialog(const int npcId) :
mTextBox(new BrowserBox(BrowserBox::AUTO_WRAP)),
mScrollArea(new ScrollArea(mTextBox,
getOptionBool("showtextbackground"), "npc_textbackground.xml")),
- mItemList(new ExtendedListBox(this)),
+ mItemList(new ExtendedListBox(this, this)),
mListScrollArea(new ScrollArea(mItemList,
getOptionBool("showlistbackground"), "npc_listbackground.xml")),
mItemLinkHandler(new ItemLinkHandler),
diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp
index 29b921159..825b471ab 100644
--- a/src/gui/questswindow.cpp
+++ b/src/gui/questswindow.cpp
@@ -90,7 +90,7 @@ QuestsWindow::QuestsWindow() :
Window(_("Quests"), false, nullptr, "quests.xml"),
gcn::ActionListener(),
mQuestsModel(new QuestsModel),
- mQuestsListBox(new ExtendedListBox(mQuestsModel)),
+ mQuestsListBox(new ExtendedListBox(this, mQuestsModel)),
mQuestScrollArea(new ScrollArea(mQuestsListBox,
getOptionBool("showlistbackground"), "quests_list_background.xml")),
mItemLinkHandler(new ItemLinkHandler),
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 13d06bc47..df488e0a0 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -79,7 +79,7 @@ void SellDialog::init()
// Create a ShopItems instance, that is aware of duplicate entries.
mShopItems = new ShopItems(true);
- mShopItemList = new ShopListBox(mShopItems, mShopItems);
+ mShopItemList = new ShopListBox(this, mShopItems, mShopItems);
mScrollArea = new ScrollArea(mShopItemList,
getOptionBool("showbackground"), "sell_background.xml");
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 973bf0c76..223eb464c 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -157,8 +157,9 @@ void ServersListModel::setVersionString(const int index,
class ServersListBox final : public ListBox
{
public:
- ServersListBox(ServersListModel *const model) :
- ListBox(model),
+ ServersListBox(const Widget2 *const widget,
+ ServersListModel *const model) :
+ ListBox(widget, model),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mTextColor(getThemeColor(Theme::LISTBOX)),
mNotSupportedColor(getThemeColor(Theme::SERVER_VERSION_NOT_SUPPORTED))
@@ -255,7 +256,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
mLoadButton(new Button(_("Load"), "load", this)),
mServers(ServerInfos()),
mServersListModel(new ServersListModel(&mServers, this)),
- mServersList(new ServersListBox(mServersListModel)),
+ mServersList(new ServersListBox(this, mServersListModel)),
mDir(dir),
mDownloadStatus(DOWNLOADING_UNKNOWN),
mDownload(nullptr),
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index f06396ff7..b45fd99b3 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -53,7 +53,7 @@ Setup::Setup():
Window(_("Setup"), false, nullptr, "setup.xml"),
gcn::ActionListener(),
mResetWindows(nullptr),
- mPanel(new TabbedArea)
+ mPanel(new TabbedArea(this))
{
setCloseButton(true);
setResizable(true);
@@ -93,18 +93,18 @@ Setup::Setup():
mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40));
mPanel->enableScrollButtons(true);
- mTabs.push_back(new Setup_Video);
- mTabs.push_back(new Setup_Visual);
- mTabs.push_back(new Setup_Audio);
- mTabs.push_back(new Setup_Perfomance);
- mTabs.push_back(new Setup_Joystick);
- mTabs.push_back(new Setup_Input);
- mTabs.push_back(new Setup_Colors);
- mTabs.push_back(new Setup_Chat);
- mTabs.push_back(new Setup_Players);
- mTabs.push_back(new Setup_Relations);
- mTabs.push_back(new Setup_Theme);
- mTabs.push_back(new Setup_Other);
+ mTabs.push_back(new Setup_Video(this));
+ mTabs.push_back(new Setup_Visual(this));
+ mTabs.push_back(new Setup_Audio(this));
+ mTabs.push_back(new Setup_Perfomance(this));
+ mTabs.push_back(new Setup_Joystick(this));
+ mTabs.push_back(new Setup_Input(this));
+ mTabs.push_back(new Setup_Colors(this));
+ mTabs.push_back(new Setup_Chat(this));
+ mTabs.push_back(new Setup_Players(this));
+ mTabs.push_back(new Setup_Relations(this));
+ mTabs.push_back(new Setup_Theme(this));
+ mTabs.push_back(new Setup_Other(this));
for (std::list<SetupTab*>::const_iterator i = mTabs.begin(),
i_end = mTabs.end();
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 447b4633c..ed2a57397 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -52,8 +52,8 @@ public:
{ }
};
-Setup_Audio::Setup_Audio() :
- SetupTabScroll(),
+Setup_Audio::Setup_Audio(const Widget2 *const widget) :
+ SetupTabScroll(widget),
mSoundModel(new SoundsModel()),
mChannelsList(new SetupItemNames())
{
diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h
index ec0843a72..b99377405 100644
--- a/src/gui/setup_audio.h
+++ b/src/gui/setup_audio.h
@@ -32,7 +32,7 @@
class Setup_Audio final : public SetupTabScroll
{
public:
- Setup_Audio();
+ Setup_Audio(const Widget2 *const widget);
A_DELETE_COPY(Setup_Audio)
diff --git a/src/gui/setup_chat.cpp b/src/gui/setup_chat.cpp
index 6a4abdf81..b03211872 100644
--- a/src/gui/setup_chat.cpp
+++ b/src/gui/setup_chat.cpp
@@ -41,8 +41,8 @@
#include "debug.h"
-Setup_Chat::Setup_Chat() :
- SetupTabScroll()
+Setup_Chat::Setup_Chat(const Widget2 *const widget) :
+ SetupTabScroll(widget)
{
setName(_("Chat"));
diff --git a/src/gui/setup_chat.h b/src/gui/setup_chat.h
index 46016f656..a628f9c66 100644
--- a/src/gui/setup_chat.h
+++ b/src/gui/setup_chat.h
@@ -33,7 +33,7 @@ class EditDialog;
class Setup_Chat final : public SetupTabScroll
{
public:
- Setup_Chat();
+ Setup_Chat(const Widget2 *const widget);
A_DELETE_COPY(Setup_Chat)
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 3332c1d73..0e916b691 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -48,10 +48,10 @@
const std::string Setup_Colors::rawmsg =
_("This is what the color looks like");
-Setup_Colors::Setup_Colors() :
- SetupTab(),
+Setup_Colors::Setup_Colors(const Widget2 *const widget) :
+ SetupTab(widget),
gcn::SelectionListener(),
- mColorBox(new ListBox(userPalette)),
+ mColorBox(new ListBox(this, userPalette)),
mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")),
mPreview(new BrowserBox(BrowserBox::AUTO_WRAP)),
mTextPreview(new TextPreview(rawmsg)),
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 6f3b8eafb..9e11b5325 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -41,7 +41,7 @@ class Setup_Colors final : public SetupTab,
public gcn::SelectionListener
{
public:
- Setup_Colors();
+ Setup_Colors(const Widget2 *const widget);
A_DELETE_COPY(Setup_Colors)
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index efb4006ff..2ee478ac2 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -90,15 +90,15 @@ class KeyListModel final : public gcn::ListModel
int mSize;
};
-Setup_Input::Setup_Input() :
- SetupTab(),
+Setup_Input::Setup_Input(const Widget2 *const widget) :
+ SetupTab(widget),
mKeyListModel(new KeyListModel),
- mKeyList(new ListBox(mKeyListModel)),
+ mKeyList(new ListBox(this, mKeyListModel)),
mAssignKeyButton(new Button(_("Assign"), "assign", this)),
mUnassignKeyButton(new Button(_("Unassign"), "unassign", this)),
mDefaultButton(new Button(_("Default"), "default", this)),
mResetKeysButton(new Button(_("Reset all keys"), "resetkeys", this)),
- mTabs(new TabStrip(config.getIntValue("fontSize") + 10)),
+ mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)),
mKeySetting(false),
mActionDataSize(new int [9])
{
diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h
index ba7ddcf29..188be4a26 100644
--- a/src/gui/setup_input.h
+++ b/src/gui/setup_input.h
@@ -42,7 +42,7 @@ class Setup_Input final : public SetupTab
/**
* Constructor
*/
- Setup_Input();
+ Setup_Input(const Widget2 *const widget);
A_DELETE_COPY(Setup_Input)
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 851869d75..d556c20e3 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -41,13 +41,13 @@
extern Joystick *joystick;
-Setup_Joystick::Setup_Joystick() :
- SetupTab(),
+Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
+ SetupTab(widget),
mCalibrateLabel(new Label(_("Press the button to start calibration"))),
mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
mJoystickEnabled(new CheckBox(_("Enable joystick"))),
mNamesModel(new NamesModel()),
- mNamesDropDown(new DropDown(mNamesModel)),
+ mNamesDropDown(new DropDown(this, mNamesModel)),
mUseInactiveCheckBox(new CheckBox(_("Use joystick if client "
"window inactive"), config.getBoolValue("useInactiveJoystick")))
{
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index 17b8f6df1..4af6cc8aa 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -36,7 +36,7 @@ class NamesModel;
class Setup_Joystick final : public SetupTab
{
public:
- Setup_Joystick();
+ Setup_Joystick(const Widget2 *const widget);
A_DELETE_COPY(Setup_Joystick)
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 424a518f2..45927bd7d 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -32,8 +32,8 @@
#include "debug.h"
-Setup_Other::Setup_Other() :
- SetupTabScroll(),
+Setup_Other::Setup_Other(const Widget2 *const widget) :
+ SetupTabScroll(widget),
mProxyTypeList(new SetupItemNames()),
mShortcutsList(new SetupItemNames())
{
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index a56742f26..940fcbfc6 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -33,7 +33,7 @@ class TextField;
class Setup_Other final : public SetupTabScroll
{
public:
- Setup_Other();
+ Setup_Other(const Widget2 *const widget);
A_DELETE_COPY(Setup_Other)
diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp
index 555e36020..c1615a1aa 100644
--- a/src/gui/setup_perfomance.cpp
+++ b/src/gui/setup_perfomance.cpp
@@ -41,8 +41,8 @@
#include "debug.h"
-Setup_Perfomance::Setup_Perfomance() :
- SetupTabScroll()
+Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) :
+ SetupTabScroll(widget)
{
setName(_("Perfomance"));
diff --git a/src/gui/setup_perfomance.h b/src/gui/setup_perfomance.h
index 8639520a1..3b6799635 100644
--- a/src/gui/setup_perfomance.h
+++ b/src/gui/setup_perfomance.h
@@ -33,7 +33,7 @@ class EditDialog;
class Setup_Perfomance final : public SetupTabScroll
{
public:
- Setup_Perfomance();
+ Setup_Perfomance(const Widget2 *const widget);
A_DELETE_COPY(Setup_Perfomance)
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index fb3bbe87c..f1f171957 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -41,8 +41,8 @@
#include "debug.h"
-Setup_Players::Setup_Players() :
- SetupTabScroll()
+Setup_Players::Setup_Players(const Widget2 *const widget) :
+ SetupTabScroll(widget)
{
setName(_("Players"));
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 2f1013d70..0e7f313a9 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -33,7 +33,7 @@ class EditDialog;
class Setup_Players final : public SetupTabScroll
{
public:
- Setup_Players();
+ Setup_Players(const Widget2 *const widget);
A_DELETE_COPY(Setup_Players)
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 05f6ecb26..5d5b8beac 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -91,10 +91,11 @@ public:
}
};
-class PlayerTableModel final : public TableModel
+class PlayerTableModel final : public Widget2, public TableModel
{
public:
- PlayerTableModel() :
+ PlayerTableModel(const Widget2 *const widget) :
+ Widget2(widget),
TableModel(),
mPlayers(nullptr),
mListModel(new PlayerRelationListModel)
@@ -160,7 +161,7 @@ public:
gcn::Widget *const widget = new Label(name);
mWidgets.push_back(widget);
- DropDown *const choicebox = new DropDown(mListModel);
+ DropDown *const choicebox = new DropDown(this, mListModel);
choicebox->setSelected(player_relations.getRelation(name));
mWidgets.push_back(choicebox);
}
@@ -234,11 +235,11 @@ static const std::string ACTION_DELETE = "delete";
static const std::string ACTION_TABLE = "table";
static const std::string ACTION_STRATEGY = "strategy";
-Setup_Relations::Setup_Relations() :
- SetupTab(),
+Setup_Relations::Setup_Relations(const Widget2 *const widget) :
+ SetupTab(widget),
PlayerRelationsListener(),
mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)),
- mPlayerTableModel(new PlayerTableModel),
+ mPlayerTableModel(new PlayerTableModel(this)),
mPlayerTable(new GuiTable(mPlayerTableModel)),
mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)),
mPlayerScrollArea(new ScrollArea(mPlayerTable)),
@@ -258,7 +259,7 @@ Setup_Relations::Setup_Relations() :
mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));
mIgnoreActionChoicesModel = new IgnoreChoicesListModel;
- mIgnoreActionChoicesBox = new DropDown(mIgnoreActionChoicesModel);
+ mIgnoreActionChoicesBox = new DropDown(widget, mIgnoreActionChoicesModel);
for (int i = 0; i < COLUMNS_NR; i++)
mPlayerTableTitleModel->set(0, i, new Label(gettext(table_titles[i])));
@@ -408,7 +409,7 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED)
void Setup_Relations::updateAll()
{
- PlayerTableModel *const model = new PlayerTableModel();
+ PlayerTableModel *const model = new PlayerTableModel(this);
mPlayerTable->setModel(model);
delete mPlayerTableModel;
mPlayerTableModel = model;
diff --git a/src/gui/setup_relations.h b/src/gui/setup_relations.h
index 83b72ba97..13f1a0573 100644
--- a/src/gui/setup_relations.h
+++ b/src/gui/setup_relations.h
@@ -47,7 +47,7 @@ class Setup_Relations final : public SetupTab,
public PlayerRelationsListener
{
public:
- Setup_Relations();
+ Setup_Relations(const Widget2 *const widget);
A_DELETE_COPY(Setup_Relations)
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 66d806fc4..d13d12589 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -159,43 +159,43 @@ public:
}
};
-Setup_Theme::Setup_Theme() :
- SetupTab(),
+Setup_Theme::Setup_Theme(const Widget2 *const widget) :
+ SetupTab(widget),
mThemeLabel(new Label(_("Gui theme"))),
mThemesModel(new ThemesModel),
- mThemeDropDown(new DropDown(mThemesModel)),
+ mThemeDropDown(new DropDown(this, mThemesModel)),
mTheme(config.getStringValue("theme")),
mFontsModel(new FontsModel),
mFontLabel(new Label(_("Main Font"))),
- mFontDropDown(new DropDown(mFontsModel)),
+ mFontDropDown(new DropDown(this, mFontsModel)),
mFont(config.getStringValue("font")),
mLangListModel(new LangListModel),
mLangLabel(new Label(_("Language"))),
- mLangDropDown(new DropDown(mLangListModel)),
+ mLangDropDown(new DropDown(this, mLangListModel)),
mLang(config.getStringValue("lang")),
mBoldFontLabel(new Label(_("Bold font"))),
- mBoldFontDropDown(new DropDown(mFontsModel)),
+ mBoldFontDropDown(new DropDown(this, mFontsModel)),
mBoldFont(config.getStringValue("boldFont")),
mParticleFontLabel(new Label(_("Particle font"))),
- mParticleFontDropDown(new DropDown(mFontsModel)),
+ mParticleFontDropDown(new DropDown(this, mFontsModel)),
mParticleFont(config.getStringValue("particleFont")),
mHelpFontLabel(new Label(_("Help font"))),
- mHelpFontDropDown(new DropDown(mFontsModel)),
+ mHelpFontDropDown(new DropDown(this, mFontsModel)),
mHelpFont(config.getStringValue("helpFont")),
mSecureFontLabel(new Label(_("Secure font"))),
- mSecureFontDropDown(new DropDown(mFontsModel)),
+ mSecureFontDropDown(new DropDown(this, mFontsModel)),
mSecureFont(config.getStringValue("secureFont")),
mJapanFontLabel(new Label(_("Japanese font"))),
- mJapanFontDropDown(new DropDown(mFontsModel)),
+ mJapanFontDropDown(new DropDown(this, mFontsModel)),
mJapanFont(config.getStringValue("japanFont")),
mFontSizeListModel(new FontSizeChoiceListModel),
mFontSizeLabel(new Label(_("Font size"))),
mFontSize(config.getIntValue("fontSize")),
- mFontSizeDropDown(new DropDown(mFontSizeListModel)),
+ mFontSizeDropDown(new DropDown(this, mFontSizeListModel)),
mNpcFontSizeListModel(new FontSizeChoiceListModel),
mNpcFontSizeLabel(new Label(_("Npc font size"))),
mNpcFontSize(config.getIntValue("npcfontSize")),
- mNpcFontSizeDropDown(new DropDown(mNpcFontSizeListModel)),
+ mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel)),
// TRANSLATORS: button name with information about selected theme
mInfoButton(new Button(_("i"), ACTION_INFO, this))
{
diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h
index 2a0152035..49d57a578 100644
--- a/src/gui/setup_theme.h
+++ b/src/gui/setup_theme.h
@@ -39,7 +39,7 @@ class ThemesModel;
class Setup_Theme final : public SetupTab
{
public:
- Setup_Theme();
+ Setup_Theme(const Widget2 *const widget);
A_DELETE_COPY(Setup_Theme)
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index d06a922ac..736c3daa9 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -219,8 +219,8 @@ public:
}
};
-Setup_Video::Setup_Video() :
- SetupTab(),
+Setup_Video::Setup_Video(const Widget2 *const widget) :
+ SetupTab(widget),
gcn::KeyListener(),
mFullScreenEnabled(config.getBoolValue("screen")),
mOpenGLEnabled(config.getIntValue("opengl")),
@@ -230,7 +230,7 @@ Setup_Video::Setup_Video() :
mEnableResize(config.getBoolValue("enableresize")),
mNoFrame(config.getBoolValue("noframe")),
mModeListModel(new ModeListModel),
- mModeList(new ListBox(mModeListModel)),
+ mModeList(new ListBox(widget, mModeListModel)),
mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
mCustomCursorCheckBox(new CheckBox(_("Custom cursor"),
mCustomCursorEnabled)),
@@ -252,7 +252,7 @@ Setup_Video::Setup_Video() :
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mOpenGLListModel = new OpenGLListModel;
- mOpenGLDropDown = new DropDown(mOpenGLListModel),
+ mOpenGLDropDown = new DropDown(widget, mOpenGLListModel),
mOpenGLDropDown->setSelected(mOpenGLEnabled);
mModeList->setEnabled(true);
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 5adcec8b6..4b34adb90 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -43,7 +43,7 @@ class TextDialog;
class Setup_Video final : public SetupTab, public gcn::KeyListener
{
public:
- Setup_Video();
+ Setup_Video(const Widget2 *const widget);
A_DELETE_COPY(Setup_Video)
diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp
index 77321127a..a7d83b11d 100644
--- a/src/gui/setup_visual.cpp
+++ b/src/gui/setup_visual.cpp
@@ -30,8 +30,8 @@
#include "debug.h"
-Setup_Visual::Setup_Visual() :
- SetupTabScroll(),
+Setup_Visual::Setup_Visual(const Widget2 *const widget) :
+ SetupTabScroll(widget),
mSpeachList(new SetupItemNames),
mAmbientFxList(new SetupItemNames),
mParticleList(new SetupItemNames),
diff --git a/src/gui/setup_visual.h b/src/gui/setup_visual.h
index 976e1c1c2..ef0ade052 100644
--- a/src/gui/setup_visual.h
+++ b/src/gui/setup_visual.h
@@ -27,7 +27,7 @@
class Setup_Visual final : public SetupTabScroll
{
public:
- Setup_Visual();
+ Setup_Visual(const Widget2 *const widget);
A_DELETE_COPY(Setup_Visual)
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 6f332730e..e61437716 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -78,8 +78,8 @@ ShopWindow::ShopWindow():
mCloseButton(new Button(_("Close"), "close", this)),
mBuyShopItems(new ShopItems),
mSellShopItems(new ShopItems),
- mBuyShopItemList(new ShopListBox(mBuyShopItems, mBuyShopItems)),
- mSellShopItemList(new ShopListBox(mSellShopItems, mSellShopItems)),
+ mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)),
+ mSellShopItemList(new ShopListBox(this, mSellShopItems, mSellShopItems)),
mBuyScrollArea(new ScrollArea(mBuyShopItemList,
getOptionBool("showbuybackground"), "shop_buy_background.xml")),
mSellScrollArea(new ScrollArea(mSellShopItemList,
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 8a4d45188..8f4374cba 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -41,8 +41,9 @@ int ShortcutWindow::mBoxesWidth = 0;
class ShortcutTab final : public Tab
{
public:
- ShortcutTab(std::string name, ShortcutContainer *const content) :
- Tab(),
+ ShortcutTab(const Widget2 *const widget,
+ std::string name, ShortcutContainer *const content) :
+ Tab(widget),
mContent(content)
{
setCaption(name);
@@ -108,7 +109,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
Window("Window", false, nullptr, skinFile),
mItems(nullptr),
mScrollArea(nullptr),
- mTabs(new TabbedArea)
+ mTabs(new TabbedArea(this))
{
setWindowName(title);
setTitleBarHeight(getPadding() + getTitlePadding());
@@ -155,7 +156,7 @@ void ShortcutWindow::addTab(std::string name, ShortcutContainer *const content)
ScrollArea *const scroll = new ScrollArea(content, false);
scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING);
scroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- Tab *const tab = new ShortcutTab(name, content);
+ Tab *const tab = new ShortcutTab(this, name, content);
mTabs->addTab(tab, scroll);
}
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index df8e2ef13..da608b56a 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -94,8 +94,8 @@ class SkillModel final : public gcn::ListModel
class SkillListBox final : public ListBox
{
public:
- SkillListBox(SkillModel *const model):
- ListBox(model),
+ SkillListBox(const Widget2 *const widget, SkillModel *const model) :
+ ListBox(widget, model),
mModel(model),
mPopup(new TextPopup()),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
@@ -194,8 +194,9 @@ class SkillListBox final : public ListBox
class SkillTab final : public Tab
{
public:
- SkillTab(const std::string &name, SkillListBox *const listBox) :
- Tab(),
+ SkillTab(const Widget2 *const widget,
+ const std::string &name, SkillListBox *const listBox) :
+ Tab(widget),
mListBox(listBox)
{
setCaption(name);
@@ -231,7 +232,7 @@ class SkillTab final : public Tab
SkillDialog::SkillDialog() :
Window(_("Skills"), false, nullptr, "skills.xml"),
gcn::ActionListener(),
- mTabs(new TabbedArea()),
+ mTabs(new TabbedArea(this)),
mPointsLabel(new Label("0")),
mUseButton(new Button(_("Use"), "use", this)),
mIncreaseButton(new Button(_("Up"), "inc", this)),
@@ -399,14 +400,14 @@ void SkillDialog::loadSkills(const std::string &file)
model->updateVisibilities();
- listbox = new SkillListBox(model);
+ listbox = new SkillListBox(this, model);
listbox->setActionEventId("sel");
listbox->addActionListener(this);
scroll = new ScrollArea(listbox, false);
scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
- tab = new SkillTab("Skills", listbox);
+ tab = new SkillTab(this, "Skills", listbox);
mDeleteTabs.push_back(tab);
mTabs->addTab(tab, scroll);
@@ -463,14 +464,14 @@ void SkillDialog::loadSkills(const std::string &file)
model->updateVisibilities();
// possible leak listbox, scroll
- listbox = new SkillListBox(model);
+ listbox = new SkillListBox(this, model);
listbox->setActionEventId("sel");
listbox->addActionListener(this);
scroll = new ScrollArea(listbox, false);
scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
- tab = new SkillTab(setName, listbox);
+ tab = new SkillTab(this, setName, listbox);
mDeleteTabs.push_back(tab);
mTabs->addTab(tab, scroll);
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index e198e8c55..ecce2cc82 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -100,8 +100,8 @@ public:
protected:
friend class SocialWindow;
- SocialTab():
- Tab(),
+ SocialTab(const Widget2 *const widget):
+ Tab(widget),
mInviteDialog(nullptr),
mConfirmDialog(nullptr),
mScroll(nullptr),
@@ -136,8 +136,9 @@ protected:
class SocialGuildTab final : public SocialTab, public gcn::ActionListener
{
public:
- SocialGuildTab(Guild *const guild, const bool showBackground) :
- SocialTab(),
+ SocialGuildTab(const Widget2 *const widget,
+ Guild *const guild, const bool showBackground) :
+ SocialTab(widget),
gcn::ActionListener(),
mGuild(guild)
{
@@ -149,7 +150,7 @@ public:
setSelectedTabColor(&getThemeColor(
Theme::GUILD_SOCIAL_TAB_SELECTED));
- mList = new AvatarListBox(guild);
+ mList = new AvatarListBox(this, guild);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -242,8 +243,9 @@ private:
class SocialGuildTab2 final : public SocialTab, public gcn::ActionListener
{
public:
- SocialGuildTab2(Guild *const guild, const bool showBackground) :
- SocialTab(),
+ SocialGuildTab2(const Widget2 *const widget,
+ Guild *const guild, const bool showBackground) :
+ SocialTab(widget),
gcn::ActionListener(),
mGuild(guild)
{
@@ -255,7 +257,7 @@ public:
setSelectedTabColor(&getThemeColor(
Theme::GUILD_SOCIAL_TAB_SELECTED));
- mList = new AvatarListBox(guild);
+ mList = new AvatarListBox(this, guild);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -304,8 +306,9 @@ private:
class SocialPartyTab final : public SocialTab, public gcn::ActionListener
{
public:
- SocialPartyTab(Party *const party, const bool showBackground) :
- SocialTab(),
+ SocialPartyTab(const Widget2 *const widget,
+ Party *const party, const bool showBackground) :
+ SocialTab(widget),
gcn::ActionListener(),
mParty(party)
{
@@ -317,7 +320,7 @@ public:
setSelectedTabColor(&getThemeColor(
Theme::PARTY_SOCIAL_TAB_SELECTED));
- mList = new AvatarListBox(party);
+ mList = new AvatarListBox(this, party);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -443,11 +446,12 @@ public:
class SocialPlayersTab final : public SocialTab
{
public:
- SocialPlayersTab(std::string name, const bool showBackground) :
- SocialTab(),
+ SocialPlayersTab(const Widget2 *const widget,
+ std::string name, const bool showBackground) :
+ SocialTab(widget),
mBeings(new BeingsListModal())
{
- mList = new AvatarListBox(mBeings);
+ mList = new AvatarListBox(this, mBeings);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -611,11 +615,12 @@ private:
class SocialNavigationTab final : public SocialTab
{
public:
- SocialNavigationTab(const bool showBackground) :
- SocialTab(),
+ SocialNavigationTab(const Widget2 *const widget,
+ const bool showBackground) :
+ SocialTab(widget),
mBeings(new BeingsListModal())
{
- mList = new AvatarListBox(mBeings);
+ mList = new AvatarListBox(this, mBeings);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -949,11 +954,12 @@ protected:
class SocialAttackTab final : public SocialTab
{
public:
- SocialAttackTab(const bool showBackground) :
- SocialTab(),
+ SocialAttackTab(const Widget2 *const widget,
+ const bool showBackground) :
+ SocialTab(widget),
mBeings(new BeingsListModal())
{
- mList = new AvatarListBox(mBeings);
+ mList = new AvatarListBox(this, mBeings);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -1007,11 +1013,12 @@ private:
class SocialPickupTab final : public SocialTab
{
public:
- SocialPickupTab(const bool showBackground) :
- SocialTab(),
+ SocialPickupTab(const Widget2 *const widget,
+ const bool showBackground) :
+ SocialTab(widget),
mBeings(new BeingsListModal())
{
- mList = new AvatarListBox(mBeings);
+ mList = new AvatarListBox(this, mBeings);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -1065,11 +1072,12 @@ private:
class SocialFriendsTab final : public SocialTab
{
public:
- SocialFriendsTab(std::string name, const bool showBackground) :
- SocialTab(),
+ SocialFriendsTab(const Widget2 *const widget,
+ std::string name, const bool showBackground) :
+ SocialTab(widget),
mBeings(new BeingsListModal())
{
- mList = new AvatarListBox(mBeings);
+ mList = new AvatarListBox(this, mBeings);
mScroll = new ScrollArea(mList, showBackground,
"social_background.xml");
@@ -1227,17 +1235,18 @@ SocialWindow::SocialWindow() :
mAttackFilter(nullptr),
mPickupFilter(nullptr),
// TRANSLATORS: here P is title for visible players tab in social window
- mPlayers(new SocialPlayersTab(_("P"),
+ mPlayers(new SocialPlayersTab(this, _("P"),
+ getOptionBool("showtabbackground"))),
+ mNavigation(new SocialNavigationTab(this,
getOptionBool("showtabbackground"))),
- mNavigation(new SocialNavigationTab(getOptionBool("showtabbackground"))),
// TRANSLATORS: here F is title for friends tab in social window
- mFriends(new SocialFriendsTab(_("F"),
+ mFriends(new SocialFriendsTab(this, _("F"),
getOptionBool("showtabbackground"))),
mCreatePopup(new CreatePopup),
mCreateButton(new Button(_("Create"), "create", this)),
mInviteButton(new Button(_("Invite"), "invite", this)),
mLeaveButton(new Button(_("Leave"), "leave", this)),
- mTabs(new TabbedArea),
+ mTabs(new TabbedArea(this)),
mMap(nullptr),
mLastUpdateTime(0),
mNeedUpdate(false),
@@ -1275,7 +1284,7 @@ SocialWindow::SocialWindow() :
if (config.getBoolValue("enableAttackFilter"))
{
- mAttackFilter = new SocialAttackTab(
+ mAttackFilter = new SocialAttackTab(this,
getOptionBool("showtabbackground"));
mTabs->addTab(mAttackFilter, mAttackFilter->mScroll);
}
@@ -1286,7 +1295,7 @@ SocialWindow::SocialWindow() :
if (config.getBoolValue("enablePickupFilter"))
{
- mPickupFilter = new SocialPickupTab(
+ mPickupFilter = new SocialPickupTab(this,
getOptionBool("showtabbackground"));
mTabs->addTab(mPickupFilter, mPickupFilter->mScroll);
}
@@ -1346,9 +1355,15 @@ bool SocialWindow::addTab(Guild *const guild)
SocialTab *tab = nullptr;
if (guild->getServerGuild())
- tab = new SocialGuildTab(guild, getOptionBool("showtabbackground"));
+ {
+ tab = new SocialGuildTab(this, guild,
+ getOptionBool("showtabbackground"));
+ }
else
- tab = new SocialGuildTab2(guild, getOptionBool("showtabbackground"));
+ {
+ tab = new SocialGuildTab2(this, guild,
+ getOptionBool("showtabbackground"));
+ }
mGuilds[guild] = tab;
mTabs->addTab(tab, tab->mScroll);
@@ -1378,7 +1393,7 @@ bool SocialWindow::addTab(Party *const party)
if (mParties.find(party) != mParties.end())
return false;
- SocialPartyTab *const tab = new SocialPartyTab(party,
+ SocialPartyTab *const tab = new SocialPartyTab(this, party,
getOptionBool("showtabbackground"));
mParties[party] = tab;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index a8f5b8e39..6dd4c29a2 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -79,7 +79,8 @@ class AttrDisplay : public Container
}
protected:
- AttrDisplay(const int id, const std::string &name);
+ AttrDisplay(const Widget2 *const widget,
+ const int id, const std::string &name);
const int mId;
const std::string mName;
@@ -92,7 +93,8 @@ class AttrDisplay : public Container
class DerDisplay final : public AttrDisplay
{
public:
- DerDisplay(const int id, const std::string &name);
+ DerDisplay(const Widget2 *const widget,
+ const int id, const std::string &name);
A_DELETE_COPY(DerDisplay)
@@ -103,7 +105,8 @@ class DerDisplay final : public AttrDisplay
class ChangeDisplay final : public AttrDisplay, gcn::ActionListener
{
public:
- ChangeDisplay(const int id, const std::string &name);
+ ChangeDisplay(const Widget2 *const widget,
+ const int id, const std::string &name);
A_DELETE_COPY(ChangeDisplay)
@@ -139,9 +142,9 @@ StatusWindow::StatusWindow() :
mJobLvlLabel(nullptr),
mJobLabel(nullptr),
mJobBar(nullptr),
- mAttrCont(new VertContainer(32)),
+ mAttrCont(new VertContainer(this,32)),
mAttrScroll(new ScrollArea(mAttrCont, false)),
- mDAttrCont(new VertContainer(32)),
+ mDAttrCont(new VertContainer(this, 32)),
mDAttrScroll(new ScrollArea(mDAttrCont, false)),
mCharacterPointsLabel(new Label("C")),
mCorrectionPointsLabel(nullptr),
@@ -441,12 +444,12 @@ void StatusWindow::addAttribute(const int id, const std::string &name,
if (modifiable)
{
- disp = new ChangeDisplay(id, name);
+ disp = new ChangeDisplay(this, id, name);
mAttrCont->add1(disp);
}
else
{
- disp = new DerDisplay(id, name);
+ disp = new DerDisplay(this, id, name);
mDAttrCont->add1(disp);
}
mAttrs[id] = disp;
@@ -748,8 +751,9 @@ void StatusWindow::action(const gcn::ActionEvent &event)
}
}
-AttrDisplay::AttrDisplay(const int id, const std::string &name) :
- Container(),
+AttrDisplay::AttrDisplay(const Widget2 *const widget,
+ const int id, const std::string &name) :
+ Container(widget),
mId(id),
mName(name),
mLayout(new LayoutHelper(this)),
@@ -781,8 +785,9 @@ std::string AttrDisplay::update()
return mName;
}
-DerDisplay::DerDisplay(const int id, const std::string &name) :
- AttrDisplay(id, name)
+DerDisplay::DerDisplay(const Widget2 *const widget,
+ const int id, const std::string &name) :
+ AttrDisplay(widget, id, name)
{
// LayoutHelper h(this);
ContainerPlacer place = mLayout->getPlacer(0, 0);
@@ -793,8 +798,9 @@ DerDisplay::DerDisplay(const int id, const std::string &name) :
update();
}
-ChangeDisplay::ChangeDisplay(const int id, const std::string &name) :
- AttrDisplay(id, name),
+ChangeDisplay::ChangeDisplay(const Widget2 *const widget,
+ const int id, const std::string &name) :
+ AttrDisplay(widget, id, name),
gcn::ActionListener(),
mNeeded(1),
mPoints(new Label(_("Max"))),
diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp
index ceec14f4c..53c638e45 100644
--- a/src/gui/textcommandeditor.cpp
+++ b/src/gui/textcommandeditor.cpp
@@ -178,17 +178,17 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) :
mCommentTextField(new TextField),
mTargetTypeModel(new TargetTypeModel),
mTypeLabel(new Label(_("Target Type:"))),
- mTypeDropDown(new DropDown(mTargetTypeModel)),
+ mTypeDropDown(new DropDown(this, mTargetTypeModel)),
mIconsModal(new IconsModal),
mIconLabel(new Label(_("Icon:"))),
- mIconDropDown(new DropDown(mIconsModal)),
+ mIconDropDown(new DropDown(this, mIconsModal)),
mManaLabel(new Label(_("Mana:"))),
mManaField(new IntTextField(0)),
mMagicLvlLabel(new Label(_("Magic level:"))),
mMagicLvlField(new IntTextField(0)),
mMagicSchoolModel(new MagicSchoolModel),
mSchoolLabel(new Label(_("Magic School:"))),
- mSchoolDropDown(new DropDown(mMagicSchoolModel)),
+ mSchoolDropDown(new DropDown(this, mMagicSchoolModel)),
mSchoolLvlLabel(new Label(_("School level:"))),
mSchoolLvlField(new IntTextField(0)),
mCancelButton(new Button(_("Cancel"), "cancel", this)),
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 4d95a4416..7c423d1f0 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -55,7 +55,7 @@
extern volatile int tick_time;
Viewport::Viewport() :
- WindowContainer(),
+ WindowContainer(nullptr),
gcn::MouseListener(),
mMap(nullptr),
mScrollRadius(config.getIntValue("ScrollRadius")),
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.
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 40e004fdb..70b05bcbc 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -58,8 +58,8 @@ extern Window *botCheckerWindow;
extern Window *socialWindow;
extern Window *questsWindow;
-WindowMenu::WindowMenu() :
- Container(),
+WindowMenu::WindowMenu(const Widget2 *const widget) :
+ Container(widget),
gcn::ActionListener(),
gcn::SelectionListener(),
gcn::MouseListener(),
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index 63fae9215..a1192acce 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -51,7 +51,7 @@ class WindowMenu final : public Container,
public gcn::MouseListener
{
public:
- WindowMenu();
+ WindowMenu(const Widget2 *const widget);
A_DELETE_COPY(WindowMenu)
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index b2b8b0bd5..babb06fa1 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -81,7 +81,7 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds):
gcn::ActionListener(),
gcn::KeyListener(),
mWorldListModel(new WorldListModel(worlds)),
- mWorldList(new ListBox(mWorldListModel)),
+ mWorldList(new ListBox(this, mWorldListModel)),
mChangeLoginButton(new Button(_("Change Login"), "login", this)),
mChooseWorld(new Button(_("Choose World"), "world", this))
{
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index df5c4f6da..27b10681b 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -199,7 +199,7 @@ void GuildManager::createTab(Guild *const guild)
{
if (!mTab)
{
- mTab = new GuildChatTab();
+ mTab = new GuildChatTab(chatWindow);
mTab->loadFromLogFile("#Guild");
if (player_node)
player_node->addGuild(guild);
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index 4726742da..6ec3d7167 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -45,8 +45,8 @@ namespace Ea
{
extern Guild *taGuild;
-GuildTab::GuildTab() :
- ChatTab(_("Guild"))
+GuildTab::GuildTab(const Widget2 *const widget) :
+ ChatTab(widget, _("Guild"))
{
setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB));
setHighlightedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED));
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 58f94e4d3..b100edf07 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -34,7 +34,7 @@ namespace Ea
class GuildTab : public ChatTab
{
public:
- GuildTab();
+ GuildTab(const Widget2 *const widget);
A_DELETE_COPY(GuildTab)
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 11c1086cb..2c97c8cc4 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -45,8 +45,8 @@
namespace Ea
{
-PartyTab::PartyTab() :
- ChatTab(_("Party"))
+PartyTab::PartyTab(const Widget2 *const widget) :
+ ChatTab(widget, _("Party"))
{
setTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB));
setHighlightedTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB_HIGHLIGHTED));
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index 8104217ee..1b6b84de7 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -34,7 +34,7 @@ namespace Ea
class PartyTab : public ChatTab
{
public:
- PartyTab();
+ PartyTab(const Widget2 *const widget);
A_DELETE_COPY(PartyTab)
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 5a6426e16..4af230773 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -121,7 +121,7 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg)
taGuild = g;
if (!guildTab && chatWindow)
{
- guildTab = new GuildTab();
+ guildTab = new GuildTab(chatWindow);
guildTab->loadFromLogFile("#Guild");
if (player_node)
player_node->addGuild(taGuild);
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 6d76e3165..7702bfcee 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -219,7 +219,7 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (!chatWindow)
return;
- Ea::partyTab = new PartyTab();
+ Ea::partyTab = new PartyTab(chatWindow);
Ea::partyTab->loadFromLogFile("#Party");
}
diff --git a/src/net/eathena/gui/guildtab.cpp b/src/net/eathena/gui/guildtab.cpp
index 387cb9446..862b3cd91 100644
--- a/src/net/eathena/gui/guildtab.cpp
+++ b/src/net/eathena/gui/guildtab.cpp
@@ -41,8 +41,8 @@
namespace EAthena
{
-GuildTab::GuildTab() :
- Ea::GuildTab()
+GuildTab::GuildTab(const Widget2 *const widget) :
+ Ea::GuildTab(widget)
{
}
diff --git a/src/net/eathena/gui/guildtab.h b/src/net/eathena/gui/guildtab.h
index e751e19ac..946857fff 100644
--- a/src/net/eathena/gui/guildtab.h
+++ b/src/net/eathena/gui/guildtab.h
@@ -34,7 +34,7 @@ namespace EAthena
class GuildTab : public Ea::GuildTab
{
public:
- GuildTab();
+ GuildTab(const Widget2 *const widget);
A_DELETE_COPY(GuildTab)
diff --git a/src/net/eathena/gui/partytab.cpp b/src/net/eathena/gui/partytab.cpp
index 57a0bf8c1..89682e1eb 100644
--- a/src/net/eathena/gui/partytab.cpp
+++ b/src/net/eathena/gui/partytab.cpp
@@ -44,8 +44,8 @@
namespace EAthena
{
-PartyTab::PartyTab() :
- Ea::PartyTab()
+PartyTab::PartyTab(const Widget2 *const widget) :
+ Ea::PartyTab(widget)
{
}
diff --git a/src/net/eathena/gui/partytab.h b/src/net/eathena/gui/partytab.h
index 621ebfc9e..ce9a46564 100644
--- a/src/net/eathena/gui/partytab.h
+++ b/src/net/eathena/gui/partytab.h
@@ -34,7 +34,7 @@ namespace EAthena
class PartyTab : public Ea::PartyTab
{
public:
- PartyTab();
+ PartyTab(const Widget2 *const widget);
A_DELETE_COPY(PartyTab)
diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp
index 752a33746..4f6029b9d 100644
--- a/src/net/tmwa/gui/guildtab.cpp
+++ b/src/net/tmwa/gui/guildtab.cpp
@@ -41,8 +41,8 @@
namespace TmwAthena
{
-GuildTab::GuildTab() :
- Ea::GuildTab()
+GuildTab::GuildTab(const Widget2 *const widget) :
+ Ea::GuildTab(widget)
{
}
diff --git a/src/net/tmwa/gui/guildtab.h b/src/net/tmwa/gui/guildtab.h
index 8757cb533..187ddc610 100644
--- a/src/net/tmwa/gui/guildtab.h
+++ b/src/net/tmwa/gui/guildtab.h
@@ -34,7 +34,7 @@ namespace TmwAthena
class GuildTab : public Ea::GuildTab
{
public:
- GuildTab();
+ GuildTab(const Widget2 *const widget);
A_DELETE_COPY(GuildTab)
diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp
index 40ed53fcf..1b4bc21de 100644
--- a/src/net/tmwa/gui/partytab.cpp
+++ b/src/net/tmwa/gui/partytab.cpp
@@ -44,8 +44,8 @@
namespace TmwAthena
{
-PartyTab::PartyTab() :
- Ea::PartyTab()
+PartyTab::PartyTab(const Widget2 *const widget) :
+ Ea::PartyTab(widget)
{
}
diff --git a/src/net/tmwa/gui/partytab.h b/src/net/tmwa/gui/partytab.h
index 8431340b6..860a79bbb 100644
--- a/src/net/tmwa/gui/partytab.h
+++ b/src/net/tmwa/gui/partytab.h
@@ -34,7 +34,7 @@ namespace TmwAthena
class PartyTab : public Ea::PartyTab
{
public:
- PartyTab();
+ PartyTab(const Widget2 *const widget);
A_DELETE_COPY(PartyTab)