summaryrefslogtreecommitdiff
path: root/include/widgets.h
diff options
context:
space:
mode:
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;
+ };
};
};