summaryrefslogtreecommitdiff
path: root/src/gui/setup_relations.cpp
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/gui/setup_relations.cpp
parent71d2b482d84246b8456ea863f94a9a766d33f197 (diff)
downloadmanaplus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.gz
manaplus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.bz2
manaplus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.tar.xz
manaplus-d59cd9111c1e86b224ea62cc975c49b157e2b3cf.zip
Add to some controls palette inheritance from other controls.
Diffstat (limited to 'src/gui/setup_relations.cpp')
-rw-r--r--src/gui/setup_relations.cpp17
1 files changed, 9 insertions, 8 deletions
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;