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

.. highlight:: python



.. _wx.lib.agw.shortcuteditor.ListShortcut:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.shortcuteditor.ListShortcut**
==========================================================================================================================================

:class:`ListShortcut` is a subclass of :class:`~wx.lib.agw.hypertreelist.HyperTreeList`,
customized to look like the GIMP main shortcut list. This class is used to display the
shortcut label (with an optional bitmap next to it), its accelerator and
the help string associated with it (if present).

This information is displayed in 3 columns inside :class:`ListShortcut`.



|

|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>ListShortcut</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.shortcuteditor.ListShortcut_inheritance.png" alt="Inheritance diagram of ListShortcut" 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.shortcuteditor.ListShortcut.html" title="wx.lib.agw.shortcuteditor.ListShortcut" alt="" coords="157,469,423,499"/> <area shape="rect" id="node2" href="wx.lib.agw.hypertreelist.HyperTreeList.html" title="wx.lib.agw.hypertreelist.HyperTreeList" alt="" coords="5,392,276,421"/> <area shape="rect" id="node3" href="wx.lib.mixins.treemixin.ExpansionState.html" title="wx.lib.mixins.treemixin.ExpansionState" alt="" coords="300,392,581,421"/> <area shape="rect" id="node4" href="wx.Control.html" title="wx.Control" alt="" coords="95,315,187,344"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="92,237,189,267"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="76,160,205,189"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="82,83,199,112"/> <area shape="rect" id="node8" href="wx.Object.html" title="wx.Object" alt="" coords="37,5,124,35"/> <area shape="rect" id="node9" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="149,5,255,35"/> <area shape="rect" id="node10" href="wx.lib.mixins.treemixin.TreeAPIHarmonizer.html" title="wx.lib.mixins.treemixin.TreeAPIHarmonizer" alt="" coords="250,315,554,344"/> <area shape="rect" id="node11" href="wx.lib.mixins.treemixin.TreeHelper.html" title="wx.lib.mixins.treemixin.TreeHelper" alt="" coords="578,315,829,344"/> </map> 
   </p>
   </div>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.agw.hypertreelist.HyperTreeList`, :class:`wx.lib.mixins.treemixin.ExpansionState`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.__init__`                         Default class constructor.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.AcceptShortcut`                   Returns ``True`` if the input `accelerator` is a valid shortcut, ``False`` otherwise.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.BuildImageList`                   Recursively builds the :class:`ListShortcut` image list based on the bitmaps in the
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.CalculateOffset`                  Calculates an offset (in pixels) so that the :class:`Shortcut` items without
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.DisableShortcut`                  If the user decides to reassign a shortcut to another item, this method will disable
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.FireShortcutChanged`              Fires the ``EVT_SHORTCUT_CHANGED`` event for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.FireShortcutChanging`             Fires the ``EVT_SHORTCUT_CHANGING`` event for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.GetItemIdentity`                  Return a hashable object that represents the identity of a :class:`ListShortcut` item.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.HasFlag`                          Overridden from :class:`wx.Window` as a workaround on the conflicts between `treemixin` and
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.MakeImageList`                    Builds the :class:`ListShortcut` image list based on the bitmaps in the :class:`Shortcut` hierarchy.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnExpandCollapse`                 Handles the ``wx.EVT_TREE_ITEM_COLLAPSED`` / ``wx.EVT_TREE_ITEM_EXPANDED`` events for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnKillFocus`                      Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnLeftDown`                       Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnSelChanged`                     Handles the ``wx.EVT_TREE_SEL_CHANGED`` event for :class:`ListShortcut`.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.OnShortcut`                       Handles the ``wx.EVT_CHAR_HOOK`` event for :class:`ShortcutEditor`, implemented in :class:`ListShortcut`
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.Populate`                         Recursively populates the :class:`ListShortcut` with information from the :class:`Shortcut` tree.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.RecreateTree`                     Recreates the entire :class:`ListShortcut` (columns excluded).
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.SetFilter`                        Sets the `filter` string against all the shortcuts in the :class:`ListShortcut` are matched.
:meth:`~wx.lib.agw.shortcuteditor.ListShortcut.ShowShortcutText`                 Shows/Hides a :class:`TextCtrl` used to display the combination of keystrokes the user
================================================================================ ================================================================================


|


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


.. class:: ListShortcut(HTL.HyperTreeList, treemixin.ExpansionState)

   :class:`ListShortcut` is a subclass of :class:`~wx.lib.agw.hypertreelist.HyperTreeList`,
   customized to look like the GIMP main shortcut list. This class is used to display the
   shortcut label (with an optional bitmap next to it), its accelerator and
   the help string associated with it (if present).
   
   This information is displayed in 3 columns inside :class:`ListShortcut`.

   .. method:: __init__(self, parent)

      Default class constructor.
      
      :param `parent`: an instance of :class:`ShortcutEditor`.


   .. method:: AcceptShortcut(self, shortcut, accelerator)

      Returns ``True`` if the input `accelerator` is a valid shortcut, ``False`` otherwise.
      
      :param `shortcut`: an instance of :class:`Shortcut`;
      :param string `accelerator`: the new accelerator to check.
      
      :note: Conflicting shortcuts are handled inside this method by presenting the user with
       a conflict dialog. At this point the user can decide to reassign an existing shortcut
       or to back away, in which case this method will return ``False``.


   .. method:: BuildImageList(self, shortcut=None, index=None)

      Recursively builds the :class:`ListShortcut` image list based on the bitmaps in the
      :class:`Shortcut` hierarchy.
      
      :param `shortcut`: an instance of :class:`Shortcut`. If ``None``, it is defaulted to
       `self.manager` to make this function reentrant (i.e. allow more than one
       enumeration on one and the same object simultaneously);
      :param integer `index`: the current image index inside the :class:`ListShortcut` own :class:`wx.ImageList`.


   .. method:: CalculateOffset(self)

      Calculates an offset (in pixels) so that the :class:`Shortcut` items without
      a bitmap look parallel to the ones with a bitmap.


   .. method:: DisableShortcut(self, conflict, item=None)

      If the user decides to reassign a shortcut to another item, this method will disable
      the conflicting shortcut (by putting a "Disabled" string as its accelerator).
      
      :param `conflict`: an instance of :class:`Shortcut` to reset;
      :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`. If defaulted to ``None``, it is set
       to the :class:`ListShortcut` root item and used only to make this function reentrant
       (i.e. allow more than one enumeration on one and the same object simultaneously).


   .. method:: FireShortcutChanged(self, shortcut, newAccel)

      Fires the ``EVT_SHORTCUT_CHANGED`` event for :class:`ListShortcut`.
      
      :param `shortcut`: an instance of :class:`Shortcut` that has been renamed;
      :param string `newAccel`: the new accelerator just entered by the user.


   .. method:: FireShortcutChanging(self, shortcut, newAccel)

      Fires the ``EVT_SHORTCUT_CHANGING`` event for :class:`ListShortcut`.
      
      The event propagation (and thus the shortcut renaming by the user) can be
      interrupted by *not* calling `event.Skip()` in your handler for this event.
      
      :param `shortcut`: an instance of :class:`Shortcut` that is about to be renamed;
      :param string `newAccel`: the new accelerator just entered by the user.


   .. method:: GetItemIdentity(self, item)

      Return a hashable object that represents the identity of a :class:`ListShortcut` item.
      
      In this implementation this returns the item label.
      
      :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`.


   .. method:: HasFlag(self, flag)

      Overridden from :class:`wx.Window` as a workaround on the conflicts between `treemixin` and
      :class:`~wx.lib.agw.hypertreelist.HyperTreeList` with the ``wx.TR_HIDE_ROOT`` `agwStyle` set.
      
      :param integer `flag`: an integer bit flag specifying the `agwStyle` style.
      
      :return: ``True`` if the :class:`ListShortcut` has the input `flag` set, ``False`` otherwise.
      
      :note: Overridden from :class:`wx.Window`.


   .. method:: MakeImageList(self)

      Builds the :class:`ListShortcut` image list based on the bitmaps in the :class:`Shortcut` hierarchy. 


   .. method:: OnExpandCollapse(self, event)

      Handles the ``wx.EVT_TREE_ITEM_COLLAPSED`` / ``wx.EVT_TREE_ITEM_EXPANDED`` events for :class:`ListShortcut`.
      
      :param `event`: an instance of :class:`TreeEvent`.


   .. method:: OnKillFocus(self, event)

      Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`ListShortcut`.
      
      :param `event`: an instance of :class:`FocusEvent`.


   .. method:: OnLeftDown(self, event)

      Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ListShortcut`.
      
      :param `event`: an instance of :class:`MouseEvent`.


   .. method:: OnSelChanged(self, event)

      Handles the ``wx.EVT_TREE_SEL_CHANGED`` event for :class:`ListShortcut`.
      
      :param `event`: an instance of :class:`TreeEvent`.


   .. method:: OnShortcut(self, event)

      Handles the ``wx.EVT_CHAR_HOOK`` event for :class:`ShortcutEditor`, implemented in :class:`ListShortcut`
      as it is easier to deal with in this class.
      
      :param `event`: an instance of :class:`KeyEvent`.


   .. method:: Populate(self, item=None, shortcut=None)

      Recursively populates the :class:`ListShortcut` with information from the :class:`Shortcut` tree.
      
      :param `item`: an instance of :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`. If ``None``, it is defaulted to
       the :class:`ListShortcut` root item to make this function reentrant (i.e. allow more than one
       enumeration on one and the same object simultaneously);
      :param `shortcut`: an instance of :class:`Shortcut`. If ``None``, it is defaulted to
       `self.manager` to make this function reentrant (i.e. allow more than one
       enumeration on one and the same object simultaneously).


   .. method:: RecreateTree(self)

      Recreates the entire :class:`ListShortcut` (columns excluded). 


   .. method:: SetFilter(self, filter='')

      Sets the `filter` string against all the shortcuts in the :class:`ListShortcut` are matched.
      
      :param string `filter`: a string to match.


   .. method:: ShowShortcutText(self, show)

      Shows/Hides a :class:`TextCtrl` used to display the combination of keystrokes the user
      has entered. This :class:`TextCtrl` remains visible only for a short amount of time
      and only when some keys are down.
      
      :param bool `show`: ``True`` to show the :class:`TextCtrl`, ``False`` to hide it.


