diff options
author | pixel <pixel> | 2006-01-31 17:02:39 +0000 |
---|---|---|
committer | pixel <pixel> | 2006-01-31 17:02:39 +0000 |
commit | 97b4a5904a989e216b1fbb4d0a55b7340bd7f88a (patch) | |
tree | 2a40bfc8ae9f4fce9bf9a30bfc7fef7a6bb1f074 /lib/inputtext.cc | |
parent | edd5fe68be2a2a9e23a87f65f6a89807c34b7c3f (diff) |
Way too much changes - all over.
Diffstat (limited to 'lib/inputtext.cc')
-rw-r--r-- | lib/inputtext.cc | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/lib/inputtext.cc b/lib/inputtext.cc index 20aa34c..a73a8cd 100644 --- a/lib/inputtext.cc +++ b/lib/inputtext.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: inputtext.cc,v 1.1 2005-12-02 16:21:59 pixel Exp $ */ +/* $Id: inputtext.cc,v 1.2 2006-01-31 17:02:39 pixel Exp $ */ #include <SDL.h> #include <vector> @@ -111,29 +111,20 @@ void mogltk::widgets::InputText::draw() { * The InputDialog child * ************************/ -class InputDialogAction : public mogltk::widgets::action { - public: - InputDialogAction(mogltk::widgets::InputDialog * _parent) : parent(_parent) { } - virtual void do_action(mogltk::widget *) { - parent->do_action(); - delete parent; - delete this; - } - private: - mogltk::widgets::InputDialog * parent; -}; - -mogltk::widgets::InputDialog::InputDialog(mogltk::widgets::action * _a, shape * sh, mogltk::widget * father, const String & caption, const String & text, mogltk::font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), a(_a), InputDialog_font(_font) { +mogltk::widgets::InputDialog::InputDialog(mogltk::widgets::action * a, shape * sh, mogltk::widget * father, const String & caption, const String & text, mogltk::font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), InputDialog_font(_font) { rect size = InputDialog_font->size(text); rect lsize = size; + Button * b; + size.w += 12; size.h += 90; resize(size.w, size.h); center(); - - (it = new InputText((new Button(new InputDialogAction(this), sh, this, size.w / 2 - 25, size.h - 30, 50, 24, "Ok"))->cascade_action(), sh, this, 10, size.h - 60))->resize(size.w - 20, 20); + b = new Button(new ActionAndDelete(this, a), sh, this, size.w / 2 - 25, size.h - 30, 50, 24, "Ok"); + it = new InputText(b->cascade_action(), sh, this, 10, size.h - 60); + it->resize(size.w - 20, 20); new Label(sh, this, 6, 24, lsize.w, lsize.h, text, BLACK, InputDialog_font); set_exclusive(father); @@ -146,8 +137,3 @@ mogltk::widgets::InputDialog::~InputDialog() { String mogltk::widgets::InputDialog::GetText() { return it->GetText(); } - -void mogltk::widgets::InputDialog::do_action() { - if (a) - a->do_action(this); -} |