Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRecentFiles.h
1 /********************************************************************************
2 * *
3 * R e c e n t F i l e s L i s t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXRECENTFILES_H
22 #define FXRECENTFILES_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXApp;
32 
33 
49 class FXAPI FXRecentFiles : public FXObject {
50  FXDECLARE(FXRecentFiles)
51 private:
52  FXSettings *settings; // Settings database where list is kept
53  FXObject *target; // Target object to send message
54  FXSelector message; // Message to send
55  FXString group; // MRU File group
56  FXuint maxfiles; // Maximum number of files to track
57 private:
58  static const FXchar key[32][7];
59 private:
61  FXRecentFiles &operator=(const FXRecentFiles&);
62 public:
63  long onCmdClear(FXObject*,FXSelector,void*);
64  long onCmdFile(FXObject*,FXSelector,void*);
65  long onUpdFile(FXObject*,FXSelector,void*);
66  long onUpdAnyFiles(FXObject*,FXSelector,void*);
67 public:
68  enum{
69  ID_CLEAR,
70  ID_ANYFILES,
71  ID_FILE_1,
72  ID_FILE_2,
73  ID_FILE_3,
74  ID_FILE_4,
75  ID_FILE_5,
76  ID_FILE_6,
77  ID_FILE_7,
78  ID_FILE_8,
79  ID_FILE_9,
80  ID_FILE_10,
81  ID_FILE_11,
82  ID_FILE_12,
83  ID_FILE_13,
84  ID_FILE_14,
85  ID_FILE_15,
86  ID_FILE_16,
87  ID_FILE_17,
88  ID_FILE_18,
89  ID_FILE_19,
90  ID_FILE_20,
91  ID_FILE_21,
92  ID_FILE_22,
93  ID_FILE_23,
94  ID_FILE_24,
95  ID_FILE_25,
96  ID_FILE_26,
97  ID_FILE_27,
98  ID_FILE_28,
99  ID_FILE_29,
100  ID_FILE_30,
101  ID_FILE_31,
102  ID_FILE_32,
103  ID_LAST
104  };
105 public:
106 
111  FXRecentFiles();
112 
118  FXRecentFiles(FXApp* a,const FXString& gp="Recent Files",FXObject *tgt=NULL,FXSelector sel=0);
119 
125  FXRecentFiles(FXSettings* st,const FXString& gp="Recent Files",FXObject *tgt=NULL,FXSelector sel=0);
126 
128  void setSettings(FXSettings* s){ settings=s; }
129 
131  FXSettings* getSettings() const { return settings; }
132 
134  void setMaxFiles(FXuint mx);
135 
137  FXuint getMaxFiles() const { return maxfiles; }
138 
140  void setGroupName(const FXString& name){ group=name; }
141 
143  FXString getGroupName() const { return group; }
144 
146  void setTarget(FXObject *t){ target=t; }
147 
149  FXObject *getTarget() const { return target; }
150 
152  void setSelector(FXSelector sel){ message=sel; }
153 
155  FXSelector getSelector() const { return message; }
156 
158  FXString getFile(FXuint index) const;
159 
161  void setFile(FXuint index,const FXString& filename);
162 
164  void appendFile(const FXString& filename);
165 
167  void removeFile(const FXString& filename);
168 
170  void clear();
171 
173  virtual void save(FXStream& store) const;
174 
176  virtual void load(FXStream& store);
177 
179  virtual ~FXRecentFiles();
180  };
181 
182 }
183 
184 #endif

Copyright © 1997-2016 Jeroen van der Zijp