.. 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.flatnotebook
.. highlight:: python
.. _wx.lib.agw.flatnotebook.PageContainer:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.flatnotebook.PageContainer**
==========================================================================================================================================
This class acts as a container for the pages you add to :class:`FlatNotebook`.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
PageContainer:
|
|super_classes| Known Superclasses
==================================
:class:`wx.Panel`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatnotebook.PageContainer.__init__` Default class constructor.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.AddPage` Adds a page to the :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.AdvanceSelection` Cycles through the tabs.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.AssignImageList` Assigns the image list for the :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.CanFitToScreen` Returns whether a tab can fit in the left space in the screen or not.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.ClearAGWFlag` Deletes a flag from the :class:`FlatNotebook` style.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.DeleteAllPages` Deletes all the pages in the :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.DeletePage` Delete the specified page from :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.DoDeletePage` Does the actual page deletion.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.DoSetSelection` Does the actual selection of a page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.DrawDragHint` Draws small arrow at the place that the tab will be placed.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.EnableTab` Enables or disables a tab.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.FireEvent` Fires the ``EVT_FLATNOTEBOOK_PAGE_CHANGING`` and ``EVT_FLATNOTEBOOK_PAGE_CHANGED``
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetAGWWindowStyleFlag` Returns the :class:`FlatNotebook` window style.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetEnabled` Returns whether a tab is enabled or not.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetImageList` Returns the image list for the page control.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetLastVisibleTab` Returns the last visible tab in the tab area.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetNumOfVisibleTabs` Returns the number of visible tabs.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetNumTabsCanScrollLeft` Returns the number of tabs than can be scrolled left.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetPageCount` Returns the number of tabs in the :class:`FlatNotebook` control.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetPageImage` Returns the image index associated to a page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetPageText` Returns the tab caption of the page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetPageTextColour` Returns the tab text colour if it has been set previously, or ``None`` otherwise.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetSelection` Returns the current selected page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.GetSingleLineBorderColour` Returns the colour for the single line border.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.HasAGWFlag` Returns whether a flag is present in the :class:`FlatNotebook` style.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.HitTest` HitTest method for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.InsertPage` Inserts a new page at the specified position.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.IsDefaultTabs` Returns whether a tab has a default style.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.IsMouseHovering` Returns whether or not the mouse is hovering over this page's tab
:meth:`~wx.lib.agw.flatnotebook.PageContainer.IsTabVisible` Returns whether a tab is visible or not.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.MoveTabPage` Moves a tab inside the same :class:`FlatNotebook`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnDropTarget` Handles the drop action from a drag and drop operation.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnKeyDown` Handles the ``wx.EVT_KEY_DOWN`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnKillFocus` Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnLeftDClick` Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnLeftDown` Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnLeftUp` Handles the ``wx.EVT_LEFT_UP`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnMiddleDown` Handles the ``wx.EVT_MIDDLE_DOWN`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnMouseEnterWindow` Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnMouseLeave` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnMouseMove` Handles the ``wx.EVT_MOTION`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnMouseWheel` Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnRightDown` Handles the ``wx.EVT_RIGHT_DOWN`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnSetFocus` Handles the ``wx.EVT_SET_FOCUS`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.OnTabMenuSelection` Handles the ``wx.EVT_MENU`` event for :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.PopupTabsMenu` Pops up the menu activated with the drop down arrow in the navigation area.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.RotateLeft` Scrolls tabs to the left by bulk of 5 tabs.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.RotateRight` Scrolls tabs to the right by bulk of 5 tabs.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetAGWWindowStyleFlag` Sets the :class:`FlatNotebook` window style.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetFocusedPage` Sets/Unsets the focus on the appropriate page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetImageList` Sets the image list for the :class:`PageContainer`.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetPageImage` Sets the image index for the given page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetPageText` Sets the tab caption of the page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetPageTextColour` Sets the tab text colour individually.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.SetSelection` Sets the selected page.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.ShowTabTooltip` Shows a tab tooltip.
:meth:`~wx.lib.agw.flatnotebook.PageContainer.TabHasImage` Returns whether a tab has an associated image index or not.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: PageContainer(wx.Panel)
This class acts as a container for the pages you add to :class:`FlatNotebook`.
.. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0)
Default class constructor.
Used internally, do not call it in your code!
:param `parent`: the :class:`PageContainer` parent;
:param `id`: an identifier for the control: a value of -1 is taken to mean a default;
: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 window style.
.. method:: AddPage(self, caption, selected=False, imgindex=-1)
Adds a page to the :class:`PageContainer`.
:param `page`: specifies the new page;
:param `text`: specifies the text for the new page;
:param `select`: specifies whether the page should be selected;
:param `imageId`: specifies the optional image index for the new page.
.. method:: AdvanceSelection(self, forward=True)
Cycles through the tabs.
:param `forward`: if ``True``, the selection is advanced in ascending order
(to the right), otherwise the selection is advanced in descending order.
.. note:: The call to this function generates the page changing events.
.. method:: AssignImageList(self, imglist)
Assigns the image list for the :class:`PageContainer`.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: CanFitToScreen(self, page)
Returns whether a tab can fit in the left space in the screen or not.
:param `page`: an integer specifying the page index.
.. method:: ClearAGWFlag(self, flag)
Deletes a flag from the :class:`FlatNotebook` style.
:param `flag`: one of the possible :class:`FlatNotebook` window styles.
.. seealso:: :meth:`FlatNotebook.SetAGWWindowStyleFlag() ` for a list of possible window
style flags.
.. method:: DeleteAllPages(self)
Deletes all the pages in the :class:`PageContainer`.
.. method:: DeletePage(self, page)
Delete the specified page from :class:`PageContainer`.
:param `page`: an integer specifying the page index.
.. method:: DoDeletePage(self, page)
Does the actual page deletion.
:param `page`: an integer specifying the page index.
.. method:: DoSetSelection(self, page)
Does the actual selection of a page.
:param `page`: an integer specifying the page index.
.. method:: DrawDragHint(self)
Draws small arrow at the place that the tab will be placed.
.. 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:: FireEvent(self, selection)
Fires the ``EVT_FLATNOTEBOOK_PAGE_CHANGING`` and ``EVT_FLATNOTEBOOK_PAGE_CHANGED``
events called from other methods (from menu selection or `Smart Tabbing`).
This is an utility function.
:param `selection`: the new selection inside :class:`FlatNotebook`.
.. method:: GetAGWWindowStyleFlag(self)
Returns the :class:`FlatNotebook` window style.
.. seealso:: The :meth:`FlatNotebook.__init__() ` method for the `agwStyle` parameter description.
.. method:: GetEnabled(self, page)
Returns whether a tab is enabled or not.
:param `page`: an integer specifying the page index.
.. method:: GetImageList(self)
Returns the image list for the page control.
.. method:: GetLastVisibleTab(self)
Returns the last visible tab in the tab area.
.. method:: GetNumOfVisibleTabs(self)
Returns the number of visible tabs.
.. method:: GetNumTabsCanScrollLeft(self)
Returns the number of tabs than can be scrolled left.
.. method:: GetPageCount(self)
Returns the number of tabs in the :class:`FlatNotebook` control.
.. method:: GetPageImage(self, page)
Returns the image index associated to a page.
:param `page`: an integer specifying the page index.
.. method:: GetPageText(self, page)
Returns the tab caption of the page.
:param `page`: an integer specifying the page index.
.. method:: GetPageTextColour(self, page)
Returns the tab text colour if it has been set previously, or ``None`` otherwise.
:param `page`: an integer specifying the page index.
.. method:: GetSelection(self)
Returns the current selected page.
.. method:: GetSingleLineBorderColour(self)
Returns the colour for the single line border.
.. method:: HasAGWFlag(self, flag)
Returns whether a flag is present in the :class:`FlatNotebook` style.
:param `flag`: one of the possible :class:`FlatNotebook` window styles.
.. seealso:: :meth:`FlatNotebook.SetAGWWindowStyleFlag() ` for a list of possible window
style flags.
.. method:: HitTest(self, pt)
HitTest method for :class:`PageContainer`.
:param `pt`: an instance of :class:`wx.Point`, to test for hits.
:return: The hit test flag (if any) and the hit page index (if any). The return
value can be one of the following bits:
========================= ======= =================================
HitTest Flag Value Description
========================= ======= =================================
``FNB_NOWHERE`` 0 Indicates mouse coordinates not on any tab of the notebook
``FNB_TAB`` 1 Indicates mouse coordinates inside a tab
``FNB_X`` 2 Indicates mouse coordinates inside the 'X' button region
``FNB_TAB_X`` 3 Indicates mouse coordinates inside the 'X' region in a tab
``FNB_LEFT_ARROW`` 4 Indicates mouse coordinates inside the left arrow region
``FNB_RIGHT_ARROW`` 5 Indicates mouse coordinates inside the right arrow region
``FNB_DROP_DOWN_ARROW`` 6 Indicates mouse coordinates inside the drop down arrow region
========================= ======= =================================
.. method:: InsertPage(self, indx, text, selected=True, imgindex=-1)
Inserts a new page at the specified position.
:param `indx`: specifies the position of the new page;
:param `page`: specifies the new page;
:param `text`: specifies the text for the new page;
:param `select`: specifies whether the page should be selected;
:param `imageId`: specifies the optional image index for the new page.
.. method:: IsDefaultTabs(self)
Returns whether a tab has a default style.
.. method:: IsMouseHovering(self, page)
Returns whether or not the mouse is hovering over this page's tab
:param `page`: an integer specifying the page index.
.. method:: IsTabVisible(self, page)
Returns whether a tab is visible or not.
:param `page`: an integer specifying the page index.
.. method:: MoveTabPage(self, nMove, nMoveTo)
Moves a tab inside the same :class:`FlatNotebook`.
:param `nMove`: the start index of the moved tab;
:param `nMoveTo`: the destination index of the moved tab.
.. method:: OnDropTarget(self, x, y, nTabPage, wnd_oldContainer)
Handles the drop action from a drag and drop operation.
:param `x`: the x position of the drop action;
:param `y`: the y position of the drop action;
:param `nTabPage`: the index of the tab being dropped;
:param `wnd_oldContainer`: the :class:`FlatNotebook` to which the dropped tab previously
belonged to.
.. method:: OnEraseBackground(self, event)
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PageContainer`.
:param `event`: a :class:`EraseEvent` event to be processed.
.. note:: This method is intentionally empty to reduce flicker.
.. method:: OnKeyDown(self, event)
Handles the ``wx.EVT_KEY_DOWN`` event for :class:`PageContainer`.
:param `event`: a :class:`KeyEvent` event to be processed.
.. note:: When the :class:`PageContainer` has the focus tabs can be changed with
the left/right arrow keys.
.. method:: OnKillFocus(self, event)
Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`PageContainer`.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnLeftDClick(self, event)
Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnLeftDown(self, event)
Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnLeftUp(self, event)
Handles the ``wx.EVT_LEFT_UP`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMiddleDown(self, event)
Handles the ``wx.EVT_MIDDLE_DOWN`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMouseEnterWindow(self, event)
Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMouseLeave(self, event)
Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMouseMove(self, event)
Handles the ``wx.EVT_MOTION`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMouseWheel(self, event)
Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPaint(self, event)
Handles the ``wx.EVT_PAINT`` event for :class:`PageContainer`.
:param `event`: a :class:`PaintEvent` event to be processed.
.. method:: OnRightDown(self, event)
Handles the ``wx.EVT_RIGHT_DOWN`` event for :class:`PageContainer`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnSetFocus(self, event)
Handles the ``wx.EVT_SET_FOCUS`` event for :class:`PageContainer`.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnSize(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`PageContainer`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: OnTabMenuSelection(self, event)
Handles the ``wx.EVT_MENU`` event for :class:`PageContainer`.
:param `event`: a :class:`wx.MenuEvent` event to be processed.
.. method:: PopupTabsMenu(self)
Pops up the menu activated with the drop down arrow in the navigation area.
.. method:: RotateLeft(self)
Scrolls tabs to the left by bulk of 5 tabs.
.. method:: RotateRight(self)
Scrolls tabs to the right by bulk of 5 tabs.
.. method:: SetAGWWindowStyleFlag(self, agwStyle)
Sets the :class:`FlatNotebook` window style.
:param `agwStyle`: the new :class:`FlatNotebook` window style.
.. seealso:: The :meth:`FlatNotebook.__init__() ` method for the `agwStyle` parameter description.
.. method:: SetFocusedPage(self, pageIndex=-1)
Sets/Unsets the focus on the appropriate page.
:param `pageIndex`: an integer specifying the page index. If `pageIndex`
is defaulted to -1, we have lost focus and no focus indicator is drawn.
.. method:: SetImageList(self, imglist)
Sets the image list for the :class:`PageContainer`.
:param `imageList`: an instance of :class:`wx.ImageList`.
.. method:: SetPageImage(self, page, image)
Sets the image index for the given page.
:param `page`: an integer specifying the page index;
:param `image`: an index into the image list which was set with :meth:`~PageContainer.SetImageList`.
.. method:: SetPageText(self, page, text)
Sets the tab caption of the page.
:param `page`: an integer specifying the page index;
:param `text`: the new tab label.
.. method:: SetPageTextColour(self, page, colour)
Sets the tab text colour individually.
:param `page`: an integer specifying the page index;
:param `colour`: a valid :class:`wx.Colour` object or any typemap supported by wxWidgets/wxPython
to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple). You can
pass ``None`` or :class:`NullColour` to return to the default page text colour.
.. method:: SetSelection(self, page)
Sets the selected page.
:param `page`: an integer specifying the page index.
.. method:: ShowTabTooltip(self, tabIdx)
Shows a tab tooltip.
:param `tabIdx`: an integer specifying the page index.
.. method:: TabHasImage(self, tabIdx)
Returns whether a tab has an associated image index or not.
:param `tabIdx`: an integer specifying the page index.