Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/filelistbox.h
00001 #ifndef _FILE_LISTBOX_H_
00002 #define _FILE_LISTBOX_H_
00003 
00004 #include "scrollinglistbox.h"
00005 #include "filelistboxdataitem.h"
00006 #include "gadget.h"
00007 #include "gadgeteventhandler.h"
00008 #include "gadgetstyle.h"
00009 #include "woopsistring.h"
00010 
00011 #ifdef ARM9
00012 #include <fat.h>
00013 #endif
00014 
00015 namespace WoopsiUI {
00016 
00017     class FilePath;
00018 
00031     class FileListBox : public Gadget, public GadgetEventHandler  {
00032     public:
00033 
00042         FileListBox(s16 x, s16 y, u16 width, u16 height, GadgetStyle* style = NULL);
00043     
00048         virtual void handleDoubleClickEvent(const GadgetEventArgs& e);
00049         
00054         virtual void handleValueChangeEvent(const GadgetEventArgs& e);
00055 
00061         virtual inline void addOption(const char* text, const u32 value) {
00062             _listbox->addOption(text, value);
00063         };
00064 
00077         virtual inline void addOption(const char* text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) {
00078             _listbox->addOption(text, value, normalTextColour, normalBackColour, selectedTextColour, selectedBackColour);
00079         };
00080 
00085         virtual inline void removeOption(const s32 index) {
00086             _listbox->removeOption(index);
00087         };
00088 
00092         virtual inline void removeAllOptions() {
00093             _listbox->removeAllOptions();
00094         };
00095 
00102         virtual inline const s32 getSelectedIndex() const {
00103             return _listbox->getSelectedIndex();
00104         };
00105 
00110         virtual inline const FileListBoxDataItem* getSelectedOption() const {
00111             return (const FileListBoxDataItem*)_listbox->getSelectedOption();
00112         };
00113 
00118         virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) {
00119             _listbox->setAllowMultipleSelections(allowMultipleSelections);
00120         };
00121 
00126         virtual inline const FileListBoxDataItem* getOption(const s32 index) const {
00127             return (const FileListBoxDataItem*)_listbox->getOption(index);
00128         };
00129 
00133         virtual inline void sort() {
00134             _listbox->sort();
00135         };
00136 
00141         virtual inline const s32 getOptionCount() const {
00142             return _listbox->getOptionCount();
00143         };
00144 
00149         virtual void setPath(const WoopsiString& path);
00150 
00155         virtual void appendPath(const WoopsiString& path);
00156 
00160         virtual const FilePath* getPath() const;
00161 
00162     protected:
00163         ScrollingListBox* _listbox;         
00164         FilePath* _path;                    
00172         virtual void drawContents(GraphicsPort* port);
00173 
00179         virtual void onResize(u16 width, u16 height);
00180         
00184         virtual ~FileListBox();
00185 
00189         virtual void readDirectory();
00190         
00194         inline FileListBox(const FileListBox& fileListBox) : Gadget(fileListBox) { };
00195     };
00196 }
00197 
00198 #endif
 All Classes Functions Variables Enumerations Enumerator