guicombination.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 1999, 2000, 2005 by Tobias Nadler und Georg Schnattinger      */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
00019 /*                                                                              */
00020 /********************************************************************************/
00021 
00022 #ifndef GUICOMBINATION_H
00023 #define GUICOMBINATION_H
00024 
00025 #include "guitext.h"
00026 #include "guidynamicbutton.h"
00027 #include "guibackground.h"
00028 #include "guiscroller.h"
00029 
00042 class DECLSPEC GuiCheck : public GuiElement
00043 {
00044 public:
00052     DECLSPEC GuiCheck( const SDL_Rect &r, GuiElement *p, const char *name, const char *t = NULL );
00059     DECLSPEC GuiCheck(TiXmlElement *el, GuiElement *p);
00060     virtual DECLSPEC ~GuiCheck();
00061 
00062     virtual const char *getClassName()  { return "GuiCheck"; }
00063 
00065     GuiCheckableBtn *check;
00067     GuiText *text;
00068 
00069     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00070     {
00071         GuiElement *r = new GuiCheck((TiXmlElement*)xmldata, (GuiElement*)o);
00072         *(GuiElement**)presult = r;
00073     }
00074 protected:
00075     virtual DECLSPEC Uint32 onResize();
00076     virtual DECLSPEC void onInit();
00077 private:
00078     void arrange();
00079 };
00080 
00087 class DECLSPEC GuiRadio : public GuiElement
00088 {
00089 public:
00097     DECLSPEC GuiRadio(const SDL_Rect &r, GuiRadioContainer *p, const char *name, const char *t = NULL);
00104     DECLSPEC GuiRadio(TiXmlElement *el, GuiRadioContainer *p);
00105     virtual DECLSPEC ~GuiRadio();
00106     
00107     virtual const char *getClassName()  { return "GuiRadio"; }
00112     DECLSPEC void destroy();
00113 
00114     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00115     {
00116         GuiElement *r;
00117         if(strcmp(o->getClassName(), "GuiRadioContainer") == 0)
00118             r = new GuiRadio((TiXmlElement*)xmldata, (GuiRadioContainer*)o);
00119         else    {
00120             BasicApp::the->logLine("Error: GuiRadio::newguiobject(): parent element's class must be GuiRadioContainer!");
00121             r = NULL;
00122         }
00123         *(GuiElement**)presult = r;
00124     }
00125 
00126 protected:
00127     virtual DECLSPEC Uint32 onResize();
00128     virtual DECLSPEC void onInit();
00129 private:
00130     void arrange();
00131     GuiRadioBtn *radio;
00132     GuiText *text;
00133 };
00134 
00141 class DECLSPEC GuiNumScroller : public GuiElement
00142 {
00143 public:
00150     DECLSPEC GuiNumScroller(const SDL_Rect &r, GuiElement *p, const char *name);
00157     DECLSPEC GuiNumScroller(TiXmlElement *el, GuiElement *p);
00158     virtual DECLSPEC ~GuiNumScroller();
00159 
00160     virtual const char *getClassName()  { return "GuiNumScroller"; }
00162     GuiScroller *scroller;
00164     GuiText *text;
00165 
00167     DECLSPEC void updatetext();
00168 
00169     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00170     {
00171         GuiElement *r = new GuiNumScroller((TiXmlElement*)xmldata, (GuiElement*)o);
00172         *(GuiElement**)presult = r;
00173     }
00174 protected:
00175     virtual DECLSPEC Uint32 onResize();
00176     virtual DECLSPEC void onInit();
00177 private:
00178     void arrange(); 
00179     void onChange();
00180 
00181     static inline void onChange(void*, BasicObject * data, void*)
00182     {
00183         ((GuiNumScroller*)data)->onChange();
00184     }
00185 };
00186 
00187 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1