]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/filehistory.h
remove ancient defines left over from GTK1
[wxWidgets.git] / interface / wx / filehistory.h
CommitLineData
a0219e45
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: filehistory.h
3// Purpose: wxFileHistory class
4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
a0219e45
VS
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxFileHistory
10
11 The wxFileHistory encapsulates a user interface convenience, the list of
12 most recently visited files as shown on a menu (usually the File menu).
13
14 wxFileHistory can manage one or more file menus. More than one menu may be
15 required in an MDI application, where the file history should appear on
16 each MDI child menu as well as the MDI parent frame.
17
18 @library{wxcore}
19 @category{docview}
20
21 @see @ref overview_docview, wxDocManager
22*/
23class wxFileHistory : public wxObject
24{
25public:
26 /**
27 Constructor. Pass the maximum number of files that should be stored and
28 displayed.
29
30 @a idBase defaults to wxID_FILE1 and represents the id given to the
31 first history menu item. Since menu items can't share the same ID you
32 should change @a idBase (to one of your own defined IDs) when using
33 more than one wxFileHistory in your application.
34 */
35 wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
36
37 /**
38 Destructor.
39 */
40 virtual ~wxFileHistory();
41
42 /**
43 Adds a file to the file history list, if the object has a pointer to an
44 appropriate file menu.
45 */
46 virtual void AddFileToHistory(const wxString& filename);
47
48 /**
49 Appends the files in the history list, to all menus managed by the file
50 history object.
51 */
52 virtual void AddFilesToMenu();
53 /**
54 Appends the files in the history list, to the given menu only.
55 */
56 virtual void AddFilesToMenu(wxMenu* menu);
57
58 /**
59 Returns the base identifier for the range used for appending items.
60 */
61 wxWindowID GetBaseId() const;
62
63 /**
64 Returns the number of files currently stored in the file history.
65 */
66 virtual size_t GetCount() const;
67
68 /**
69 Returns the file at this index (zero-based).
70 */
71 virtual wxString GetHistoryFile(size_t index) const;
72
73 /**
74 Returns the maximum number of files that can be stored.
75 */
76 virtual int GetMaxFiles() const;
77
78 /**
79 Returns the list of menus that are managed by this file history object.
80
81 @see UseMenu()
82 */
83 const wxList& GetMenus() const;
84
85 /**
86 Loads the file history from the given config object. This function
87 should be called explicitly by the application.
88
89 @see wxConfigBase
90 */
91 virtual void Load(const wxConfigBase& config);
92
93 /**
94 Removes the specified file from the history.
95 */
96 virtual void RemoveFileFromHistory(size_t i);
97
98 /**
99 Removes this menu from the list of those managed by this object.
100 */
101 virtual void RemoveMenu(wxMenu* menu);
102
103 /**
104 Saves the file history into the given config object. This must be
105 called explicitly by the application.
106
107 @see wxConfigBase
108 */
109 virtual void Save(wxConfigBase& config);
110
111 /**
112 Sets the base identifier for the range used for appending items.
113 */
114 void SetBaseId(wxWindowID baseId);
115
116 /**
117 Adds this menu to the list of those menus that are managed by this file
118 history object. Also see AddFilesToMenu() for initializing the menu
119 with filenames that are already in the history when this function is
120 called, as this is not done automatically.
121 */
122 virtual void UseMenu(wxMenu* menu);
123};