]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/filehistory.h
9b49df972b250eb629be0e0016f402be00155cbe
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFileHistory class
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
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).
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.
22 @see @ref overview_docview, wxDocManager
24 class wxFileHistory
: public wxObject
28 Constructor. Pass the maximum number of files that should be stored and
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.
36 wxFileHistory(size_t maxFiles
= 9, wxWindowID idBase
= wxID_FILE1
);
41 virtual ~wxFileHistory();
44 Adds a file to the file history list, if the object has a pointer to an
45 appropriate file menu.
47 virtual void AddFileToHistory(const wxString
& filename
);
50 Appends the files in the history list, to all menus managed by the file
53 virtual void AddFilesToMenu();
55 Appends the files in the history list, to the given menu only.
57 virtual void AddFilesToMenu(wxMenu
* menu
);
60 Returns the base identifier for the range used for appending items.
62 wxWindowID
GetBaseId() const;
65 Returns the number of files currently stored in the file history.
67 virtual size_t GetCount() const;
70 Returns the file at this index (zero-based).
72 virtual wxString
GetHistoryFile(size_t index
) const;
75 Returns the maximum number of files that can be stored.
77 virtual int GetMaxFiles() const;
80 Returns the list of menus that are managed by this file history object.
84 const wxList
& GetMenus() const;
87 Loads the file history from the given config object. This function
88 should be called explicitly by the application.
92 virtual void Load(const wxConfigBase
& config
);
95 Removes the specified file from the history.
97 virtual void RemoveFileFromHistory(size_t i
);
100 Removes this menu from the list of those managed by this object.
102 virtual void RemoveMenu(wxMenu
* menu
);
105 Saves the file history into the given config object. This must be
106 called explicitly by the application.
110 virtual void Save(wxConfigBase
& config
);
113 Sets the base identifier for the range used for appending items.
115 void SetBaseId(wxWindowID baseId
);
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.
123 virtual void UseMenu(wxMenu
* menu
);