guilistbox.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 GUILISTBOX_H
00023 #define GUILISTBOX_H
00024 
00025 #include "guilist.h"
00026 
00033 class GuiList;
00034 class GuiText;
00035 class GuiTextInput;
00036 class GuiClickableBtn;
00037 
00043 class DECLSPEC GuiListBox : public GuiElement
00044 {
00045 public:
00046     DECLSPEC GuiListBox( const SDL_Rect &r, GuiElement *p, const char *name, bool editable = false );
00053     DECLSPEC GuiListBox(TiXmlElement *el, GuiElement *p);
00054     virtual DECLSPEC ~GuiListBox();
00055 
00056     virtual const char *getClassName()  { return "GuiListBox"; }
00057     
00058     DECLSPEC void destroy();
00059 //  void setCallback( Callback c, BasicObject *d )  { cb.func = c; cb.obj = d; }
00060 
00061     int insertStr( const char* str, int pos = -1 )  { return gList->insertStr( str, pos ); }
00062     bool clearStr( int pos = -1 )   { return gList->clearStr( pos ); }
00063     void clearAll() { gList->clearAll(); }
00064     bool changeStr( const char *newstr, int pos )   { return gList->changeStr( newstr, pos ); }
00065     const char *getStr( int pos ) const { return gList->getStr( pos ); }
00066     const char *getSelStr() const   { return gList->getSelStr(); }
00067     int getSelId() const    { gList->getSelId(); }
00068     int getCount() const    { gList->getCount(); }
00069     
00070     void setSelected(int i) { gList->setSelected( i );}
00071     
00072     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00073     {
00074         GuiElement *r = new GuiListBox((TiXmlElement*)xmldata, (GuiElement*)o);
00075         *(GuiElement**)presult = r;
00076     }
00077 protected:
00078     virtual DECLSPEC void onInit();
00079     
00080 private:
00081     void onButton();
00082     void onList();
00083 
00084     GuiList *gList;
00085     GuiText *gText;
00086     GuiTextInput *gtInput;
00087     GuiClickableBtn *gcButton;
00088 
00089 //  FunctionData cb;
00090 
00091     static void onButton( void *sender, BasicObject *data, void* )
00092     {
00093         ((GuiListBox*)data)->onButton();
00094     }
00095     static void onList( void *sender, BasicObject *data, void* )
00096     {
00097         ((GuiListBox*)data)->onList();
00098     }
00099 };
00100 
00101 #endif

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