guifilelist.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 GUIFILELIST_H
00023 #define GUIFILELIST_H
00024 
00025 #include "guilist.h"
00026 #include <vector>
00027 #include <string>
00028 #ifndef MAX_PATH
00029 #define MAX_PATH    256
00030 #endif
00031 
00043 class DECLSPEC GuiFileList : public GuiList
00044 {
00045 public:
00046     struct FIND_DATA
00047     {
00048         Uint32 ulType;
00049         char chFileName[MAX_PATH];
00050     };
00051     DECLSPEC GuiFileList(const SDL_Rect &r, GuiElement * el, const char *name);
00060     DECLSPEC GuiFileList(TiXmlElement *el, GuiElement *p);
00061     virtual DECLSPEC ~GuiFileList();
00062 
00063     virtual const char *getClassName()  { return "GuiFileList"; }
00064     
00065     DECLSPEC char * getFilename(unsigned int i) const;
00066     DECLSPEC char * getSelFilename() const;
00067     DECLSPEC FIND_DATA getAttribute(unsigned int i) const;
00068     DECLSPEC FIND_DATA getSelAttr() const;
00069 
00070     DECLSPEC void setFiletypes( bool files, bool dirs, bool others = false );
00076     DECLSPEC void setPath(const char * path);
00077     DECLSPEC void setSeekstr(const char * str);
00078     DECLSPEC void hideExtension(bool hide = true);
00079 
00080     DECLSPEC void refresh();
00081 
00082     static void newguiobject(void *presult, BasicObject *o, void *xmldata)
00083     {
00084         GuiElement *r = new GuiFileList((TiXmlElement*)xmldata, (GuiElement*)o);
00085         *(GuiElement**)presult = r;
00086     }
00087 
00088 protected:
00089     virtual DECLSPEC void onInit();
00090 
00091 private:
00092     Uint32 showtypes;
00093     bool hideext;
00094     char * seekstr;
00095     // the absolute path to the shown folder
00096     std::string strPath;
00097     typedef vector<FIND_DATA> attrlist;
00098     attrlist attributes;
00099 };
00100 
00101 #endif

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