From f9969775e6d2f798a3bfea5c58fc5478dad07eae Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 27 Nov 2004 21:48:01 +0000 Subject: Large dos2unix commit... --- include/base.h | 114 +++++------ include/engine.h | 202 ++++++++++---------- include/font.h | 166 ++++++++-------- include/gettext.h | 126 ++++++------ include/glbase.h | 106 +++++----- include/glfont.h | 76 ++++---- include/glshape.h | 114 +++++------ include/glsprite.h | 88 ++++----- include/glwidgets.h | 76 ++++---- include/mcolor.h | 92 ++++----- include/shape.h | 394 +++++++++++++++++++------------------- include/sprite.h | 146 +++++++------- include/texture.h | 126 ++++++------ include/widgets.h | 542 ++++++++++++++++++++++++++-------------------------- 14 files changed, 1184 insertions(+), 1184 deletions(-) (limited to 'include') diff --git a/include/base.h b/include/base.h index 8573cff..c08c055 100644 --- a/include/base.h +++ b/include/base.h @@ -1,57 +1,57 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: base.h,v 1.9 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __BASE_H__ -#define __BASE_H__ - -#include -#include -#include - -namespace mogltk { - struct rect { - int x, y, w, h; - }; - class base : public Base { - public: - base(int w = 640, int h = 480, int flags = 0) throw(GeneralException); - virtual ~base(); - int GetWidth(void); - int GetHeight(void); - virtual void Flip(bool clear = true); - SDL_Surface * getsurface(); - virtual void Enter2DMode(); - virtual void Leave2DMode(); - virtual bool is2D(); - virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); - void ToggleFullscreen(); - virtual texture * GrabTexture(); - virtual SDL_Surface * GrabSurface(); - protected: - base(int, int, int, int); - void setsurface(SDL_Surface *) throw (GeneralException); - private: - int width, height; - SDL_Surface * surface; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: base.h,v 1.10 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __BASE_H__ +#define __BASE_H__ + +#include +#include +#include + +namespace mogltk { + struct rect { + int x, y, w, h; + }; + class base : public Base { + public: + base(int w = 640, int h = 480, int flags = 0) throw(GeneralException); + virtual ~base(); + int GetWidth(void); + int GetHeight(void); + virtual void Flip(bool clear = true); + SDL_Surface * getsurface(); + virtual void Enter2DMode(); + virtual void Leave2DMode(); + virtual bool is2D(); + virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); + void ToggleFullscreen(); + virtual texture * GrabTexture(); + virtual SDL_Surface * GrabSurface(); + protected: + base(int, int, int, int); + void setsurface(SDL_Surface *) throw (GeneralException); + private: + int width, height; + SDL_Surface * surface; + }; +}; + +#endif diff --git a/include/engine.h b/include/engine.h index 95b12f7..73d12dd 100644 --- a/include/engine.h +++ b/include/engine.h @@ -1,101 +1,101 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: engine.h,v 1.19 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __ENGINE_H__ -#define __ENGINE_H__ - -#include -#include -#include -#include -#include -#include - -namespace mogltk { - class engine : public Base { - public: - class keyevent : public Base { - public: - keyevent(); - virtual ~keyevent(); - virtual void down(SDL_keysym) = 0; - virtual void up(SDL_keysym) = 0; - protected: - keyevent * old_handler, * new_handler; - }; - class mouseevent : public Base { - public: - mouseevent(); - virtual ~mouseevent(); - virtual void move(SDL_MouseMotionEvent) = 0; - virtual void action(SDL_MouseButtonEvent) = 0; - protected: - mouseevent * old_handler, * new_handler; - }; - static int setup() throw(GeneralException); - static int postsetup() throw(GeneralException); - static int GetInited(); - static SDL_RWops * RWFromHandle(Handle *) throw (GeneralException); - static void pollevents() throw (GeneralException); - static void setappactive(bool); - static bool getappactive(); - static void setcursorvisible(bool); - static bool getcursorvisible(); - static void quit(); - static bool quitrequested(); - static int mouseX(); - static int mouseY(); - static int mouseZ(); - static void setmouseX(int); - static void setmouseY(int); - static void setmouseZ(int); - static int mousebuttons(); - static double FPS(); - static void lockmouse(); - static void unlockmouse(); - static void setkeyevent(keyevent *); - static void setmouseevent(mouseevent *); - static keyevent * getkeyevent(); - static mouseevent * getmouseevent(); - static glbase * glbase_o; - static base * base_o; - static widget * root; - private: - static bool inited; - static bool postsetuped; - static bool appactive; - static bool cursorvisible; - static bool quitrequest; - static int mx; - static int my; - static int mz; - static int mbuttons; - static int frames; - static double curfps; - static Uint32 curticks; - static int locked; - static keyevent * keyevent_h; - static mouseevent * mouseevent_h; - static void updatemouse(); - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: engine.h,v 1.20 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __ENGINE_H__ +#define __ENGINE_H__ + +#include +#include +#include +#include +#include +#include + +namespace mogltk { + class engine : public Base { + public: + class keyevent : public Base { + public: + keyevent(); + virtual ~keyevent(); + virtual void down(SDL_keysym) = 0; + virtual void up(SDL_keysym) = 0; + protected: + keyevent * old_handler, * new_handler; + }; + class mouseevent : public Base { + public: + mouseevent(); + virtual ~mouseevent(); + virtual void move(SDL_MouseMotionEvent) = 0; + virtual void action(SDL_MouseButtonEvent) = 0; + protected: + mouseevent * old_handler, * new_handler; + }; + static int setup() throw(GeneralException); + static int postsetup() throw(GeneralException); + static int GetInited(); + static SDL_RWops * RWFromHandle(Handle *) throw (GeneralException); + static void pollevents() throw (GeneralException); + static void setappactive(bool); + static bool getappactive(); + static void setcursorvisible(bool); + static bool getcursorvisible(); + static void quit(); + static bool quitrequested(); + static int mouseX(); + static int mouseY(); + static int mouseZ(); + static void setmouseX(int); + static void setmouseY(int); + static void setmouseZ(int); + static int mousebuttons(); + static double FPS(); + static void lockmouse(); + static void unlockmouse(); + static void setkeyevent(keyevent *); + static void setmouseevent(mouseevent *); + static keyevent * getkeyevent(); + static mouseevent * getmouseevent(); + static glbase * glbase_o; + static base * base_o; + static widget * root; + private: + static bool inited; + static bool postsetuped; + static bool appactive; + static bool cursorvisible; + static bool quitrequest; + static int mx; + static int my; + static int mz; + static int mbuttons; + static int frames; + static double curfps; + static Uint32 curticks; + static int locked; + static keyevent * keyevent_h; + static mouseevent * mouseevent_h; + static void updatemouse(); + }; +}; + +#endif diff --git a/include/font.h b/include/font.h index d69fc50..9530a37 100644 --- a/include/font.h +++ b/include/font.h @@ -1,83 +1,83 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: font.h,v 1.9 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __FONT_H__ -#define __FONT_H__ - -#include -#include -#include -#include -#include -#include -#include - -namespace mogltk { - class font : public Base { - public: - font(Handle *); - virtual ~font(); - virtual void drawentry(Uint16, int, int, ColorP = WHITE); - void drawtotex(texture *, Uint16, int, int, ColorP = WHITE); - void putcursor(int, int); - void putentry(Uint16, ColorP = WHITE); - void putentryontex(texture *, Uint16, ColorP = WHITE); - void drawchar(char, ColorP = WHITE); - void drawcharontex(texture *, char, ColorP = WHITE); - void newline(void); - int printf(const ugly_string &, ...); - int printf(const char *, ...); - int printf(const ugly_string &, va_list); - rect size(const ugly_string &, ...); - rect size(const char *, ...); - rect size(const ugly_string &, va_list); - rect printtotex(texture *, const ugly_string &, ...); - rect printtotex(texture *, const char *, ...); - rect printtotex(texture *, const ugly_string &, va_list); - texture * printtex(rect *, const ugly_string &, ...); - texture * printtex(rect *, const char *, ...); - texture * printtex(rect *, const ugly_string &, va_list); - void setcolor(ColorP); - void setshadow(int); - void setwspace(int); - int findchar(char) const; - int singletextsize(const String &) const; - - protected: - Uint8 * sizes; - Uint16 nbentries, nbcT, nbT; - Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; - int cx, cy, ox; - ColorP textcolor; - int shadow, wspace; - texture * alloctexture(); - void Bind(int); - private: - void checknbind(int, ColorP); - texture ** fonttex; - texture ** fontcache[16]; - Uint16 * corresp; - }; - extern font * SystemFont; - extern font * FixedFont; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: font.h,v 1.10 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __FONT_H__ +#define __FONT_H__ + +#include +#include +#include +#include +#include +#include +#include + +namespace mogltk { + class font : public Base { + public: + font(Handle *); + virtual ~font(); + virtual void drawentry(Uint16, int, int, ColorP = WHITE); + void drawtotex(texture *, Uint16, int, int, ColorP = WHITE); + void putcursor(int, int); + void putentry(Uint16, ColorP = WHITE); + void putentryontex(texture *, Uint16, ColorP = WHITE); + void drawchar(char, ColorP = WHITE); + void drawcharontex(texture *, char, ColorP = WHITE); + void newline(void); + int printf(const ugly_string &, ...); + int printf(const char *, ...); + int printf(const ugly_string &, va_list); + rect size(const ugly_string &, ...); + rect size(const char *, ...); + rect size(const ugly_string &, va_list); + rect printtotex(texture *, const ugly_string &, ...); + rect printtotex(texture *, const char *, ...); + rect printtotex(texture *, const ugly_string &, va_list); + texture * printtex(rect *, const ugly_string &, ...); + texture * printtex(rect *, const char *, ...); + texture * printtex(rect *, const ugly_string &, va_list); + void setcolor(ColorP); + void setshadow(int); + void setwspace(int); + int findchar(char) const; + int singletextsize(const String &) const; + + protected: + Uint8 * sizes; + Uint16 nbentries, nbcT, nbT; + Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; + int cx, cy, ox; + ColorP textcolor; + int shadow, wspace; + texture * alloctexture(); + void Bind(int); + private: + void checknbind(int, ColorP); + texture ** fonttex; + texture ** fontcache[16]; + Uint16 * corresp; + }; + extern font * SystemFont; + extern font * FixedFont; +}; + +#endif diff --git a/include/gettext.h b/include/gettext.h index c4fe094..b530d9c 100644 --- a/include/gettext.h +++ b/include/gettext.h @@ -1,63 +1,63 @@ -/* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ - -#ifndef _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 - -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS - -/* Get declarations of GNU message catalog functions. */ -# include - -#else - -/* Disabled NLS. - The casts to 'const char *' serve the purpose of producing warnings - for invalid uses of the value returned from these functions. - On pre-ANSI systems without 'const', the config.h file is supposed to - contain "#define const". */ -# define gettext(Msgid) ((const char *) (Msgid)) -# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) -# define setlocale(a, b) - -#endif - -/* A pseudo function call that serves as a marker for the automated - extraction of messages, but does not call gettext(). The run-time - translation is done at a different place in the code. - The argument, String, should be a literal string. Concatenated strings - and other string expressions won't work. - The macro's expansion is not parenthesized, so that it is suitable as - initializer for static 'char[]' or 'const char[]' variables. */ -#define gettext_noop(String) String - -#define _(Text) dgettext ("Baltisot", Text) -#define N_(Text) Text - -#endif /* _LIBGETTEXT_H */ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +#else + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) +# define setlocale(a, b) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#define _(Text) dgettext ("Baltisot", Text) +#define N_(Text) Text + +#endif /* _LIBGETTEXT_H */ diff --git a/include/glbase.h b/include/glbase.h index 4528d78..2936549 100644 --- a/include/glbase.h +++ b/include/glbase.h @@ -1,53 +1,53 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glbase.h,v 1.11 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __GLBASE_H__ -#define __GLBASE_H__ - -#include -#include -#include -#include - -namespace mogltk { - class glbase : public base { - public: - glbase(int w = 640, int h = 480, int flags = 0) throw(GeneralException); - virtual ~glbase(); - virtual void Enter2DMode(void); - virtual void Leave2DMode(void); - virtual void Flip(bool clear = true); - virtual bool is2D(void); - virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); - void changefovy(GLdouble); - static void glVertex(GLshort, GLshort, GLshort = 0, GLshort = 1); - static void glVertex(GLint, GLint, GLint = 0, GLint = 1); - static void glVertex(GLfloat, GLfloat, GLfloat = 0.0, GLfloat = 1.0); - static void glVertex(GLdouble, GLdouble, GLdouble = 0.0, GLdouble = 1.0); - virtual texture * GrabTexture(); - virtual SDL_Surface * GrabSurface(); - private: - int twoD; - GLdouble ratio, fovy; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: glbase.h,v 1.12 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __GLBASE_H__ +#define __GLBASE_H__ + +#include +#include +#include +#include + +namespace mogltk { + class glbase : public base { + public: + glbase(int w = 640, int h = 480, int flags = 0) throw(GeneralException); + virtual ~glbase(); + virtual void Enter2DMode(void); + virtual void Leave2DMode(void); + virtual void Flip(bool clear = true); + virtual bool is2D(void); + virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); + void changefovy(GLdouble); + static void glVertex(GLshort, GLshort, GLshort = 0, GLshort = 1); + static void glVertex(GLint, GLint, GLint = 0, GLint = 1); + static void glVertex(GLfloat, GLfloat, GLfloat = 0.0, GLfloat = 1.0); + static void glVertex(GLdouble, GLdouble, GLdouble = 0.0, GLdouble = 1.0); + virtual texture * GrabTexture(); + virtual SDL_Surface * GrabSurface(); + private: + int twoD; + GLdouble ratio, fovy; + }; +}; + +#endif diff --git a/include/glfont.h b/include/glfont.h index bd36f68..b0ab2f6 100644 --- a/include/glfont.h +++ b/include/glfont.h @@ -1,38 +1,38 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glfont.h,v 1.15 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __GLFONT_H__ -#define __GLFONT_H__ - -#include -#include -#include - -namespace mogltk { - class glfont : public font { - public: - glfont(Handle *); - virtual ~glfont(); - void drawentry(Uint16, int, int, ColorP = WHITE); - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: glfont.h,v 1.16 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __GLFONT_H__ +#define __GLFONT_H__ + +#include +#include +#include + +namespace mogltk { + class glfont : public font { + public: + glfont(Handle *); + virtual ~glfont(); + void drawentry(Uint16, int, int, ColorP = WHITE); + }; +}; + +#endif diff --git a/include/glshape.h b/include/glshape.h index 0226ac2..0647633 100644 --- a/include/glshape.h +++ b/include/glshape.h @@ -1,57 +1,57 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glshape.h,v 1.14 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __GLSHAPE_H__ -#define __GLSHAPE_H__ - -#include -#include -#include -#include -#include - -namespace mogltk { - class glshape : public shape { - public: - virtual void pixel(int x, int y, ColorP = WHITE); - virtual void box(int x1, int y1, int x2, int y2, ColorP = WHITE); - virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); - virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); - virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); - virtual void hline(int x1, int x2, int y, ColorP, ColorP); - virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); - virtual void vline(int x, int y1, int y2, ColorP, ColorP); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); - virtual void fdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void sdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); - private: - bool Enter(bool); - virtual bool Enter(); - virtual void Leave(bool); - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: glshape.h,v 1.15 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __GLSHAPE_H__ +#define __GLSHAPE_H__ + +#include +#include +#include +#include +#include + +namespace mogltk { + class glshape : public shape { + public: + virtual void pixel(int x, int y, ColorP = WHITE); + virtual void box(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); + virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); + virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); + virtual void hline(int x1, int x2, int y, ColorP, ColorP); + virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); + virtual void vline(int x, int y1, int y2, ColorP, ColorP); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); + virtual void fdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); + virtual void sdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); + private: + bool Enter(bool); + virtual bool Enter(); + virtual void Leave(bool); + }; +}; + +#endif diff --git a/include/glsprite.h b/include/glsprite.h index 3758a3c..91c3f76 100644 --- a/include/glsprite.h +++ b/include/glsprite.h @@ -1,44 +1,44 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glsprite.h,v 1.6 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __GLSPRITE_H__ -#define __GLSPRITE_H__ - -#include -#include -#include -#include -#include -#include - -namespace mogltk { - class glSprite : public Sprite { - public: - glSprite(Handle *, int, int); - glSprite(Uint8 *, int, int); - virtual ~glSprite(); - virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0); - void bindcorner(float, float); - virtual void drawrotate(int, int, double, ColorP = WHITE); - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: glsprite.h,v 1.7 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __GLSPRITE_H__ +#define __GLSPRITE_H__ + +#include +#include +#include +#include +#include +#include + +namespace mogltk { + class glSprite : public Sprite { + public: + glSprite(Handle *, int, int); + glSprite(Uint8 *, int, int); + virtual ~glSprite(); + virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0); + void bindcorner(float, float); + virtual void drawrotate(int, int, double, ColorP = WHITE); + }; +}; + +#endif diff --git a/include/glwidgets.h b/include/glwidgets.h index f4c6c39..cd87a5f 100644 --- a/include/glwidgets.h +++ b/include/glwidgets.h @@ -1,38 +1,38 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glwidgets.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __GLWIDGETS_H__ -#define __GLWIDGETS_H__ - -#include - -namespace mogltk { - namespace widgets { - class glRoot : public Root { - public: - glRoot(shape *); - protected: - virtual void draw(); - }; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: glwidgets.h,v 1.9 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __GLWIDGETS_H__ +#define __GLWIDGETS_H__ + +#include + +namespace mogltk { + namespace widgets { + class glRoot : public Root { + public: + glRoot(shape *); + protected: + virtual void draw(); + }; + }; +}; + +#endif diff --git a/include/mcolor.h b/include/mcolor.h index e718af4..b383fee 100644 --- a/include/mcolor.h +++ b/include/mcolor.h @@ -1,46 +1,46 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: mcolor.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __MCOLOR_H__ -#define __MCOLOR_H__ - -#include -#include -#include - -namespace mogltk { - class ColorP : public Base { - public: - ColorP(const Color & = WHITE); - ColorP(Uint8, Uint8, Uint8, Uint8); - bool operator==(const ColorP &); - Color * operator->(); - void Bind(); - void Norm(); - Uint32 toSDL(SDL_PixelFormat * = 0); - void fromSDL(Uint32, SDL_PixelFormat * = 0); - static Color Min; - static Color Max; - Color c; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * 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 $ */ + +#ifndef __MCOLOR_H__ +#define __MCOLOR_H__ + +#include +#include +#include + +namespace mogltk { + class ColorP : public Base { + public: + ColorP(const Color & = WHITE); + ColorP(Uint8, Uint8, Uint8, Uint8); + bool operator==(const ColorP &); + Color * operator->(); + void Bind(); + void Norm(); + Uint32 toSDL(SDL_PixelFormat * = 0); + void fromSDL(Uint32, SDL_PixelFormat * = 0); + static Color Min; + static Color Max; + Color c; + }; +}; + +#endif diff --git a/include/shape.h b/include/shape.h index d5932cd..72feba2 100644 --- a/include/shape.h +++ b/include/shape.h @@ -1,197 +1,197 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: shape.h,v 1.15 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __SHAPE_H__ -#define __SHAPE_H__ - -#include -#include -#include -#include -#include - -namespace mogltk { - typedef enum { - LEFT, - CENTER, - RIGHT - } align_t; - class fillwalker : public Base { - public: - fillwalker(); - virtual ~fillwalker(); - virtual void step(int x, int y); - }; - class segwalker : public Base { - public: - segwalker(); - virtual ~segwalker(); - virtual void step(int x1, int y1, int x2, int y2); - }; - class fill : public Base { - public: - fill(); - virtual ~fill(); - void walk(fillwalker *); - void swalk(segwalker *); - void insert(int, int, int, int); - void insertfix(int, int); - int GetMinX() const; - int GetMinY() const; - int GetMaxX() const; - int GetMaxY() const; - texture * GetTexture(); - texture * Talloc(); - texture * GetSTexture(); - texture * STalloc(); - Color last; - private: - void insert(int, int); - struct segment { - int x1, y1, x2, y2; - }; - class sline : public Base { - public: - sline(int, fill *); - virtual ~sline(); - int GetY() const; - void insert(int, int); - void insertfix(int, int); - void walk(fillwalker *); - private: - class point : public Base { - public: - point(int, sline *); - virtual ~point(); - int GetX() const; - int GetY() const; - void walk(fillwalker *); - point * look(int); - private: - int x; - point * next; - sline * header; - }; - int y; - sline * next; - fill * header; - sline * look(int); - protected: - point * pheader; - friend class point; - private: - int count() const; - }; - int minX, minY, maxX, maxY; - texture * cached; - texture * scached; - std::vector segments; - protected: - sline * header; - friend class sline; - }; - class shape : public Base { - public: - shape(SDL_Surface * = 0); - virtual void pixel(int x, int y, ColorP = WHITE); - virtual void circle(int x, int y, int r, ColorP = WHITE); - virtual void pcircle(int x, int y, int r, ColorP = WHITE); - virtual fill * fcircle(int x, int y, int r); - virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); - virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); - virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); - virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); - virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - virtual void hline(int x1, int x2, int y, ColorP, ColorP); - virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); - virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - virtual void vline(int x, int y1, int y2, ColorP, ColorP); - virtual void line(int x1, int y1, int x2, int y2, ColorP = WHITE); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); - virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); - virtual void window(int x1, int y1, int x2, int y2, - const String & title = "", - ColorP titlecolor = DOS_HIGH_WHITE, - ColorP titlebackcolor = DOS_MAGENTA, - ColorP front = DOS_WHITE, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY); - virtual void text(int x, int y, const String &, - ColorP textcolor = DOS_HIGH_WHITE, - align_t align = LEFT); - virtual void text3d(int x, int y, const String &, - ColorP textcolor = DOS_BLACK, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY, - align_t align = LEFT, - bool bevel = false); - virtual void button(int x1, int y1, int x2, int y2, const String &, - bool bevel = false, - ColorP front = DOS_WHITE, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY, - ColorP round = DOS_BLACK, - ColorP textcolor = DOS_BLACK, - ColorP tshade1 = DOS_HIGH_WHITE, - ColorP tshade2 = DOS_GRAY); - SDL_Surface * GetSurf(); - private: - void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE); - virtual bool Enter(); - virtual void Leave(bool); - SDL_Surface * surf; - }; - - class filldrawer : public fillwalker { - public: - filldrawer(fill *, texture *, ColorP = DOS_WHITE); - virtual ~filldrawer(); - virtual void step(int x, int y); - private: - fill * f; - texture * t; - ColorP c; - int oldx, oldy; - }; - class segdrawer : public segwalker { - public: - segdrawer(fill *, texture *, ColorP = DOS_WHITE); - virtual ~segdrawer(); - virtual void step(int x1, int y1, int x2, int y2); - private: - fill * f; - texture * t; - ColorP c; - shape * sh; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: shape.h,v 1.16 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __SHAPE_H__ +#define __SHAPE_H__ + +#include +#include +#include +#include +#include + +namespace mogltk { + typedef enum { + LEFT, + CENTER, + RIGHT + } align_t; + class fillwalker : public Base { + public: + fillwalker(); + virtual ~fillwalker(); + virtual void step(int x, int y); + }; + class segwalker : public Base { + public: + segwalker(); + virtual ~segwalker(); + virtual void step(int x1, int y1, int x2, int y2); + }; + class fill : public Base { + public: + fill(); + virtual ~fill(); + void walk(fillwalker *); + void swalk(segwalker *); + void insert(int, int, int, int); + void insertfix(int, int); + int GetMinX() const; + int GetMinY() const; + int GetMaxX() const; + int GetMaxY() const; + texture * GetTexture(); + texture * Talloc(); + texture * GetSTexture(); + texture * STalloc(); + Color last; + private: + void insert(int, int); + struct segment { + int x1, y1, x2, y2; + }; + class sline : public Base { + public: + sline(int, fill *); + virtual ~sline(); + int GetY() const; + void insert(int, int); + void insertfix(int, int); + void walk(fillwalker *); + private: + class point : public Base { + public: + point(int, sline *); + virtual ~point(); + int GetX() const; + int GetY() const; + void walk(fillwalker *); + point * look(int); + private: + int x; + point * next; + sline * header; + }; + int y; + sline * next; + fill * header; + sline * look(int); + protected: + point * pheader; + friend class point; + private: + int count() const; + }; + int minX, minY, maxX, maxY; + texture * cached; + texture * scached; + std::vector segments; + protected: + sline * header; + friend class sline; + }; + class shape : public Base { + public: + shape(SDL_Surface * = 0); + virtual void pixel(int x, int y, ColorP = WHITE); + virtual void circle(int x, int y, int r, ColorP = WHITE); + virtual void pcircle(int x, int y, int r, ColorP = WHITE); + virtual fill * fcircle(int x, int y, int r); + virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); + virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); + virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); + virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); + virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE); + virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); + virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void hline(int x1, int x2, int y, ColorP, ColorP); + virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); + virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void vline(int x, int y1, int y2, ColorP, ColorP); + virtual void line(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); + virtual void window(int x1, int y1, int x2, int y2, + const String & title = "", + ColorP titlecolor = DOS_HIGH_WHITE, + ColorP titlebackcolor = DOS_MAGENTA, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY); + virtual void text(int x, int y, const String &, + ColorP textcolor = DOS_HIGH_WHITE, + align_t align = LEFT); + virtual void text3d(int x, int y, const String &, + ColorP textcolor = DOS_BLACK, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + align_t align = LEFT, + bool bevel = false); + virtual void button(int x1, int y1, int x2, int y2, const String &, + bool bevel = false, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + ColorP round = DOS_BLACK, + ColorP textcolor = DOS_BLACK, + ColorP tshade1 = DOS_HIGH_WHITE, + ColorP tshade2 = DOS_GRAY); + SDL_Surface * GetSurf(); + private: + void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE); + void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual bool Enter(); + virtual void Leave(bool); + SDL_Surface * surf; + }; + + class filldrawer : public fillwalker { + public: + filldrawer(fill *, texture *, ColorP = DOS_WHITE); + virtual ~filldrawer(); + virtual void step(int x, int y); + private: + fill * f; + texture * t; + ColorP c; + int oldx, oldy; + }; + class segdrawer : public segwalker { + public: + segdrawer(fill *, texture *, ColorP = DOS_WHITE); + virtual ~segdrawer(); + virtual void step(int x1, int y1, int x2, int y2); + private: + fill * f; + texture * t; + ColorP c; + shape * sh; + }; +}; + +#endif diff --git a/include/sprite.h b/include/sprite.h index dd701f5..176f793 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -1,73 +1,73 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: sprite.h,v 1.12 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __SPRITE_H__ -#define __SPRITE_H__ - -#include -#include -#include -#include -#include - -namespace mogltk { - class Sprite : public Base { - public: - Sprite(Handle *, int, int) throw (GeneralException); - Sprite(Uint8 *, int, int); - virtual ~Sprite(); - virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0); - int GetSX(); - int GetSY(); - static Sprite * Cursor; - protected: - void Bind(); - int GetPX(); - int GetPY(); - private: - class TexList : public Base { - public: - TexList(int); - virtual ~TexList(); - Sprite * sprheader; - const texture * GetTex() const; - texture * GetTex(); - static const TexList * GetHead(); - const TexList * GetNext() const; - TexList * GetNext(); - void Bind() const; - SDL_Surface * GetSurface(); - private: - texture * tex; - static TexList * header; - TexList * next, * prev; - }; - Sprite * next, * prev; - TexList * tlist; - int sx, sy, posx, posy; - void alloc(); - bool canfit(int, int, int, int) const; - bool intersect(int, int, int, int) const; - }; - -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: sprite.h,v 1.13 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __SPRITE_H__ +#define __SPRITE_H__ + +#include +#include +#include +#include +#include + +namespace mogltk { + class Sprite : public Base { + public: + Sprite(Handle *, int, int) throw (GeneralException); + Sprite(Uint8 *, int, int); + virtual ~Sprite(); + virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0); + int GetSX(); + int GetSY(); + static Sprite * Cursor; + protected: + void Bind(); + int GetPX(); + int GetPY(); + private: + class TexList : public Base { + public: + TexList(int); + virtual ~TexList(); + Sprite * sprheader; + const texture * GetTex() const; + texture * GetTex(); + static const TexList * GetHead(); + const TexList * GetNext() const; + TexList * GetNext(); + void Bind() const; + SDL_Surface * GetSurface(); + private: + texture * tex; + static TexList * header; + TexList * next, * prev; + }; + Sprite * next, * prev; + TexList * tlist; + int sx, sy, posx, posy; + void alloc(); + bool canfit(int, int, int, int) const; + bool intersect(int, int, int, int) const; + }; + +}; + +#endif diff --git a/include/texture.h b/include/texture.h index ceaacd1..3143b02 100644 --- a/include/texture.h +++ b/include/texture.h @@ -1,63 +1,63 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: texture.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */ - -#ifndef __TEXTURE_H__ -#define __TEXTURE_H__ - -#include -#include -#include -#include -#include - -namespace mogltk { - class texture : public Base { - public: - texture(int, int, bool = false) throw (GeneralException); - texture(Handle *, bool = false) throw (GeneralException); - texture(int, int, int, int); - virtual ~texture(); - SDL_Surface * GetSurface(); - Uint32 * GetPixels(); - SDL_PixelFormat * GetFormat(); - static SDL_Surface * LoadNTEX(Handle * h) throw (GeneralException) ; - void Generate(); - void Bind(bool = true); - GLuint GetWidth(); - GLuint GetHeight(); - static void Unbind(void); - void Taint(void); - static void Taintall(void); - void DumpBMP(const String &); - private: - GLuint width, height, tex; - bool texture_allocated; - SDL_Surface * surface; - bool planar, tainted, taintable; - static texture * header; - static texture * footer; - texture * next, * prev; - static texture * active; - void recTaint(void); - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * 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 $ */ + +#ifndef __TEXTURE_H__ +#define __TEXTURE_H__ + +#include +#include +#include +#include +#include + +namespace mogltk { + class texture : public Base { + public: + texture(int, int, bool = false) throw (GeneralException); + texture(Handle *, bool = false) throw (GeneralException); + texture(int, int, int, int); + virtual ~texture(); + SDL_Surface * GetSurface(); + Uint32 * GetPixels(); + SDL_PixelFormat * GetFormat(); + static SDL_Surface * LoadNTEX(Handle * h) throw (GeneralException) ; + void Generate(); + void Bind(bool = true); + GLuint GetWidth(); + GLuint GetHeight(); + static void Unbind(void); + void Taint(void); + static void Taintall(void); + void DumpBMP(const String &); + private: + GLuint width, height, tex; + bool texture_allocated; + SDL_Surface * surface; + bool planar, tainted, taintable; + static texture * header; + static texture * footer; + texture * next, * prev; + static texture * active; + void recTaint(void); + }; +}; + +#endif diff --git a/include/widgets.h b/include/widgets.h index 600bcec..6469ea7 100644 --- a/include/widgets.h +++ b/include/widgets.h @@ -1,271 +1,271 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: widgets.h,v 1.7 2004-10-19 01:27:29 pixel Exp $ */ - -#ifndef __WIDGETS_H__ -#define __WIDGETS_H__ - -#include -#include -#include - -namespace mogltk { - enum event_t { - E_TIMER, - E_MOUSE_START_DRAG, - E_MOUSE_DRAG, - E_MOUSE_DRAG_OVER, - E_MOUSE_END_DRAG, - E_MOUSE_END_DRAG_OVER, - E_MOUSE_MOVE, - E_MOUSE_OUT, - E_MOUSE_DOWN, - E_MOUSE_UP, - E_MOUSE_CLICK, - E_MOUSE_OUT_CLICK, - E_MOUSE_DBL_CLICK, - }; - class widget : public Base { - public: - virtual ~widget(); - virtual void move(int x, int y); - virtual void resize(int sx, int sy); - int GetX(); - int GetY(); - int GetH(); - int GetW(); - int GetAX(); - int GetAY(); - int GetAX2(); - int GetAY2(); - virtual mogltk::rect GetDrawRect(); - widget * Father(); - widget * Child(); - widget * Next(); - widget * Prev(); - widget * InnerPanel(); - virtual widget * find_widget(int x, int y); - void fulldraw(); - shape * Shaper(); - void mainloop(); - void m_event(int x, int y, event_t event); - bool inside(int x, int y); - bool GetVisible(); - virtual void SetVisible(bool); - bool GetEnabled(); - virtual void SetEnabled(bool); - void MoveOnTop(); - static void check_timed_events(); - protected: - widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *); - virtual void draw(); - virtual bool process_event(int x, int y, event_t event); - virtual void resize_notify(); - virtual widget * create_panel(); - void set_exclusive(widget *); - void unset_exclusive(widget *); - void add_out_move(); - void remove_out_move(); - void add_out_click(); - void remove_out_click(); - void set_timed_event(Uint32); - void set_absolute_timed_event(Uint32); - String caption; - private: - int x, y, sx, sy, ax, ay, ax2, ay2; - widget * father, * next, * prev, * child, * last, * root, * panel; - static widget * focused; - int type; - String name; - shape * sh; - widget * exclusive; - bool visible; - bool enabled; - class timed_event { - public: - timed_event(widget * _w, Uint32 _t) : w(_w), t(_t) { } - widget * w; - Uint32 t; - }; - static std::vector timed_events; - - void computeabs(); - void idraw(); - bool ievent(int x, int y, event_t event); - void icomputeabs(); - void iresize_notify(); - }; - - namespace widgets { - class drawer : public Base { - public: - virtual void draw(widget *) = 0; - }; - - class action : public Base { - public: - virtual void do_action(widget *) = 0; - }; - - class Root : public widget { - public: - Root(shape *, drawer * = 0); - void setdrawer(drawer *); - protected: - virtual void draw(); - drawer * dr; - }; - - class Panel : public widget { - public: - Panel(shape *, widget * father, int x, int y, int w, int h); - }; - - class Button : public widget { - public: - Button(action *, shape *, widget * father, int x, int y, int w, int h, const String & caption); - protected: - virtual void draw(); - virtual bool process_event(int, int, event_t); - bool bevel; - private: - bool dragging; - action * a; - }; - - class Label : public widget { - public: - Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK); - protected: - virtual void draw(); - private: - ColorP color; - }; - - class SmartBox : public widget { - public: - SmartBox(shape *, widget * father, int x, int y, int w, int h, const String & caption); - virtual rect GetDrawRect(); - protected: - virtual void draw(); - virtual bool process_event(int, int, event_t); - private: - int ox, oy, oax, oay; - }; - - class MsgBox : public SmartBox { - public: - MsgBox(shape *, widget * father, const String & caption, const String & text); - virtual ~MsgBox(); - }; - - class Frame : public widget { - public: - Frame(shape *, widget * father, int x, int y, int w, int h); - virtual rect GetDrawRect(); - protected: - virtual void draw(); - }; - - class ContextMenu : public widget { - public: - ContextMenu(shape *, widget * father, int x, int y); - virtual ~ContextMenu(); - void addnode(const String &, action *); - void addline(); - void addsub(const String &, ContextMenu *); - ContextMenu * createsub(const String &); - virtual void move(int x, int y); - virtual void resize(int w, int h); - virtual void SetVisible(bool); - virtual void SetEnabled(int i, bool); - void StickyDisplay(); - protected: - virtual void draw(); - virtual bool process_event(int x, int y, event_t event); - class node : public Base { - public: - node(const String &, int x, int y, int w, int h, action * = 0, ContextMenu * sub = 0, ContextMenu * father = 0, bool = false); - String GetCaption(); - action * GetAction(); - ContextMenu * GetSub(); - ContextMenu * GetFather(); - bool GetLine(); - bool GetEnabled(); - void SetEnabled(bool); - int GetX(); - int GetY(); - int GetW(); - int GetH(); - private: - String caption; - int x, y, w, h; - action * a; - ContextMenu * sub, * father; - bool line, enabled; - }; - - std::vector nodes; - int selected; - ContextMenu * subselected; - private: - bool in_click, sticky; - - bool iin_click(); - }; - - class Menu : public widget { - public: - Menu(shape *, widget * father); - void addnode(const String &, action *); - void addsub(const String &, ContextMenu * sub); - ContextMenu * createsub(const String &); - virtual void SetEnabled(int i, bool); - void SetCaption(int i, const String &); - protected: - virtual void resize_notify(); - virtual void draw(); - virtual bool process_event(int, int, event_t); - class node : public Base { - public: - node(const String & caption, ContextMenu * sub, action * a, int x); - String GetCaption(); - void SetCaption(const String &); - ContextMenu * GetSub(); - action * GetAction(); - int GetX(); - bool GetEnabled(); - void SetEnabled(bool); - private: - String caption; - ContextMenu * sub; - action * a; - int x; - bool enabled; - }; - private: - std::vector nodes; - int cur_x; - int selected; - }; - }; -}; - -#endif +/* + * mogltk + * Copyright (C) 1999-2004 Nicolas "Pixel" Noble + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id: widgets.h,v 1.8 2004-11-27 21:48:01 pixel Exp $ */ + +#ifndef __WIDGETS_H__ +#define __WIDGETS_H__ + +#include +#include +#include + +namespace mogltk { + enum event_t { + E_TIMER, + E_MOUSE_START_DRAG, + E_MOUSE_DRAG, + E_MOUSE_DRAG_OVER, + E_MOUSE_END_DRAG, + E_MOUSE_END_DRAG_OVER, + E_MOUSE_MOVE, + E_MOUSE_OUT, + E_MOUSE_DOWN, + E_MOUSE_UP, + E_MOUSE_CLICK, + E_MOUSE_OUT_CLICK, + E_MOUSE_DBL_CLICK, + }; + class widget : public Base { + public: + virtual ~widget(); + virtual void move(int x, int y); + virtual void resize(int sx, int sy); + int GetX(); + int GetY(); + int GetH(); + int GetW(); + int GetAX(); + int GetAY(); + int GetAX2(); + int GetAY2(); + virtual mogltk::rect GetDrawRect(); + widget * Father(); + widget * Child(); + widget * Next(); + widget * Prev(); + widget * InnerPanel(); + virtual widget * find_widget(int x, int y); + void fulldraw(); + shape * Shaper(); + void mainloop(); + void m_event(int x, int y, event_t event); + bool inside(int x, int y); + bool GetVisible(); + virtual void SetVisible(bool); + bool GetEnabled(); + virtual void SetEnabled(bool); + void MoveOnTop(); + static void check_timed_events(); + protected: + widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *); + virtual void draw(); + virtual bool process_event(int x, int y, event_t event); + virtual void resize_notify(); + virtual widget * create_panel(); + void set_exclusive(widget *); + void unset_exclusive(widget *); + void add_out_move(); + void remove_out_move(); + void add_out_click(); + void remove_out_click(); + void set_timed_event(Uint32); + void set_absolute_timed_event(Uint32); + String caption; + private: + int x, y, sx, sy, ax, ay, ax2, ay2; + widget * father, * next, * prev, * child, * last, * root, * panel; + static widget * focused; + int type; + String name; + shape * sh; + widget * exclusive; + bool visible; + bool enabled; + class timed_event { + public: + timed_event(widget * _w, Uint32 _t) : w(_w), t(_t) { } + widget * w; + Uint32 t; + }; + static std::vector timed_events; + + void computeabs(); + void idraw(); + bool ievent(int x, int y, event_t event); + void icomputeabs(); + void iresize_notify(); + }; + + namespace widgets { + class drawer : public Base { + public: + virtual void draw(widget *) = 0; + }; + + class action : public Base { + public: + virtual void do_action(widget *) = 0; + }; + + class Root : public widget { + public: + Root(shape *, drawer * = 0); + void setdrawer(drawer *); + protected: + virtual void draw(); + drawer * dr; + }; + + class Panel : public widget { + public: + Panel(shape *, widget * father, int x, int y, int w, int h); + }; + + class Button : public widget { + public: + Button(action *, shape *, widget * father, int x, int y, int w, int h, const String & caption); + protected: + virtual void draw(); + virtual bool process_event(int, int, event_t); + bool bevel; + private: + bool dragging; + action * a; + }; + + class Label : public widget { + public: + Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK); + protected: + virtual void draw(); + private: + ColorP color; + }; + + class SmartBox : public widget { + public: + SmartBox(shape *, widget * father, int x, int y, int w, int h, const String & caption); + virtual rect GetDrawRect(); + protected: + virtual void draw(); + virtual bool process_event(int, int, event_t); + private: + int ox, oy, oax, oay; + }; + + class MsgBox : public SmartBox { + public: + MsgBox(shape *, widget * father, const String & caption, const String & text); + virtual ~MsgBox(); + }; + + class Frame : public widget { + public: + Frame(shape *, widget * father, int x, int y, int w, int h); + virtual rect GetDrawRect(); + protected: + virtual void draw(); + }; + + class ContextMenu : public widget { + public: + ContextMenu(shape *, widget * father, int x, int y); + virtual ~ContextMenu(); + void addnode(const String &, action *); + void addline(); + void addsub(const String &, ContextMenu *); + ContextMenu * createsub(const String &); + virtual void move(int x, int y); + virtual void resize(int w, int h); + virtual void SetVisible(bool); + virtual void SetEnabled(int i, bool); + void StickyDisplay(); + protected: + virtual void draw(); + virtual bool process_event(int x, int y, event_t event); + class node : public Base { + public: + node(const String &, int x, int y, int w, int h, action * = 0, ContextMenu * sub = 0, ContextMenu * father = 0, bool = false); + String GetCaption(); + action * GetAction(); + ContextMenu * GetSub(); + ContextMenu * GetFather(); + bool GetLine(); + bool GetEnabled(); + void SetEnabled(bool); + int GetX(); + int GetY(); + int GetW(); + int GetH(); + private: + String caption; + int x, y, w, h; + action * a; + ContextMenu * sub, * father; + bool line, enabled; + }; + + std::vector nodes; + int selected; + ContextMenu * subselected; + private: + bool in_click, sticky; + + bool iin_click(); + }; + + class Menu : public widget { + public: + Menu(shape *, widget * father); + void addnode(const String &, action *); + void addsub(const String &, ContextMenu * sub); + ContextMenu * createsub(const String &); + virtual void SetEnabled(int i, bool); + void SetCaption(int i, const String &); + protected: + virtual void resize_notify(); + virtual void draw(); + virtual bool process_event(int, int, event_t); + class node : public Base { + public: + node(const String & caption, ContextMenu * sub, action * a, int x); + String GetCaption(); + void SetCaption(const String &); + ContextMenu * GetSub(); + action * GetAction(); + int GetX(); + bool GetEnabled(); + void SetEnabled(bool); + private: + String caption; + ContextMenu * sub; + action * a; + int x; + bool enabled; + }; + private: + std::vector nodes; + int cur_x; + int selected; + }; + }; +}; + +#endif -- cgit v1.2.3