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,2022 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=nullptr,FXSelector sel=0);
119 
125  FXRecentFiles(FXSettings* st,const FXString& gp="Recent Files",FXObject *tgt=nullptr,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
FXSelector getSelector() const
Return the message id.
Definition: FXRecentFiles.h:155
FXuint getMaxFiles() const
Return the maximum number of files being tracked.
Definition: FXRecentFiles.h:137
FXSettings * getSettings() const
Return settings database.
Definition: FXRecentFiles.h:131
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
FXString getGroupName() const
Return group name.
Definition: FXRecentFiles.h:143
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
The Settings class manages a key-value database.
Definition: FXSettings.h:34
void setSettings(FXSettings *s)
Change settings database.
Definition: FXRecentFiles.h:128
void setTarget(FXObject *t)
Change the target.
Definition: FXRecentFiles.h:146
Definition: FX4Splitter.h:28
void setGroupName(const FXString &name)
Set group name.
Definition: FXRecentFiles.h:140
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
The Recent Files group manages a most recently used (MRU) file list by means of the standard system r...
Definition: FXRecentFiles.h:49
FXObject * getTarget() const
Get the target.
Definition: FXRecentFiles.h:149
void setSelector(FXSelector sel)
Change the message.
Definition: FXRecentFiles.h:152
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp