summaryrefslogtreecommitdiff
path: root/include/widgets.h
diff options
context:
space:
mode:
authorpixel <pixel>2006-01-31 17:02:39 +0000
committerpixel <pixel>2006-01-31 17:02:39 +0000
commit97b4a5904a989e216b1fbb4d0a55b7340bd7f88a (patch)
tree2a40bfc8ae9f4fce9bf9a30bfc7fef7a6bb1f074 /include/widgets.h
parentedd5fe68be2a2a9e23a87f65f6a89807c34b7c3f (diff)
Way too much changes - all over.
Diffstat (limited to 'include/widgets.h')
-rw-r--r--include/widgets.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/include/widgets.h b/include/widgets.h
index 66a6191..109f623 100644
--- a/include/widgets.h
+++ b/include/widgets.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.h,v 1.13 2005-12-02 16:21:59 pixel Exp $ */
+/* $Id: widgets.h,v 1.14 2006-01-31 17:02:39 pixel Exp $ */
#ifndef __WIDGETS_H__
#define __WIDGETS_H__
@@ -222,7 +222,7 @@ namespace mogltk {
*/
class MsgBox : public SmartBox {
public:
- MsgBox(shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont);
+ MsgBox(action *, shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont);
virtual ~MsgBox();
private:
mogltk::font * msgbox_font;
@@ -370,12 +370,28 @@ namespace mogltk {
InputDialog(action *, shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont);
virtual ~InputDialog();
String GetText();
- void do_action();
private:
InputText * it;
- action * a;
mogltk::font * InputDialog_font;
};
+
+ /*!
+ The ActionAndDelete provides a mechanism for a widget to run an action then self-destruct.
+ Used for example by the MsgBox and InputDialog.
+ */
+ class ActionAndDelete : public mogltk::widgets::action {
+ public:
+ ActionAndDelete(mogltk::widget * _parent, mogltk::widgets::action * _a) : parent(_parent), a(_a) { }
+ virtual void do_action(mogltk::widget *) {
+ if (a)
+ a->do_action(parent);
+ delete parent;
+ delete this;
+ }
+ private:
+ mogltk::widget * parent;
+ mogltk::widgets::action * a;
+ };
};
};