.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.FileHistory: ========================================================================================================================================== |phoenix_title| **wx.FileHistory** ========================================================================================================================================== The :ref:`wx.FileHistory` encapsulates a user interface convenience, the list of most recently visited files as shown on a menu (usually the File menu). :ref:`wx.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. .. seealso:: :ref:`Document/View Framework `, `DocManager` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class FileHistory:
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.FileHistory.__init__` Constructor. :meth:`~wx.FileHistory.AddFileToHistory` Adds a file to the file history list, if the object has a pointer to an appropriate file menu. :meth:`~wx.FileHistory.AddFilesToMenu` Appends the files in the history list, to all menus managed by the file history object. :meth:`~wx.FileHistory.GetBaseId` Returns the base identifier for the range used for appending items. :meth:`~wx.FileHistory.GetCount` Returns the number of files currently stored in the file history. :meth:`~wx.FileHistory.GetHistoryFile` Returns the file at this index (zero-based). :meth:`~wx.FileHistory.GetMaxFiles` Returns the maximum number of files that can be stored. :meth:`~wx.FileHistory.GetMenuPathStyle` Get the current style of the menu item labels. :meth:`~wx.FileHistory.GetMenus` Returns the list of menus that are managed by this file history object. :meth:`~wx.FileHistory.Load` Loads the file history from the given config object. :meth:`~wx.FileHistory.RemoveFileFromHistory` Removes the specified file from the history. :meth:`~wx.FileHistory.RemoveMenu` Removes this menu from the list of those managed by this object. :meth:`~wx.FileHistory.Save` Saves the file history into the given config object. :meth:`~wx.FileHistory.SetBaseId` Sets the base identifier for the range used for appending items. :meth:`~wx.FileHistory.SetMenuPathStyle` Set the style of the menu item labels. :meth:`~wx.FileHistory.UseMenu` Adds this menu to the list of those menus that are managed by this file history object. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.FileHistory.BaseId` See :meth:`~wx.FileHistory.GetBaseId` and :meth:`~wx.FileHistory.SetBaseId` :attr:`~wx.FileHistory.Count` See :meth:`~wx.FileHistory.GetCount` :attr:`~wx.FileHistory.MaxFiles` See :meth:`~wx.FileHistory.GetMaxFiles` :attr:`~wx.FileHistory.MenuPathStyle` See :meth:`~wx.FileHistory.GetMenuPathStyle` and :meth:`~wx.FileHistory.SetMenuPathStyle` :attr:`~wx.FileHistory.Menus` See :meth:`~wx.FileHistory.GetMenus` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.FileHistory(Object) **Possible constructors**:: FileHistory(maxFiles=9, idBase=ID_FILE1) The FileHistory encapsulates a user interface convenience, the list of most recently visited files as shown on a menu (usually the File menu). .. method:: __init__(self, maxFiles=9, idBase=ID_FILE1) Constructor. Pass the maximum number of files that should be stored and displayed. `idBase` defaults to ``wx.ID_FILE1`` and represents the id given to the first history menu item. 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 :ref:`wx.FileHistory` in your application. :param `maxFiles`: :type `maxFiles`: int :param `idBase`: :type `idBase`: wx.WindowID .. method:: AddFileToHistory(self, filename) Adds a file to the file history list, if the object has a pointer to an appropriate file menu. :param `filename`: :type `filename`: string .. method:: AddFilesToMenu(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **AddFilesToMenu** `(self)` Appends the files in the history list, to all menus managed by the file history object. :html:`

` **AddFilesToMenu** `(self, menu)` Appends the files in the history list, to the given menu only. :param `menu`: :type `menu`: wx.Menu :html:`

` .. method:: GetBaseId(self) Returns the base identifier for the range used for appending items. :rtype: `wx.WindowID` .. method:: GetCount(self) Returns the number of files currently stored in the file history. :rtype: `int` .. method:: GetHistoryFile(self, index) Returns the file at this index (zero-based). :param `index`: :type `index`: int :rtype: `string` .. method:: GetMaxFiles(self) Returns the maximum number of files that can be stored. :rtype: `int` .. method:: GetMenuPathStyle(self) Get the current style of the menu item labels. Initially returns ``FH_PATH_SHOW_IF_DIFFERENT``. :rtype: :ref:`wx.FileHistoryMenuPathStyle` .. versionadded:: 4.1/wxWidgets-3.1.5 .. seealso:: :meth:`SetMenuPathStyle` .. method:: GetMenus(self) Returns the list of menus that are managed by this file history object. :rtype: `FileHistoryMenuList` .. seealso:: :meth:`UseMenu` .. method:: Load(self, config) Loads the file history from the given config object. This function should be called explicitly by the application. :param `config`: :type `config`: wx.ConfigBase .. seealso:: :ref:`wx.ConfigBase` .. method:: RemoveFileFromHistory(self, i) Removes the specified file from the history. :param `i`: :type `i`: int .. method:: RemoveMenu(self, menu) Removes this menu from the list of those managed by this object. :param `menu`: :type `menu`: wx.Menu .. method:: Save(self, config) Saves the file history into the given config object. This must be called explicitly by the application. :param `config`: :type `config`: wx.ConfigBase .. seealso:: :ref:`wx.ConfigBase` .. method:: SetBaseId(self, baseId) Sets the base identifier for the range used for appending items. :param `baseId`: :type `baseId`: wx.WindowID .. method:: SetMenuPathStyle(self, style) Set the style of the menu item labels. By default, the menu item label style is ``FH_PATH_SHOW_IF_DIFFERENT``. :param `style`: :type `style`: wx.FileHistoryMenuPathStyle .. versionadded:: 4.1/wxWidgets-3.1.5 .. method:: UseMenu(self, menu) Adds this menu to the list of those menus that are managed by this file history object. Also see :meth:`AddFilesToMenu` for initializing the menu with filenames that are already in the history when this function is called, as this is not done automatically. :param `menu`: :type `menu`: wx.Menu .. attribute:: BaseId See :meth:`~wx.FileHistory.GetBaseId` and :meth:`~wx.FileHistory.SetBaseId` .. attribute:: Count See :meth:`~wx.FileHistory.GetCount` .. attribute:: MaxFiles See :meth:`~wx.FileHistory.GetMaxFiles` .. attribute:: MenuPathStyle See :meth:`~wx.FileHistory.GetMenuPathStyle` and :meth:`~wx.FileHistory.SetMenuPathStyle` .. attribute:: Menus See :meth:`~wx.FileHistory.GetMenus`