From d9a77ca6c6c74e0333079208da0d04117f70e48c Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 7 Jan 2009 23:06:24 +0100 Subject: Used layout manager for character selection dialog Based on the layout from the mainline client done by Guillaume Melquiond in commits aab0b1724897e186d2d4056da7f0cd34ccc12fcb and 97bbe57e21a28544646da087e2a522390bf2ce5c. Fixes hidden Ok button on many translations. --- src/gui/char_select.cpp | 53 +++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 65dafeea..643a598f 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -31,6 +31,8 @@ #include "playerbox.h" #include "textfield.h" +#include "widgets/layout.h" + #include "../game.h" #include "../localplayer.h" #include "../main.h" @@ -93,39 +95,24 @@ CharSelectDialog::CharSelectDialog(Network *network, // Control that shows the Player 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)); - mJobLevelLabel->setDimension(gcn::Rectangle(10, 132, 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()); - - add(mPlayerBox); - add(mSelectButton); - add(mCancelButton); - add(mNewCharButton); - add(mDelCharButton); - add(mPreviousButton); - add(mNextButton); - add(mNameLabel); - add(mLevelLabel); - add(mJobLevelLabel); - add(mMoneyLabel); + mPlayerBox->setWidth(74); + + ContainerPlacer place; + place = getPlacer(0, 0); + place(0, 0, mPlayerBox, 1, 6).setPadding(3); + place(1, 0, mNameLabel, 3); + place(1, 1, mLevelLabel, 3); + place(1, 2, mJobLevelLabel, 3); + place(1, 3, mMoneyLabel, 3); + place(1, 4, mPreviousButton); + place(2, 4, mNextButton); + place(1, 5, mNewCharButton); + place(2, 5, mDelCharButton); + place.getCell().matchColWidth(1, 2); + place = getPlacer(0, 2); + place(0, 0, mSelectButton); + place(1, 0, mCancelButton); + reflowLayout(265, 0); setLocationRelativeTo(getParent()); setVisible(true); -- cgit v1.2.3-70-g09d2