The FileHistory
encapsulates a user interface convenience, the list of most
recently visited files as shown on a menu (usually the File menu).
FileHistory
can manage one or more file menus. More than one menu may be
required in an MDI application, where the file history should appear on each MDI
child menu as well as the MDI parent frame.
Default class constructor. |
|
Appends the files in the history list, to all menus managed by the file history object |
|
Appends the files in the history list, to the given menu only. |
|
Adds a file to the file history list, if the object has a pointer to an |
|
Returns the base identifier for the range used for appending items. |
|
Returns the number of files currently stored in the file history. |
|
Returns the file at this index (zero-based). |
|
Returns the maximum number of files that can be stored. |
|
Returns the list of menus that are managed by this file history object. |
|
Returns the number of files currently stored in the file history. |
|
Loads the file history from the given config object. |
|
Removes the specified file from the history. |
|
Removes this menu from the list of those managed by this object. |
|
Saves the file history to the given config object. |
|
Sets the base identifier for the range used for appending items. |
|
Adds this menu to the list of those menus that are managed by this file history |
FileHistory
(object)¶The FileHistory
encapsulates a user interface convenience, the list of most
recently visited files as shown on a menu (usually the File menu).
FileHistory
can manage one or more file menus. More than one menu may be
required in an MDI application, where the file history should appear on each MDI
child menu as well as the MDI parent frame.
__init__
(self, maxFiles=9, idBase=wx.ID_FILE1)¶Default class constructor.
maxFiles (integer) – the maximum number of files that should be stored and displayed;
idBase (integer) – defaults to wx.ID_FILE1
and represents the id given to the first
history menu item.
Note
Since menu items can’t share the same ID you should change idBase to one of
your own defined IDs when using more than one FileHistory
in your application.
AddFilesToMenu
(self, menu=None)¶Appends the files in the history list, to all menus managed by the file history object
if menu is None
. Otherwise it calls the auxiliary method AddFilesToMenu2
.
menu – if not None
, an instance of FlatMenu
.
AddFilesToMenu2
(self, menu)¶Appends the files in the history list, to the given menu only.
menu – an instance of FlatMenu
.
AddFileToHistory
(self, fnNew)¶Adds a file to the file history list, if the object has a pointer to an appropriate file menu.
fnNew (string) – the file name to add to the history list.
GetBaseId
(self)¶Returns the base identifier for the range used for appending items.
GetCount
(self)¶Returns the number of files currently stored in the file history.
GetHistoryFile
(self, index)¶Returns the file at this index (zero-based).
index (integer) – the index at which the file is stored in the file list (zero-based).
GetMaxFiles
(self)¶Returns the maximum number of files that can be stored.
GetMenus
(self)¶Returns the list of menus that are managed by this file history object.
See also
GetNoHistoryFiles
(self)¶Returns the number of files currently stored in the file history.
Load
(self, config)¶Loads the file history from the given config object.
config – an instance of Config
.
RemoveFileFromHistory
(self, index)¶Removes the specified file from the history.
index (integer) – the zero-based index indicating the file name position in the file list.
RemoveMenu
(self, menu)¶Removes this menu from the list of those managed by this object.
menu – an instance of FlatMenu
.
Save
(self, config)¶Saves the file history to the given config object.
config – an instance of Config
.
SetBaseId
(self, baseId)¶Sets the base identifier for the range used for appending items.
baseId (integer) – the base identifier for the range used for appending items.
UseMenu
(self, menu)¶Adds this menu to the list of those menus that are managed by this file history object.
menu – an instance of FlatMenu
.
See also
AddFilesToMenu
for initializing the menu with filenames that are already
in the history when this function is called, as this is not done automatically.