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

.. highlight:: python



.. _wx.lib.agw.labelbook.ImageContainerBase:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.labelbook.ImageContainerBase**
==========================================================================================================================================

Base class for :class:`FlatImageBook` image container.



|

|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>ImageContainerBase</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.labelbook.ImageContainerBase_inheritance.png" alt="Inheritance diagram of ImageContainerBase" 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.labelbook.ImageContainerBase.html" title="wx.lib.agw.labelbook.ImageContainerBase" alt="" coords="5,392,304,421"/> <area shape="rect" id="node2" href="wx.Panel.html" title="wx.Panel" alt="" coords="115,315,195,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="106,237,203,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="90,160,219,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="96,83,213,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="51,5,138,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="163,5,269,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.agw.labelbook.ImageContainer`, :class:`wx.lib.agw.labelbook.LabelContainer`

|


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

:class:`wx.Panel`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.__init__`                        Default class constructor.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.AddPage`                         Adds a page to the container.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.AssignImageList`                 Assigns an image list to the :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.CanDoBottomStyle`                Allows the parent to examine the children type. Some implementation
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.ClearAll`                        Deletes all the pages in the container.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.ClearFlag`                       Removes flag from the style.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.DoDeletePage`                    Does the actual page deletion.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.DrawPin`                         Draw a pin button, that allows collapsing of the image panel.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.EnableTab`                       Enables or disables a tab.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.FixTextSize`                     Fixes the text, to fit `maxWidth` value. If the text length exceeds
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.GetEnabled`                      Returns whether a tab is enabled or not.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.GetImageList`                    Return the image list for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.GetImageSize`                    Returns the image size inside the :class:`wx.ImageContainerBase` image list.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.GetPageImage`                    Returns the image index for the given page.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.GetPageText`                     Returns the tab caption for the given page.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.HasAGWFlag`                      Tests for existence of flag in the style.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.HitTest`                         Returns the index of the tab at the specified position or ``wx.NOT_FOUND``
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.InsertPage`                      Inserts a page into the container at the specified position.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnEraseBackground`               Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnMouseLeaveWindow`              Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnMouseLeftDown`                 Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnMouseLeftUp`                   Handles the ``wx.EVT_LEFT_UP`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnMouseMove`                     Handles the ``wx.EVT_MOTION`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.OnSize`                          Handles the ``wx.EVT_SIZE`` event for :class:`wx.ImageContainerBase`.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.PointOnSash`                     Tests whether pt is located on the sash.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.SetPageImage`                    Sets the image for the given page.
:meth:`~wx.lib.agw.labelbook.ImageContainerBase.SetPageText`                     Sets the tab caption for the given page.
================================================================================ ================================================================================


|


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


.. class:: ImageContainerBase(wx.Panel)

   Base class for :class:`FlatImageBook` image container.

   .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="ImageContainerBase")

      Default class constructor.
      
      :param `parent`: parent window. Must not be ``None``;
      :param `id`: window identifier. A value of -1 indicates a default value;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `style`: the underlying :class:`Panel` window style;
      :param `agwStyle`: the AGW-specific window style. This can be a combination of the
       following bits:
      
       =========================== =========== ==================================================
       Window Styles               Hex Value   Description
       =========================== =========== ==================================================
       ``INB_BOTTOM``                      0x1 Place labels below the page area. Available only for :class:`FlatImageBook`.
       ``INB_LEFT``                        0x2 Place labels on the left side. Available only for :class:`FlatImageBook`.
       ``INB_RIGHT``                       0x4 Place labels on the right side.
       ``INB_TOP``                         0x8 Place labels above the page area.
       ``INB_BORDER``                     0x10 Draws a border around :class:`LabelBook` or :class:`FlatImageBook`.
       ``INB_SHOW_ONLY_TEXT``             0x20 Shows only text labels and no images. Available only for :class:`LabelBook`.
       ``INB_SHOW_ONLY_IMAGES``           0x40 Shows only tab images and no label texts. Available only for :class:`LabelBook`.
       ``INB_FIT_BUTTON``                 0x80 Displays a pin button to show/hide the book control.
       ``INB_DRAW_SHADOW``               0x100 Draw shadows below the book tabs. Available only for :class:`LabelBook`.
       ``INB_USE_PIN_BUTTON``            0x200 Displays a pin button to show/hide the book control.
       ``INB_GRADIENT_BACKGROUND``       0x400 Draws a gradient shading on the tabs background. Available only for :class:`LabelBook`.
       ``INB_WEB_HILITE``                0x800 On mouse hovering, tabs behave like html hyperlinks. Available only for :class:`LabelBook`.
       ``INB_NO_RESIZE``                0x1000 Don't allow resizing of the tab area.
       ``INB_FIT_LABELTEXT``            0x2000 Will fit the tab area to the longest text (or text+image if you have images) in all the tabs.
       ``INB_BOLD_TAB_SELECTION``       0x4000 Show the selected tab text using a bold font.
       =========================== =========== ==================================================
      
      :param `name`: the window name.


   .. method:: AddPage(self, caption, selected=False, imgIdx=-1)

      Adds a page to the container.
      
      :param `caption`: specifies the text for the new tab;
      :param `selected`: specifies whether the page should be selected;
      :param `imgIdx`: specifies the optional image index for the new tab.


   .. method:: AssignImageList(self, imglist)

      Assigns an image list to the :class:`wx.ImageContainerBase`.
      
      :param `imglist`: an instance of :class:`wx.ImageList`.


   .. method:: CanDoBottomStyle(self)

      Allows the parent to examine the children type. Some implementation
      (such as :class:`LabelBook`), does not support top/bottom images, only left/right.


   .. method:: ClearAll(self)

      Deletes all the pages in the container. 


   .. method:: ClearFlag(self, flag)

      Removes flag from the style.
      
      :param `flag`: a window style flag.
      
      :see: :meth:`~ImageContainerBase.HasAGWFlag` for a list of possible window style flags.


   .. method:: DoDeletePage(self, page)

      Does the actual page deletion.
      
      :param `page`: the index of the tab.


   .. method:: DrawPin(self, dc, rect, downPin)

      Draw a pin button, that allows collapsing of the image panel.
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `rect`: the pin button client rectangle;
      :param `downPin`: ``True`` if the pin button is facing downwards, ``False``
       if it is facing leftwards.


   .. method:: EnableTab(self, page, enabled=True)

      Enables or disables a tab.
      
      :param `page`: an integer specifying the page index;
      :param `enabled`: ``True`` to enable a tab, ``False`` to disable it.


   .. method:: FixTextSize(self, dc, text, maxWidth)

      Fixes the text, to fit `maxWidth` value. If the text length exceeds
      `maxWidth` value this function truncates it and appends two dots at
      the end. ("Long Long Long Text" might become "Long Long...").
      
      :param `dc`: an instance of :class:`wx.DC`;
      :param `text`: the text to fix/truncate;
      :param `maxWidth`: the maximum allowed width for the text, in pixels.


   .. method:: GetEnabled(self, page)

      Returns whether a tab is enabled or not.
      
      :param `page`: an integer specifying the page index.


   .. method:: GetImageList(self)

      Return the image list for :class:`wx.ImageContainerBase`. 


   .. method:: GetImageSize(self)

      Returns the image size inside the :class:`wx.ImageContainerBase` image list. 


   .. method:: GetPageImage(self, page)

      Returns the image index for the given page.
      
      :param `page`: the index of the tab.


   .. method:: GetPageText(self, page)

      Returns the tab caption for the given page.
      
      :param `page`: the index of the tab.


   .. method:: HasAGWFlag(self, flag)

      Tests for existence of flag in the style.
      
      :param `flag`: a window style. This can be a combination of the following bits:
      
       =========================== =========== ==================================================
       Window Styles               Hex Value   Description
       =========================== =========== ==================================================
       ``INB_BOTTOM``                      0x1 Place labels below the page area. Available only for :class:`FlatImageBook`.
       ``INB_LEFT``                        0x2 Place labels on the left side. Available only for :class:`FlatImageBook`.
       ``INB_RIGHT``                       0x4 Place labels on the right side.
       ``INB_TOP``                         0x8 Place labels above the page area.
       ``INB_BORDER``                     0x10 Draws a border around :class:`LabelBook` or :class:`FlatImageBook`.
       ``INB_SHOW_ONLY_TEXT``             0x20 Shows only text labels and no images. Available only for :class:`LabelBook`.
       ``INB_SHOW_ONLY_IMAGES``           0x40 Shows only tab images and no label texts. Available only for :class:`LabelBook`.
       ``INB_FIT_BUTTON``                 0x80 Displays a pin button to show/hide the book control.
       ``INB_DRAW_SHADOW``               0x100 Draw shadows below the book tabs. Available only for :class:`LabelBook`.
       ``INB_USE_PIN_BUTTON``            0x200 Displays a pin button to show/hide the book control.
       ``INB_GRADIENT_BACKGROUND``       0x400 Draws a gradient shading on the tabs background. Available only for :class:`LabelBook`.
       ``INB_WEB_HILITE``                0x800 On mouse hovering, tabs behave like html hyperlinks. Available only for :class:`LabelBook`.
       ``INB_NO_RESIZE``                0x1000 Don't allow resizing of the tab area.
       ``INB_FIT_LABELTEXT``            0x2000 Will fit the tab area to the longest text (or text+image if you have images) in all the tabs.
       ``INB_BOLD_TAB_SELECTION``       0x4000 Show the selected tab text using a bold font.
       =========================== =========== ==================================================


   .. method:: HitTest(self, pt)

      Returns the index of the tab at the specified position or ``wx.NOT_FOUND``
      if ``None``, plus the flag style of :meth:`~ImageContainerBase.HitTest`.
      
      :param `pt`: an instance of :class:`wx.Point`, to test for hits.
      
      :return: The index of the tab at the specified position plus the hit test
       flag, which can be one of the following bits:
      
       ====================== ======= ================================
       HitTest Flags           Value  Description
       ====================== ======= ================================
       ``IMG_OVER_IMG``             0 The mouse is over the tab icon
       ``IMG_OVER_PIN``             1 The mouse is over the pin button
       ``IMG_OVER_EW_BORDER``       2 The mouse is over the east-west book border
       ``IMG_NONE``                 3 Nowhere
       ====================== ======= ================================


   .. method:: InsertPage(self, page_idx, caption, selected=False, imgIdx=-1)

      Inserts a page into the container at the specified position.
      
      :param `page_idx`: specifies the position for the new tab;
      :param `caption`: specifies the text for the new tab;
      :param `selected`: specifies whether the page should be selected;
      :param `imgIdx`: specifies the optional image index for the new tab.


   .. method:: OnEraseBackground(self, event)

      Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`EraseEvent` event to be processed.
      
      :note: This method is intentionally empty to reduce flicker.


   .. method:: OnMouseLeaveWindow(self, event)

      Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeftDown(self, event)

      Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeftUp(self, event)

      Handles the ``wx.EVT_LEFT_UP`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseMove(self, event)

      Handles the ``wx.EVT_MOTION`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnSize(self, event)

      Handles the ``wx.EVT_SIZE`` event for :class:`wx.ImageContainerBase`.
      
      :param `event`: a :class:`wx.SizeEvent` event to be processed.


   .. method:: PointOnSash(self, pt)

      Tests whether pt is located on the sash.
      
      :param `pt`: an instance of :class:`wx.Point`, to test for hits.


   .. method:: SetPageImage(self, page, imgIdx)

      Sets the image for the given page.
      
      :param `page`: the index of the tab;
      :param `imgIdx`: specifies the optional image index for the tab.


   .. method:: SetPageText(self, page, text)

      Sets the tab caption for the given page.
      
      :param `page`: the index of the tab;
      :param `text`: the new tab caption.


