From 97b4a5904a989e216b1fbb4d0a55b7340bd7f88a Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 31 Jan 2006 17:02:39 +0000 Subject: Way too much changes - all over. --- include/mcolor.h | 3 ++- include/texture.h | 3 ++- include/widgets.h | 24 ++++++++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/mcolor.h b/include/mcolor.h index b383fee..9592bbe 100644 --- a/include/mcolor.h +++ b/include/mcolor.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: mcolor.h,v 1.9 2004-11-27 21:48:01 pixel Exp $ */ +/* $Id: mcolor.h,v 1.10 2006-01-31 17:02:39 pixel Exp $ */ #ifndef __MCOLOR_H__ #define __MCOLOR_H__ @@ -37,6 +37,7 @@ namespace mogltk { void Norm(); Uint32 toSDL(SDL_PixelFormat * = 0); void fromSDL(Uint32, SDL_PixelFormat * = 0); + void fromHSV(double H, double S, double V); // H in degrees static Color Min; static Color Max; Color c; diff --git a/include/texture.h b/include/texture.h index 3143b02..879adce 100644 --- a/include/texture.h +++ b/include/texture.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: texture.h,v 1.9 2004-11-27 21:48:01 pixel Exp $ */ +/* $Id: texture.h,v 1.10 2006-01-31 17:02:39 pixel Exp $ */ #ifndef __TEXTURE_H__ #define __TEXTURE_H__ @@ -34,6 +34,7 @@ namespace mogltk { texture(int, int, bool = false) throw (GeneralException); texture(Handle *, bool = false) throw (GeneralException); texture(int, int, int, int); + texture(SDL_Surface *, bool = false) throw (GeneralException); virtual ~texture(); SDL_Surface * GetSurface(); Uint32 * GetPixels(); 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; + }; }; }; -- cgit v1.2.3