00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXFILESELECTOR_H
00025 #define FXFILESELECTOR_H
00026
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030
00031 namespace FX {
00032
00033 class FXFileList;
00034 class FXTextField;
00035 class FXComboBox;
00036 class FXDirBox;
00037 class FXButton;
00038 class FXIcon;
00039 class FXMenuPane;
00040 class FXCheckButton;
00041
00042
00043
00044 enum {
00045 SELECTFILE_ANY,
00046 SELECTFILE_EXISTING,
00047 SELECTFILE_MULTIPLE,
00048 SELECTFILE_MULTIPLE_ALL,
00049 SELECTFILE_DIRECTORY
00050 };
00051
00052
00053
00054 class FXAPI FXFileSelector : public FXPacker {
00055 FXDECLARE(FXFileSelector)
00056 protected:
00057 FXFileList *filebox;
00058 FXTextField *filename;
00059 FXComboBox *filefilter;
00060 FXMenuPane *bookmarks;
00061 FXCheckButton *readonly;
00062 FXDirBox *dirbox;
00063 FXButton *accept;
00064 FXButton *cancel;
00065 FXIcon *updiricon;
00066 FXIcon *newdiricon;
00067 FXIcon *listicon;
00068 FXIcon *detailicon;
00069 FXIcon *iconsicon;
00070 FXIcon *homeicon;
00071 FXIcon *workicon;
00072 FXIcon *shownicon;
00073 FXIcon *hiddenicon;
00074 FXIcon *markicon;
00075 FXIcon *clearicon;
00076 FXIcon *deleteicon;
00077 FXIcon *moveicon;
00078 FXIcon *copyicon;
00079 FXIcon *linkicon;
00080 FXRecentFiles mrufiles;
00081 FXuint selectmode;
00082 protected:
00083 FXFileSelector(){}
00084 static FXString patternFromText(const FXString& pattern);
00085 static FXString extensionFromPattern(const FXString& pattern);
00086 private:
00087 FXFileSelector(const FXFileSelector&);
00088 FXFileSelector &operator=(const FXFileSelector&);
00089 public:
00090 long onCmdAccept(FXObject*,FXSelector,void*);
00091 long onCmdFilter(FXObject*,FXSelector,void*);
00092 long onCmdItemDblClicked(FXObject*,FXSelector,void*);
00093 long onCmdItemSelected(FXObject*,FXSelector,void*);
00094 long onCmdItemDeselected(FXObject*,FXSelector,void*);
00095 long onCmdDirectoryUp(FXObject*,FXSelector,void*);
00096 long onUpdDirectoryUp(FXObject*,FXSelector,void*);
00097 long onCmdDirTree(FXObject*,FXSelector,void*);
00098 long onCmdHome(FXObject*,FXSelector,void*);
00099 long onCmdWork(FXObject*,FXSelector,void*);
00100 long onCmdBookmark(FXObject*,FXSelector,void*);
00101 long onCmdVisit(FXObject*,FXSelector,void*);
00102 long onCmdNew(FXObject*,FXSelector,void*);
00103 long onUpdNew(FXObject*,FXSelector,void*);
00104 long onCmdMove(FXObject*,FXSelector,void*);
00105 long onCmdCopy(FXObject*,FXSelector,void*);
00106 long onCmdLink(FXObject*,FXSelector,void*);
00107 long onCmdDelete(FXObject*,FXSelector,void*);
00108 long onUpdSelected(FXObject*,FXSelector,void*);
00109 long onPopupMenu(FXObject*,FXSelector,void*);
00110 public:
00111 enum {
00112 ID_FILEFILTER=FXPacker::ID_LAST,
00113 ID_ACCEPT,
00114 ID_FILELIST,
00115 ID_DIRECTORY_UP,
00116 ID_DIRTREE,
00117 ID_HOME,
00118 ID_WORK,
00119 ID_BOOKMARK,
00120 ID_VISIT,
00121 ID_NEW,
00122 ID_DELETE,
00123 ID_MOVE,
00124 ID_COPY,
00125 ID_LINK,
00126 ID_LAST
00127 };
00128 public:
00129
00130
00131 FXFileSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00132
00133
00134 FXButton *acceptButton() const { return accept; }
00135
00136
00137 FXButton *cancelButton() const { return cancel; }
00138
00139
00140 void setFilename(const FXString& path);
00141
00142
00143 FXString getFilename() const;
00144
00145
00146
00147
00148
00149
00150 FXString* getFilenames() const;
00151
00152
00153 void setPattern(const FXString& ptrn);
00154
00155
00156 FXString getPattern() const;
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 void setPatternList(const FXString& patterns);
00173
00174
00175 FXString getPatternList() const;
00176
00177
00178
00179
00180
00181 void setCurrentPattern(FXint n);
00182
00183
00184 FXint getCurrentPattern() const;
00185
00186
00187 FXString getPatternText(FXint patno) const;
00188
00189
00190 void setPatternText(FXint patno,const FXString& text);
00191
00192
00193 void setDirectory(const FXString& path);
00194
00195
00196 FXString getDirectory() const;
00197
00198
00199 void setItemSpace(FXint s);
00200
00201
00202 FXint getItemSpace() const;
00203
00204
00205 void setFileBoxStyle(FXuint style);
00206
00207
00208 FXuint getFileBoxStyle() const;
00209
00210
00211 void setSelectMode(FXuint mode);
00212
00213
00214 FXuint getSelectMode() const { return selectmode; }
00215
00216
00217 void showReadOnly(FXbool show);
00218
00219
00220 FXbool shownReadOnly() const;
00221
00222
00223 void setReadOnly(FXbool state);
00224
00225
00226 FXbool getReadOnly() const;
00227
00228
00229 virtual void save(FXStream& store) const;
00230
00231
00232 virtual void load(FXStream& store);
00233
00234
00235 virtual ~FXFileSelector();
00236 };
00237
00238 }
00239
00240 #endif