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

.. currentmodule:: wx.lib.agw.flatmenu

.. highlight:: python



.. _wx.lib.agw.flatmenu.FileHistory:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.flatmenu.FileHistory**
==========================================================================================================================================

The :class:`FileHistory` encapsulates a user interface convenience, the list of most
recently visited files as shown on a menu (usually the File menu).

:class:`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.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>FileHistory</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.flatmenu.FileHistory_inheritance.png" alt="Inheritance diagram of FileHistory" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.flatmenu.FileHistory.html" title="wx.lib.agw.flatmenu.FileHistory" alt="" coords="5,5,232,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatmenu.FileHistory.__init__`                                Default class constructor.
:meth:`~wx.lib.agw.flatmenu.FileHistory.AddFilesToMenu`                          Appends the files in the history list, to all menus managed by the file history object
:meth:`~wx.lib.agw.flatmenu.FileHistory.AddFilesToMenu2`                         Appends the files in the history list, to the given menu only.
:meth:`~wx.lib.agw.flatmenu.FileHistory.AddFileToHistory`                        Adds a file to the file history list, if the object has a pointer to an
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetBaseId`                               Returns the base identifier for the range used for appending items.
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetCount`                                Returns the number of files currently stored in the file history.
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetHistoryFile`                          Returns the file at this index (zero-based).
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetMaxFiles`                             Returns the maximum number of files that can be stored.
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetMenus`                                Returns the list of menus that are managed by this file history object.
:meth:`~wx.lib.agw.flatmenu.FileHistory.GetNoHistoryFiles`                       Returns the number of files currently stored in the file history.
:meth:`~wx.lib.agw.flatmenu.FileHistory.Load`                                    Loads the file history from the given `config` object.
:meth:`~wx.lib.agw.flatmenu.FileHistory.RemoveFileFromHistory`                   Removes the specified file from the history.
:meth:`~wx.lib.agw.flatmenu.FileHistory.RemoveMenu`                              Removes this menu from the list of those managed by this object.
:meth:`~wx.lib.agw.flatmenu.FileHistory.Save`                                    Saves the file history to the given `config` object.
:meth:`~wx.lib.agw.flatmenu.FileHistory.SetBaseId`                               Sets the base identifier for the range used for appending items.
:meth:`~wx.lib.agw.flatmenu.FileHistory.UseMenu`                                 Adds this menu to the list of those menus that are managed by this file history
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: FileHistory(object)

   The :class:`FileHistory` encapsulates a user interface convenience, the list of most
   recently visited files as shown on a menu (usually the File menu).
   
   :class:`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.

   .. method:: __init__(self, maxFiles=9, idBase=wx.ID_FILE1)

      Default class constructor.
      
      :param integer `maxFiles`: the maximum number of files that should be stored and displayed;
      :param integer `idBase`: 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 :class:`FileHistory` in your application.


   .. method:: 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 :meth:`~FileHistory.AddFilesToMenu2`.
      
      :param `menu`: if not ``None``, an instance of :class:`FlatMenu`.


   .. method:: AddFilesToMenu2(self, menu)

      Appends the files in the history list, to the given menu only.
      
      :param `menu`: an instance of :class:`FlatMenu`.


   .. method:: AddFileToHistory(self, fnNew)

      Adds a file to the file history list, if the object has a pointer to an
      appropriate file menu.
      
      :param string `fnNew`: the file name to add to the history list.


   .. method:: GetBaseId(self)

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


   .. method:: GetCount(self)

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


   .. method:: GetHistoryFile(self, index)

      Returns the file at this index (zero-based).
      
      :param integer `index`: the index at which the file is stored in the file list (zero-based).


   .. method:: GetMaxFiles(self)

      Returns the maximum number of files that can be stored. 


   .. method:: GetMenus(self)

      Returns the list of menus that are managed by this file history object.
      
      :see: :meth:`~FileHistory.UseMenu`.


   .. method:: GetNoHistoryFiles(self)

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


   .. method:: Load(self, config)

      Loads the file history from the given `config` object.
      
      :param `config`: an instance of :class:`Config <ConfigBase>`.
      
      :note: This function should be called explicitly by the application.
      
      :see: :meth:`~FileHistory.Save`.


   .. method:: RemoveFileFromHistory(self, index)

      Removes the specified file from the history.
      
      :param integer `index`: the zero-based index indicating the file name position in
       the file list.


   .. method:: RemoveMenu(self, menu)

      Removes this menu from the list of those managed by this object.
      
      :param `menu`: an instance of :class:`FlatMenu`.


   .. method:: Save(self, config)

      Saves the file history to the given `config` object.
      
      :param `config`: an instance of :class:`Config <ConfigBase>`.
      
      :note: This function should be called explicitly by the application.
      
      :see: :meth:`~FileHistory.Load`.


   .. method:: SetBaseId(self, baseId)

      Sets the base identifier for the range used for appending items.
      
      :param integer `baseId`: the base identifier for the range used for appending items.


   .. method:: UseMenu(self, menu)

      Adds this menu to the list of those menus that are managed by this file history
      object.
      
      :param `menu`: an instance of :class:`FlatMenu`.
      
      :see: :meth:`~FileHistory.AddFilesToMenu` for initializing the menu with filenames that are already
       in the history when this function is called, as this is not done automatically.


