summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-20 16:50:41 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-20 16:50:41 +0000
commitaab0b1724897e186d2d4056da7f0cd34ccc12fcb (patch)
tree1c3283dbc83600eaddc2c0da3ad091dc10c40719 /src/gui/char_select.cpp
parentc49b55c2963486930248729f7f6ba9a3d7d2cf8c (diff)
downloadMana-aab0b1724897e186d2d4056da7f0cd34ccc12fcb.tar.gz
Mana-aab0b1724897e186d2d4056da7f0cd34ccc12fcb.tar.bz2
Mana-aab0b1724897e186d2d4056da7f0cd34ccc12fcb.tar.xz
Mana-aab0b1724897e186d2d4056da7f0cd34ccc12fcb.zip
Improved layout manager. Reworked layout of character selection dialog box.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp58
1 files changed, 24 insertions, 34 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index e8381bef..ea04b6bc 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -36,6 +36,8 @@
#include "unregisterdialog.h"
+#include "widgets/layout.h"
+
#include "../game.h"
#include "../localplayer.h"
#include "../main.h"
@@ -100,40 +102,28 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo,
mMoneyLabel = new gcn::Label(strprintf(_("Money: %d"), 0));
mPlayerBox = new PlayerBox();
- int w = 195;
- int h = 220;
- setContentSize(w, h);
- mPlayerBox->setDimension(gcn::Rectangle(5, 5, w - 10, 90));
- mNameLabel->setDimension(gcn::Rectangle(10, 100, 128, 16));
- mLevelLabel->setDimension(gcn::Rectangle(10, 116, 128, 16));
- mMoneyLabel->setDimension(gcn::Rectangle(10, 148, 128, 16));
- mPreviousButton->setPosition(5, 170);
- mNextButton->setPosition(mPreviousButton->getWidth() + 10, 170);
- mNewCharButton->setPosition(5, h - 5 - mNewCharButton->getHeight());
- mDelCharButton->setPosition(
- 5 + mNewCharButton->getWidth() + 5,
- mNewCharButton->getY());
- mCancelButton->setPosition(
- w - 5 - mCancelButton->getWidth(),
- mNewCharButton->getY());
- mSelectButton->setPosition(
- mCancelButton->getX() - 5 - mSelectButton->getWidth(),
- mNewCharButton->getY());
- mUnRegisterButton->setPosition(
- w - 5 - mUnRegisterButton->getWidth(),
- mCancelButton->getY() - 5 - mUnRegisterButton->getHeight());
-
- add(mPlayerBox);
- add(mSelectButton);
- add(mCancelButton);
- add(mUnRegisterButton);
- add(mNewCharButton);
- add(mDelCharButton);
- add(mPreviousButton);
- add(mNextButton);
- add(mNameLabel);
- add(mLevelLabel);
- add(mMoneyLabel);
+ setPadding(8);
+ Layout &layout = getLayout();
+ place(0, 0, mPlayerBox, 1, 5).setPadding(3);
+ place(1, 0, mNameLabel, 3);
+ place(1, 1, mLevelLabel, 3);
+ place(1, 2, mMoneyLabel, 3);
+ place(1, 3, mPreviousButton);
+ place(2, 3, mNextButton);
+ place(1, 4, mNewCharButton);
+ place(2, 4, mDelCharButton);
+ layout.setWidth(230);
+ layout.setColWidth(0, 80);
+ layout.setColWidth(3, Layout::FILL);
+ layout.matchColWidth(1, 2);
+ layout.setRowHeight(5, 5);
+ layout.flush();
+ place(0, 0, mUnRegisterButton);
+ place(2, 0, mSelectButton);
+ place(3, 0, mCancelButton);
+ layout.setColWidth(1, Layout::FILL);
+ reflowLayout();
+ forgetLayout();
setLocationRelativeTo(getParent());
setVisible(true);