From a8273ca217ee08f718e6acb3786f3197dff7915c Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 21 Mar 2010 19:02:01 -0600 Subject: Make TextDialog use the layout system Reviewed-by: Chuck Miller Reviewed-by: Philipp Sehmisch --- src/gui/textdialog.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/gui/textdialog.cpp') diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index 120780fe..3e3aafe2 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -38,26 +38,12 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg, mOkButton = new Button(_("OK"), "OK", this); gcn::Button *cancelButton = new Button(_("Cancel"), "CANCEL", this); - int w = textLabel->getWidth() + 20; - int inWidth = mOkButton->getWidth() + cancelButton->getWidth() + 5; - int h = textLabel->getHeight() + 25 + mOkButton->getHeight() + mTextField->getHeight(); + place(0, 0, textLabel, 4); + place(0, 1, mTextField, 4); + place(2, 2, mOkButton); + place(3, 2, cancelButton); - if (w < inWidth + 10) - w = inWidth + 10; - - setContentSize(w, h); - textLabel->setPosition(10, 10); - mTextField->setWidth(85); - mTextField->setPosition(10,20 + textLabel->getHeight()); - mOkButton->setPosition((w - inWidth) / 2, - h - 5 - cancelButton->getHeight()); - cancelButton->setPosition(mOkButton->getX() + mOkButton->getWidth() + 5, - h - 5 - cancelButton->getHeight()); - - add(textLabel); - add(mTextField); - add(mOkButton); - add(cancelButton); + reflowLayout(textLabel->getWidth() + 20); if (getParent()) { -- cgit v1.2.3-70-g09d2