00001
00026 #ifndef INC_MGUI_FORMFILELIST_H
00027 #define INC_MGUI_FORMFILELIST_H
00028
00029 #ifndef INC_MGUI_LISTBOX_H
00030 #include <mgui/listbox.h>
00031 #endif
00032
00033 #ifndef INC_MI32_FILEPATHLIST_H
00034 #include <mi32/filepathlist.h>
00035 #endif
00036
00037 #ifndef INC_MI32_STRUTF8_H
00038 #include <mi32/strutf8.h>
00039 #endif
00040
00041 namespace MGUI {
00042
00043
00045 class FORM_FILE_LIST : public MGUI::FORM_COMPOSITE {
00046 public:
00047 enum FLAGS {
00048 FLAG_Default = 0x0000,
00049 FLAG_SelectFolders = 0x0001,
00050 };
00051
00053 FORM_FILE_LIST (
00054 );
00055
00057 virtual ~FORM_FILE_LIST (
00058 );
00059
00061 void Clear (
00062 bool notify
00063 );
00064
00066 ERRVALUE Create (
00067 MGUI::LAYOUT_PANE_BASE& ParentPane,
00068 const MISTRING& promptstr,
00069 int ListHeight = 5,
00070 MGUI::LAYOUT_SIZEALIGN sizealign = MGUI::LAYOUT_SIZEALIGN_Expand,
00071 FLAGS flags = FLAG_Default
00072 );
00073
00075 const FILEPATH& GetCurrentFile (
00076 ) const;
00077
00079 const FILEPATHLIST& GetFileList (
00080 ) const { return (m_FilePathList); }
00081
00083 bool IsEmpty (
00084 ) const { return (m_FilePathList.IsEmpty()); }
00085
00088 ERRVALUE Select (
00089 bool notify
00090 );
00091
00093 ERRVALUE SetValue (
00094 const FILEPATHLIST& PathList,
00095 bool notify
00096 );
00097
00099 void SetDelegateOnListChanged (
00100 DELEGATE_VOID_NOPARMS delegate
00101 ) { m_DelegateOnListChanged = delegate; }
00102
00104 void SetDelegateOnFileAdded (
00105 FastDelegate<void(const FILEPATH&, INT32)> delegate
00106 ) { m_DelegateOnFileAdded = delegate; }
00107
00109 void SetDelegateOnFileRemoved (
00110 FastDelegate<void(INT32)> delegate
00111 ) { m_DelegateOnFileRemoved = delegate; }
00112
00114 void SetDelegateOnFileSelected (
00115 FastDelegate<void(const FILEPATH&, INT32)> delegate
00116 ) { m_DelegateOnFileSelected = delegate; }
00117
00119 void SetDelegateOnFilesAdded (
00120 DELEGATE_VOID_NOPARMS delegate
00121 ) { m_DelegateOnFilesAdded = delegate; }
00122
00124 void SetDelegateOnFilesAllRemoved (
00125 DELEGATE_VOID_NOPARMS delegate
00126 ) { m_DelegateOnFilesAllRemoved = delegate; }
00127
00131 void SetValidExtensions (
00132 const char* extns
00133 );
00134
00135 protected:
00136
00140 virtual void v_OnListChanged ();
00141
00145 virtual void v_OnFileAdded (const FILEPATH& Filepath, INT32 ItemNum);
00146
00150 virtual void v_OnFileRemoved (INT32 ItemNum);
00151
00155 virtual void v_OnFileSelected (const FILEPATH& Filepath, INT32 ItemNum);
00156
00160 virtual void v_OnFilesAdded ();
00161
00165 virtual void v_OnFilesAllRemoved ();
00166
00167 private:
00168 #ifndef GENERATING_DOXYGEN_OUTPUT
00169 FLAGS m_flags;
00170 static FILEPATH *s_pNullItem;
00171 DELEGATE_VOID_NOPARMS m_DelegateOnListChanged;
00172 FastDelegate<void(const FILEPATH&, INT32)> m_DelegateOnFileAdded;
00173 FastDelegate<void(INT32)> m_DelegateOnFileRemoved;
00174 FastDelegate<void(const FILEPATH&, INT32)> m_DelegateOnFileSelected;
00175 DELEGATE_VOID_NOPARMS m_DelegateOnFilesAdded;
00176 DELEGATE_VOID_NOPARMS m_DelegateOnFilesAllRemoved;
00177 MGUI::CTRL_LISTBOX m_ListBox;
00178 MGUI::CTRL_PUSHBUTTON m_BtnSelect;
00179 MGUI::CTRL_PUSHBUTTON m_BtnRemove;
00180 MGUI::CTRL_PUSHBUTTON m_BtnRemoveAll;
00181 FILEPATHLIST m_FilePathList;
00182 MISTRING m_PromptStr;
00183 STRUTF8 m_Extns;
00184
00185 void OnListSelection ();
00186 void OnBtnRemove ();
00187 void OnBtnRemoveAll ();
00188 void OnBtnSelect ();
00189
00190 FORM_FILE_LIST (const FORM_FILE_LIST&);
00191 FORM_FILE_LIST& operator= (const FORM_FILE_LIST&);
00192 #endif // GENERATING_DOXYGEN_OUTPUT
00193 };
00194
00195 }
00196
00197 #endif //INC_MGUI_FORMFILELIST_H