00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
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