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