AGW Logo

agw_title FileHistory

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.

hierarchy Inheritance Diagram

Inheritance diagram for: FileHistory

Inheritance diagram of FileHistory


method_summary Methods Summary

__init__Default class constructor.
AddFileToHistoryAdds a file to the file history list, if the object has a pointer to an appropriate file menu.
AddFilesToMenuAppends the files in the history list, to all menus managed by the file history object
AddFilesToMenu2Appends the files in the history list, to the given menu only.
GetBaseIdReturns the base identifier for the range used for appending items.
GetCountReturns the number of files currently stored in the file history.
GetHistoryFileReturns the file at this index (zero-based).
GetMaxFilesReturns the maximum number of files that can be stored.
GetMenusReturns the list of menus that are managed by this file history object.
GetNoHistoryFilesReturns the number of files currently stored in the file history.
LoadLoads the file history from the given config object.
RemoveFileFromHistoryRemoves the specified file from the history.
RemoveMenuRemoves this menu from the list of those managed by this object.
SaveSaves the file history to the given config object.
SetBaseIdSets the base identifier for the range used for appending items.
UseMenuAdds this menu to the list of those menus that are managed by this file history object.

API Class API

class FileHistory(object)[source]

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__(maxFiles=9, idBase=wx.ID_FILE1)[source]

Default class constructor.

Parameters:
  • 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.



AddFileToHistory(fnNew)[source]

Adds a file to the file history list, if the object has a pointer to an appropriate file menu.

Parameters:fnNew (string) – the file name to add to the history list.


AddFilesToMenu(menu=None)[source]

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.

Parameters:menu – if not None, an instance of FlatMenu.


AddFilesToMenu2(menu)[source]

Appends the files in the history list, to the given menu only.

Parameters:menu – an instance of FlatMenu.


GetBaseId()[source]

Returns the base identifier for the range used for appending items.



GetCount()[source]

Returns the number of files currently stored in the file history.



GetHistoryFile(index)[source]

Returns the file at this index (zero-based).

Parameters:index (integer) – the index at which the file is stored in the file list (zero-based).


GetMaxFiles()[source]

Returns the maximum number of files that can be stored.



GetMenus()[source]

Returns the list of menus that are managed by this file history object.

See also

UseMenu.



GetNoHistoryFiles()[source]

Returns the number of files currently stored in the file history.



Load(config)[source]

Loads the file history from the given config object.

Parameters:config – an instance of wx.Config.

Note

This function should be called explicitly by the application.

See also

Save.



RemoveFileFromHistory(index)[source]

Removes the specified file from the history.

Parameters:index (integer) – the zero-based index indicating the file name position in the file list.


RemoveMenu(menu)[source]

Removes this menu from the list of those managed by this object.

Parameters:menu – an instance of FlatMenu.


Save(config)[source]

Saves the file history to the given config object.

Parameters:config – an instance of wx.Config.

Note

This function should be called explicitly by the application.

See also

Load.



SetBaseId(baseId)[source]

Sets the base identifier for the range used for appending items.

Parameters:baseId (integer) – the base identifier for the range used for appending items.


UseMenu(menu)[source]

Adds this menu to the list of those menus that are managed by this file history object.

Parameters: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.

Tree

Table Of Contents

Previous topic

FMRendererXP

Next topic

FlatMenu