- Main Page
- Classes
- Files

- File List

# 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
    00043                 FileListBox(s16 x, s16 y, u16 width, u16 height, u32 flags, GadgetStyle* style = NULL);
    00044
    00049                 virtual void handleDoubleClickEvent(const GadgetEventArgs& e);
    00050
    00056                 virtual inline void addOption(const char* text, const u32 value) {
    00057                         _listbox->addOption(text, value);
    00058                 };
    00059
    00072                 virtual inline void addOption(const char* text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) {
    00073                         _listbox->addOption(text, value, normalTextColour, normalBackColour, selectedTextColour, selectedBackColour);
    00074                 };
    00075
    00080                 virtual inline void removeOption(const s32 index) {
    00081                         _listbox->removeOption(index);
    00082                 };
    00083
    00087                 virtual inline void removeAllOptions() {
    00088                         _listbox->removeAllOptions();
    00089                 };
    00090
    00096                 virtual inline const s32 getSelectedIndex() const {
    00097                         return _listbox->getSelectedIndex();
    00098                 };
    00099
    00104                 virtual inline const FileListBoxDataItem* getSelectedOption() const {
    00105                         return (const FileListBoxDataItem*)_listbox->getSelectedOption();
    00106                 };
    00107
    00112                 virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) {
    00113                         _listbox->setAllowMultipleSelections(allowMultipleSelections);
    00114                 };
    00115
    00120                 virtual inline const FileListBoxDataItem* getOption(const s32 index) const {
    00121                         return (const FileListBoxDataItem*)_listbox->getOption(index);
    00122                 };
    00123
    00127                 virtual inline void sort() {
    00128                         _listbox->sort();
    00129                 };
    00130
    00135                 virtual inline const s32 getOptionCount() const {
    00136                         return _listbox->getOptionCount();
    00137                 };
    00138
    00143                 virtual void setPath(const WoopsiString& path);
    00144
    00149                 virtual void appendPath(const WoopsiString& path);
    00150
    00151         protected:
    00152                 ScrollingListBox* _listbox;
    00153                 FilePath* _path;
    00161                 virtual void drawContents(GraphicsPort* port);
    00162
    00168                 virtual void onResize(u16 width, u16 height);
    00169
    00173                 virtual ~FileListBox();
    00174
    00178                 virtual void readDirectory();
    00179
    00183                 inline FileListBox(const FileListBox& fileListBox) : Gadget(fileListBox) { };
    00184         };
    00185 }
    00186
    00187 #endif