guidropdown.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 GUIDROPDOWN_H
00023 #define GUIDROPDOWN_H
00024 
00025 #include "guilist.h"
00026 
00033 class GuiList;
00034 class GuiText;
00035 class GuiTextInput;
00036 class GuiClickableBtn;
00037 class UiTheme;
00038 
00045 class DECLSPEC GuiDropDown : public GuiElement
00046 {
00047 public:
00055     DECLSPEC GuiDropDown( const SDL_Rect &r, GuiElement *p, const char *name, bool editable = false );
00062     DECLSPEC GuiDropDown(TiXmlElement *el, GuiElement *p);
00063     virtual DECLSPEC ~GuiDropDown();
00064 
00065     virtual const char *getClassName()  { return "GuiDropDown"; }
00069     DECLSPEC void destroy();
00075     void setCallback( Callback c, BasicObject *d )  { cb.func = c; cb.obj = d; }
00076 
00082     int insertStr( const char* str, int pos = -1 )  { return gList->insertStr( str, pos ); }
00088     bool clearStr( int pos = -1 )   { return gList->clearStr( pos ); }
00092     void clearAll() { gList->clearAll(); }
00099     bool changeStr( const char *newstr, int pos )   { return gList->changeStr( newstr, pos ); }
00104     const char *getStr( int pos ) const { return gList->getStr( pos ); }
00108     const char *getSelStr() const   { return gList->getSelStr(); }
00112     const char *getString() const;
00116     int getSelId() const    { gList->getSelId(); }
00120     int getCount() const    { gList->getCount(); }
00121     
00126     void setSelected(int i) { gList->setSelected( i );}
00127 
00128     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00129     {
00130         GuiElement *r = new GuiDropDown((TiXmlElement*)xmldata, (GuiElement*)o);
00131         *(GuiElement**)presult = r;
00132     }
00133 protected:
00134     virtual DECLSPEC Uint32 onResize();
00135     virtual DECLSPEC void onInit();
00136     virtual DECLSPEC Uint32 onThemeChanged( UiTheme *t );
00137 
00138 private:
00139     void onButton();
00140     void onList();
00141 
00142     GuiList *gList;
00143     GuiText *gText;
00144     GuiTextInput *gtInput;
00145     GuiCheckableBtn *gcButton;
00146     GuiPictureBg *gpBg;
00147 
00148     FunctionData cb;
00149 
00150     static void onButton( void *sender, BasicObject *data, void* )
00151     {
00152         ((GuiDropDown*)data)->onButton();
00153     }
00154     static void onList( void *sender, BasicObject *data, void* )
00155     {
00156         ((GuiDropDown*)data)->onList();
00157     }
00158 };
00159 
00160 #endif

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