summaryrefslogtreecommitdiff
path: root/src/gui/setup_players.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-01-23 14:33:20 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-01-23 14:33:20 +0100
commit35fb23f4c447004b8d6488bff697932f7abdba73 (patch)
tree25e8e16b17cb01b726e0f48795f55b69f9347785 /src/gui/setup_players.cpp
parentcae4571d182fcd64f6bef94552770768f651f30a (diff)
parent3d5cde132a10ccb1905688e29dca428aa772c777 (diff)
downloadmana-35fb23f4c447004b8d6488bff697932f7abdba73.tar.gz
mana-35fb23f4c447004b8d6488bff697932f7abdba73.tar.bz2
mana-35fb23f4c447004b8d6488bff697932f7abdba73.tar.xz
mana-35fb23f4c447004b8d6488bff697932f7abdba73.zip
Merge branch 'master' of git@gitorious.org:tmw/eathena
Diffstat (limited to 'src/gui/setup_players.cpp')
-rw-r--r--src/gui/setup_players.cpp58
1 files changed, 32 insertions, 26 deletions
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 0f7ba03b..30ad5f81 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -1,21 +1,21 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright (C) 2004 The Mana World Development Team
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -25,9 +25,11 @@
#include "checkbox.h"
#include "ok_dialog.h"
-#include "../player_relations.h"
+#include "widgets/layouthelper.h"
+
#include "../configuration.h"
#include "../log.h"
+#include "../player_relations.h"
#include "../sound.h"
#include "../utils/gettext.h"
@@ -44,7 +46,7 @@
#define ROW_HEIGHT 12
// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... except
// that, right now, the widget doesn't exactly scale either.
-#define NAME_COLUMN_WIDTH 120
+#define NAME_COLUMN_WIDTH 155
#define RELATION_CHOICE_COLUMN_WIDTH 80
#define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column)
@@ -129,7 +131,8 @@ public:
mPlayers = player_names;
// set up widgets
- for (unsigned int r = 0; r < player_names->size(); ++r) {
+ for (unsigned int r = 0; r < player_names->size(); ++r)
+ {
std::string name = (*player_names)[r];
gcn::Widget *widget = new gcn::Label(name);
mWidgets.push_back(widget);
@@ -221,7 +224,6 @@ Setup_Players::Setup_Players():
mIgnoreActionChoicesBox(new gcn::DropDown(new IgnoreChoicesListModel()))
{
setOpaque(false);
- setDimension(gcn::Rectangle(0, 0, 250, 200));
int table_width = NAME_COLUMN_WIDTH + RELATION_CHOICE_COLUMN_WIDTH;
mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH);
@@ -229,28 +231,30 @@ Setup_Players::Setup_Players():
RELATION_CHOICE_COLUMN_WIDTH);
mPlayerTitleTable->setDimension(gcn::Rectangle(10, 10, table_width, 10));
mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));
- for (int i = 0; i < COLUMNS_NR; i++) {
+
+ for (int i = 0; i < COLUMNS_NR; i++)
+ {
mPlayerTableTitleModel->set(0, i,
new gcn::Label(gettext(table_titles[i])));
}
+
mPlayerTitleTable->setLinewiseSelection(true);
- mPlayerScrollArea->setDimension(gcn::Rectangle(10, 25, table_width + COLUMNS_NR, 90));
mPlayerScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mPlayerTable->setActionEventId(ACTION_TABLE);
mPlayerTable->setLinewiseSelection(true);
mPlayerTable->addActionListener(this);
- mDeleteButton->setPosition(10, 118);
-
gcn::Label *ignore_action_label = new gcn::Label(_("When ignoring:"));
- ignore_action_label->setPosition(80, 118);
mIgnoreActionChoicesBox->setDimension(gcn::Rectangle(80, 132, 120, 12));
mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY);
mIgnoreActionChoicesBox->addActionListener(this);
+
int ignore_strategy_index = 0; // safe default
- if (player_relations.getPlayerIgnoreStrategy()) {
+
+ if (player_relations.getPlayerIgnoreStrategy())
+ {
ignore_strategy_index = player_relations.getPlayerIgnoreStrategyIndex(
player_relations.getPlayerIgnoreStrategy()->mShortName);
if (ignore_strategy_index < 0)
@@ -259,22 +263,24 @@ Setup_Players::Setup_Players():
mIgnoreActionChoicesBox->setSelected(ignore_strategy_index);
mIgnoreActionChoicesBox->adjustHeight();
- mPersistIgnores->setPosition(80, 148);
- mDefaultTrading->setPosition(80, 160);
- mDefaultWhisper->setPosition(80, 172);
-
reset();
- add(ignore_action_label);
- add(mDefaultTrading);
- add(mDefaultWhisper);
- add(mIgnoreActionChoicesBox);
- add(mDeleteButton);
- add(mPlayerScrollArea);
- add(mPlayerTitleTable);
- add(mPersistIgnores);
+ // Do the layout
+ LayoutHelper h(this);
+ ContainerPlacer place = h.getPlacer(0, 0);
+
+ place(0, 0, mPlayerTitleTable, 4);
+ place(0, 1, mPlayerScrollArea, 4, 4).setPadding(2);
+ place(0, 5, mDeleteButton);
+ place(2, 5, ignore_action_label);
+ place(2, 6, mIgnoreActionChoicesBox, 2).setPadding(2);
+ place(2, 7, mPersistIgnores);
+ place(2, 8, mDefaultTrading);
+ place(2, 9, mDefaultWhisper);
player_relations.addListener(this);
+
+ setDimension(gcn::Rectangle(0, 0, 250, 200));
}
Setup_Players::~Setup_Players()