00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _AX_MENU_FOLDER_H_
00013 #define _AX_MENU_FOLDER_H_
00014
00015 class AxFolderMenuItem;
00016
00017
00018
00019
00020
00021 #include "ax/ax_menu.h"
00022 #include "ax/ax_menu_modal.h"
00023 #include "ax/ax_activator.h"
00024 #include "ax/ax_validator.h"
00025
00026
00027
00028
00029
00030 #define axFOLDER_MENU_STYLE_FILE_SELECTOR 0x0001
00031 #define axFOLDER_MENU_STYLE_SHOW_HIDDEN_FILES 0x0002
00032 #define axFOLDER_MENU_STYLE_NEW_FOLDER 0x0004
00033
00043 class AxModalFolderMenu: public AxModalMenu
00044 {
00045 DECLARE_CLASS( AxModalFolderMenu )
00046
00047 public:
00048
00049
00050 AxModalFolderMenu() { Init(); }
00051
00052 AxModalFolderMenu(AxMenuController* controller, AxMenuItem* item,
00053 const wxString& menuLabel,
00054 const wxString& description,
00055 const wxString& defaultPath,
00056 int style = axFOLDER_MENU_STYLE_NEW_FOLDER,
00057 const wxString& filter = wxT("*"));
00058
00059 ~AxModalFolderMenu() {}
00060
00061 void SetPath(const wxString& path) { m_path = path; }
00062 wxString GetPath() const { return m_path; }
00063
00064 AxMenu* CreateSubMenu(const wxString& folder, const wxString& folderName, const wxString& label, const wxString& description);
00065
00066
00067
00068 void Init();
00069
00070 int GetStyle() const { return m_style; }
00071 void SetStyle(int style) { m_style = style; }
00072
00073 bool IsFileSelector() const { return (m_style & axFOLDER_MENU_STYLE_FILE_SELECTOR) != 0; }
00074 bool ShowHiddenFiles() const { return (m_style & axFOLDER_MENU_STYLE_SHOW_HIDDEN_FILES) != 0; }
00075
00076
00077 void SetFilter(const wxString& filter) { m_filter = filter; }
00078 const wxString& GetFilter() const { return m_filter; }
00079
00080 protected:
00081
00082 wxString m_path;
00083 int m_style;
00084 wxString m_filter;
00085 };
00086
00096 class AxFolderMenuActivator: public AxActivator
00097 {
00098 public:
00099
00100 typedef enum
00101 {
00102 AxFolderCommandUnknown,
00103 AxFolderCommandFolder,
00104 AxFolderCommandFile,
00105 AxFolderCommandSelectThis,
00106 AxFolderCommandNewFolder,
00107 AxFolderCommandCancel,
00108
00109 } AxFolderCommand;
00110
00111 DECLARE_DYNAMIC_CLASS( AxFolderMenuActivator )
00112
00113 public:
00114
00115
00116 AxFolderMenuActivator() { Init(); }
00117 AxFolderMenuActivator(AxFolderCommand command, AxModalFolderMenu* menu, const wxString& folderPath = wxEmptyString, const wxString& folderName = wxEmptyString)
00118 { Init(); m_command = command; m_folderMenu = menu; m_folderPath = folderPath; m_folderName = folderName; }
00119 AxFolderMenuActivator(const AxFolderMenuActivator& activator) { Init(); Copy(activator); }
00120
00121
00122
00123 void Init() { m_folderMenu = NULL; }
00124
00125 void Copy(const AxFolderMenuActivator& activator);
00126
00127 virtual AxActivator* Clone() const { return new AxFolderMenuActivator(*this); }
00128
00129 virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00130
00131 AxModalFolderMenu* GetModalFolderMenu() const { return m_folderMenu; }
00132 void SetModalFolderMenu(AxModalFolderMenu* menu) { m_folderMenu = menu; }
00133
00134 void SetFolderPath(const wxString& path) { m_folderPath = path; }
00135 const wxString& GetFolderPath() const { return m_folderPath; }
00136
00137 void SetFolderName(const wxString& name) { m_folderName = name; }
00138 const wxString& GetFolderName() const { return m_folderName; }
00139
00140 AxFolderCommand GetCommand() const { return m_command; }
00141
00142 protected:
00143
00144 AxModalFolderMenu* m_folderMenu;
00145 AxFolderCommand m_command;
00146 wxString m_folderPath;
00147 wxString m_folderName;
00148 };
00149
00160 class AxFolderActivator: public AxAutoUpdateActivator
00161 {
00162 public:
00163
00164 DECLARE_DYNAMIC_CLASS( AxFolderActivator )
00165
00166 public:
00167
00168
00169 AxFolderActivator() { Init(); }
00170 AxFolderActivator(const AxFolderActivator& activator) { Init(); Copy(activator); }
00171 AxFolderActivator(const wxString& itemLabelSpec,
00172 const wxString& itemDescriptionSpec);
00173
00174
00175
00176 void Init() { }
00177
00178 void Copy(const AxFolderActivator& activator);
00179
00180 virtual AxActivator* Clone() const { return new AxFolderActivator(*this); }
00181
00182 virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);
00183
00185 virtual wxString CreateString(const wxString& spec, bool WXUNUSED(isLabel));
00186
00188 AxMenu* FindChildMenu(AxMenuController* controller, const wxString& defaultFolder, AxMenu* menu);
00189
00190 AxFolderMenuItem* GetFolderMenuItem() const;
00191
00192 protected:
00193
00194 };
00195
00203 class AxModalFileMenu: public AxModalFolderMenu
00204 {
00205 DECLARE_CLASS( AxModalFileMenu )
00206
00207 public:
00208
00209
00210 AxModalFileMenu() { }
00211
00212 AxModalFileMenu(AxMenuController* controller, AxMenuItem* item,
00213 const wxString& menuLabel,
00214 const wxString& description,
00215 const wxString& defaultPath,
00216 int style = axFOLDER_MENU_STYLE_FILE_SELECTOR,
00217 const wxString& filter = wxT("*"));
00218
00219 protected:
00220
00221 };
00222
00230 class AxFolderMenuItem: public AxMenuItem
00231 {
00232 DECLARE_DYNAMIC_CLASS( AxFolderMenuItem )
00233
00234 public:
00235
00236
00237 AxFolderMenuItem(const AxFolderMenuItem& item) { Copy(item); }
00238 AxFolderMenuItem() {}
00239 AxFolderMenuItem(
00240 const wxString& label, const wxString& description,
00241 const wxString& id,
00242 const wxString& path,
00243 const wxString& filter = wxT("*"),
00244 int style = axFOLDER_MENU_STYLE_NEW_FOLDER);
00245 bool Create(
00246 const wxString& label, const wxString& description,
00247 const wxString& id,
00248 const wxString& path,
00249 const wxString& filter = wxT("*"),
00250 int style = axFOLDER_MENU_STYLE_NEW_FOLDER);
00251
00252 void Copy(const AxFolderMenuItem& item);
00253
00254 virtual AxMenuItem* Clone() const { return new AxFolderMenuItem(*this); }
00255
00257 void SetPath(const wxString& path);
00258
00260 const wxString& GetPath() const { return m_path; }
00261
00262 void SetMenuLabel(const wxString& menuLabel) { m_menuLabel = menuLabel; }
00263 const wxString& GetMenuLabel() const { return m_menuLabel; }
00264
00265 void SetMenuDescription(const wxString& menuDescription) { m_menuDescription = menuDescription; }
00266 const wxString& GetMenuDescription() const { return m_menuDescription; }
00267
00268 void SetStyle(int style) { m_style = style; }
00269 int GetStyle() const { return m_style; }
00270
00271 void SetFilter(const wxString& filter) { m_filter = filter; }
00272 const wxString& GetFilter() const { return m_filter; }
00273
00274 wxString CreateString(const wxString& spec, bool isLabel);
00275
00276 protected:
00277
00278 wxString m_path;
00279 wxString m_menuLabel;
00280 wxString m_menuDescription;
00281 int m_style;
00282 wxString m_filter;
00283 };
00284
00292 class AxFileMenuItem: public AxFolderMenuItem
00293 {
00294 DECLARE_DYNAMIC_CLASS( AxFileMenuItem )
00295
00296 public:
00297
00298
00299 AxFileMenuItem(const AxFileMenuItem& item) { Copy(item); }
00300 AxFileMenuItem() {}
00301 AxFileMenuItem(const wxString& label, const wxString& description,
00302 const wxString& id,
00303 const wxString path,
00304 const wxString& filter = wxT("*"),
00305 int style = 0);
00306 bool Create(const wxString& label, const wxString& description,
00307 const wxString& id,
00308 const wxString path,
00309 const wxString& filter = wxT("*"),
00310 int style = axFOLDER_MENU_STYLE_NEW_FOLDER);
00311
00312 virtual AxMenuItem* Clone() const { return new AxFileMenuItem(*this); }
00313 };
00314
00319 class AxFolderValidator: public AxValidator
00320 {
00321 DECLARE_DYNAMIC_CLASS( AxFolderValidator )
00322
00323 public:
00324
00325
00326 AxFolderValidator(const AxFolderValidator& validator) { Init(); Copy(validator); }
00327 AxFolderValidator(wxString* ptr) { Init(); m_stringPtr = ptr; }
00328 AxFolderValidator() { Init(); }
00329 ~AxFolderValidator() {}
00330
00331
00332
00333 void Copy(const AxFolderValidator& validator)
00334 {
00335 AxValidator::Copy(validator);
00336
00337 m_stringPtr = validator.m_stringPtr;
00338 }
00339
00340 virtual AxValidator* Clone() const { return new AxFolderValidator(*this); }
00341
00343 virtual bool TransferDataFromMenu();
00344
00346 virtual bool TransferDataToMenu();
00347
00349 void Init() { m_stringPtr = NULL; }
00350
00351 protected:
00352 wxString* m_stringPtr;
00353 };
00354
00355
00356 #endif
00357