00001 #ifndef _FILE_REQUESTER_H_ 00002 #define _FILE_REQUESTER_H_ 00003 00004 #include "amigawindow.h" 00005 #include "listdata.h" 00006 #include "filelistboxdataitem.h" 00007 #include "filelistbox.h" 00008 #include "gadgetstyle.h" 00009 00010 namespace WoopsiUI { 00011 00012 class Button; 00013 class FilePath; 00014 00035 class FileRequester : public AmigaWindow { 00036 public: 00037 00049 FileRequester(s16 x, s16 y, u16 width, u16 height, const WoopsiString& title, const WoopsiString& path, u32 flags, GadgetStyle* style = NULL); 00050 00055 virtual void handleReleaseEvent(const GadgetEventArgs& e); 00056 00061 virtual void handleValueChangeEvent(const GadgetEventArgs& e); 00062 00068 virtual inline void addOption(const char* text, const u32 value) { 00069 _listbox->addOption(text, value); 00070 }; 00071 00081 virtual inline void addOption(const char* text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) { 00082 _listbox->addOption(text, value, normalTextColour, normalBackColour, selectedTextColour, selectedBackColour); 00083 }; 00084 00089 virtual inline void removeOption(const s32 index) { 00090 _listbox->removeOption(index); 00091 }; 00092 00096 virtual inline void removeAllOptions() { 00097 _listbox->removeAllOptions(); 00098 }; 00099 00105 virtual inline const s32 getSelectedIndex() const { 00106 return _listbox->getSelectedIndex(); 00107 }; 00108 00113 virtual inline const FileListBoxDataItem* getSelectedOption() const { 00114 return _listbox->getSelectedOption(); 00115 }; 00116 00122 virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) { 00123 _listbox->setAllowMultipleSelections(allowMultipleSelections); 00124 }; 00125 00130 virtual inline const FileListBoxDataItem* getOption(const s32 index) const { 00131 return _listbox->getOption(index); 00132 }; 00133 00137 virtual inline void sort() { 00138 _listbox->sort(); 00139 }; 00140 00145 virtual inline const s32 getOptionCount() const { 00146 return _listbox->getOptionCount(); 00147 }; 00148 00153 virtual void setPath(const char* path); 00154 00159 virtual void appendPath(const char* path); 00160 00161 protected: 00162 Button* _okButton; 00163 Button* _cancelButton; 00164 FileListBox* _listbox; 00171 virtual void onResize(u16 width, u16 height); 00172 00176 virtual ~FileRequester() { }; 00177 00181 inline FileRequester(const FileRequester& fileRequester) : AmigaWindow(fileRequester) { }; 00182 }; 00183 } 00184 00185 #endif