00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXRECENTFILES_H
00022 #define FXRECENTFILES_H
00023
00024 #ifndef FXOBJECT_H
00025 #include "FXObject.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00031 class FXApp;
00032
00033
00049 class FXAPI FXRecentFiles : public FXObject {
00050 FXDECLARE(FXRecentFiles)
00051 private:
00052 FXSettings *settings;
00053 FXObject *target;
00054 FXSelector message;
00055 FXString group;
00056 FXuint maxfiles;
00057 private:
00058 static const FXchar key[32][7];
00059 private:
00060 FXRecentFiles(const FXRecentFiles&);
00061 FXRecentFiles &operator=(const FXRecentFiles&);
00062 public:
00063 long onCmdClear(FXObject*,FXSelector,void*);
00064 long onCmdFile(FXObject*,FXSelector,void*);
00065 long onUpdFile(FXObject*,FXSelector,void*);
00066 long onUpdAnyFiles(FXObject*,FXSelector,void*);
00067 public:
00068 enum{
00069 ID_CLEAR,
00070 ID_ANYFILES,
00071 ID_FILE_1,
00072 ID_FILE_2,
00073 ID_FILE_3,
00074 ID_FILE_4,
00075 ID_FILE_5,
00076 ID_FILE_6,
00077 ID_FILE_7,
00078 ID_FILE_8,
00079 ID_FILE_9,
00080 ID_FILE_10,
00081 ID_LAST
00082 };
00083 public:
00084
00089 FXRecentFiles();
00090
00096 FXRecentFiles(FXApp* a,const FXString& gp="Recent Files",FXObject *tgt=NULL,FXSelector sel=0);
00097
00103 FXRecentFiles(FXSettings* st,const FXString& gp="Recent Files",FXObject *tgt=NULL,FXSelector sel=0);
00104
00106 void setSettings(FXSettings* s){ settings=s; }
00107
00109 FXSettings* getSettings() const { return settings; }
00110
00112 void setMaxFiles(FXuint mx);
00113
00115 FXuint getMaxFiles() const { return maxfiles; }
00116
00118 void setGroupName(const FXString& name){ group=name; }
00119
00121 FXString getGroupName() const { return group; }
00122
00124 void setTarget(FXObject *t){ target=t; }
00125
00127 FXObject *getTarget() const { return target; }
00128
00130 void setSelector(FXSelector sel){ message=sel; }
00131
00133 FXSelector getSelector() const { return message; }
00134
00136 FXString getFile(FXuint index) const;
00137
00139 void setFile(FXuint index,const FXString& filename);
00140
00142 void appendFile(const FXString& filename);
00143
00145 void removeFile(const FXString& filename);
00146
00148 void clear();
00149
00151 virtual void save(FXStream& store) const;
00152
00154 virtual void load(FXStream& store);
00155
00157 virtual ~FXRecentFiles();
00158 };
00159
00160 }
00161
00162 #endif