diff options
author | pixel <pixel> | 2005-12-01 13:48:12 +0000 |
---|---|---|
committer | pixel <pixel> | 2005-12-01 13:48:12 +0000 |
commit | 6f594ad00a07365eec68e16d338151dde23bb648 (patch) | |
tree | 07771966502e5b02c26f0f8414467d1dd78cd70b /include/widgets.h | |
parent | c492bb95a2bb8f739b7c0a061090b9ad4549c975 (diff) |
Lots of fixes and adds in mogltk:
-) fixed a compilation bug in the engine.h file (widget cyclic dependancy)
-) fixed font system so to have unsigned chars instead of chars
-) updated the shaper system so to have different fonts to print
-) updated the widgets with:
-) new methods: center, set_viewport, delete_me
-) Label now has a font
-) MsgBox now has a font
-) InputText widget added
-) InputDialog message box added
-) fixed a bug in the engine causing unwanted mouse move events
-) fixed a bug in the various lists of widgets (.clear != .empty)
Diffstat (limited to 'include/widgets.h')
-rw-r--r-- | include/widgets.h | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/include/widgets.h b/include/widgets.h index bf1cab1..ae29cee 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.11 2005-06-20 22:43:35 pixel Exp $ */ +/* $Id: widgets.h,v 1.12 2005-12-01 13:48:12 pixel Exp $ */ #ifndef __WIDGETS_H__ #define __WIDGETS_H__ @@ -25,6 +25,7 @@ #include <Exceptions.h> #include <shape.h> #include <base.h> +#include <engine.h> namespace mogltk { enum event_t { @@ -77,6 +78,9 @@ namespace mogltk { virtual void SetEnabled(bool); void MoveOnTop(); static void check_timed_events(); + void center(bool cx = true, bool cy = true); + void set_viewport(); + void delete_me(); protected: widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *); virtual void draw(); @@ -179,11 +183,12 @@ namespace mogltk { */ class Label : public widget { public: - Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK); + Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK, mogltk::font * = mogltk::SystemFont); protected: virtual void draw(); private: ColorP color; + mogltk::font * label_font; }; /*! @@ -212,10 +217,12 @@ namespace mogltk { The MsgBox is a SmartBoxClose which holds a text, as well as a 'Ok' button. */ - class MsgBox : public SmartBoxClose { + class MsgBox : public SmartBox { public: - MsgBox(shape *, widget * father, const String & caption, const String & text); + MsgBox(shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont); virtual ~MsgBox(); + private: + mogltk::font * msgbox_font; }; /*! @@ -318,7 +325,45 @@ namespace mogltk { std::vector<node> nodes; int cur_x; int selected; + ContextMenu * subselected; + }; + + class InputText : public widget { + public: + InputText(shape *, widget * father, int x, int y); + virtual ~InputText(); + virtual void draw(); + const String & GetText() const; + void SetText(const String &); + private: + class inputtext_keyevent : public mogltk::engine::keyevent { + public: + inputtext_keyevent(InputText *); + virtual void down(SDL_keysym k); + virtual void up(SDL_keysym k); + private: + InputText * father; + } * it_keyevent; + String text; }; + + /*! + The InputDialog is a kind of MsgBox which holds an InputText as well as a 'Ok' button. + It also contains an action so that the text can be readed from where the dialog + is created. + */ + class InputDialog : public SmartBox { + public: + 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; + }; + }; }; |