.. 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.foldpanelbar .. highlight:: python .. _wx.lib.agw.foldpanelbar.CaptionBar: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.foldpanelbar.CaptionBar** ========================================================================================================================================== This class is a graphical caption component that consists of a caption and a clickable arrow. The :class:`CaptionBar` fires an event ``EVT_CAPTIONBAR`` which is a :class:`CaptionBarEvent`. This event can be caught and the parent window can act upon the collapsed or expanded state of the bar (which is actually just the icon which changed). The parent panel can reduce size or expand again. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class CaptionBar:
| |super_classes| Known Superclasses ================================== :class:`wx.Window` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.__init__` Default class constructor. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.ApplyCaptionStyle` Applies the style defined in `cbstyle` to the :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.Collapse` This sets the internal state/representation to collapsed. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.DoGetBestSize` Returns the best size for this panel, based upon the font :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.DrawHorizontalGradient` Gradient fill from colour 1 to colour 2 from left to right. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.DrawSingleColour` Single colour fill for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.DrawSingleRectangle` Single rectangle for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.DrawVerticalGradient` Gradient fill from colour 1 to colour 2 from top to bottom. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.Expand` This sets the internal state/representation to expanded. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.FillCaptionBackground` Fills the background of the caption with either a gradient or :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.GetCaptionStyle` Returns the current style of the captionbar in a :class:`CaptionBarStyle` class. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.IsCollapsed` Returns whether the status of the bar is expanded or collapsed. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.IsVertical` Returns whether the :class:`CaptionBar` has a default orientation or not. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.OnChar` Handles the ``wx.EVT_CHAR`` event for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.OnMouseEvent` Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`CaptionBar`. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.RedrawIconBitmap` Redraws the icons (if they exists). :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.SetBoldFont` Sets the :class:`CaptionBar` font weight to bold. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.SetCaptionStyle` Sets :class:`CaptionBar` styles with :class:`CaptionBarStyle` class. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.SetNormalFont` Sets the :class:`CaptionBar` font weight to normal. :meth:`~wx.lib.agw.foldpanelbar.CaptionBar.SetRightIndent` Sets the amount of pixels on the right from which the bitmap ================================================================================ ================================================================================ | |api| Class API =============== .. class:: CaptionBar(wx.Window) This class is a graphical caption component that consists of a caption and a clickable arrow. The :class:`CaptionBar` fires an event ``EVT_CAPTIONBAR`` which is a :class:`CaptionBarEvent`. This event can be caught and the parent window can act upon the collapsed or expanded state of the bar (which is actually just the icon which changed). The parent panel can reduce size or expand again. .. method:: __init__(self, parent, id, pos, size, caption="", foldIcons=None, cbstyle=None, rightIndent=FPB_BMP_RIGHTSPACE, iconWidth=16, iconHeight=16, collapsed=False) Default class constructor. :param `parent`: the :class:`CaptionBar` parent window; :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 `caption`: the string to be displayed in :class:`CaptionBar`; :param `foldIcons`: an instance of :class:`wx.ImageList` containing the icons to display next to the caption text; :param `cbstyle`: the :class:`CaptionBar` window style. Must be an instance of :class:`CaptionBarStyle`; :param `rightIndent`: number of pixels of the bmp to be aligned from the right filled with space; :param `iconWidth`: the :class:`CaptionBar` icon width; :param `iconHeight`: the :class:`CaptionBar` icon height; :param `collapsed`: ``True`` if the :class:`CaptionBar` should start in the collapsed state, ``False`` otherwise. .. method:: ApplyCaptionStyle(self, cbstyle=None, applyDefault=True) Applies the style defined in `cbstyle` to the :class:`CaptionBar`. :param `cbstyle`: an instance of :class:`CaptionBarStyle`; :param `applyDefault`: if ``True``, the colours used in the :class:`CaptionBarStyle` will be reset to their default values. .. method:: Collapse(self) This sets the internal state/representation to collapsed. .. note:: This does not trigger a :class:`CaptionBarEvent` to be sent to the parent. .. method:: DoGetBestSize(self) Returns the best size for this panel, based upon the font assigned to this window, and the caption string. .. note:: Overridden from :class:`wx.Window`. .. method:: DrawHorizontalGradient(self, dc, rect) Gradient fill from colour 1 to colour 2 from left to right. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the :class:`CaptionBar` client rectangle. .. method:: DrawSingleColour(self, dc, rect) Single colour fill for :class:`CaptionBar`. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the :class:`CaptionBar` client rectangle. .. method:: DrawSingleRectangle(self, dc, rect) Single rectangle for :class:`CaptionBar`. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the :class:`CaptionBar` client rectangle. .. method:: DrawVerticalGradient(self, dc, rect) Gradient fill from colour 1 to colour 2 from top to bottom. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the :class:`CaptionBar` client rectangle. .. method:: Expand(self) This sets the internal state/representation to expanded. .. note:: This does not trigger a :class:`CaptionBarEvent` to be sent to the parent. .. method:: FillCaptionBackground(self, dc) Fills the background of the caption with either a gradient or a solid colour. :param `dc`: an instance of :class:`wx.DC`. .. method:: GetCaptionStyle(self) Returns the current style of the captionbar in a :class:`CaptionBarStyle` class. .. note:: This can be used to change and set back the changes. .. method:: IsCollapsed(self) Returns whether the status of the bar is expanded or collapsed. .. method:: IsVertical(self) Returns whether the :class:`CaptionBar` has a default orientation or not. Default is vertical. .. method:: OnChar(self, event) Handles the ``wx.EVT_CHAR`` event for :class:`CaptionBar`. :param `event`: a :class:`KeyEvent` event to be processed. .. note:: This method currently does nothing. .. method:: OnMouseEvent(self, event) Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`CaptionBar`. :param `event`: a :class:`MouseEvent` event to be processed. .. note:: This method catches the mouse click-double click. If clicked on the arrow (single) or double on the caption we change state and an event must be fired to let this panel collapse or expand. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`CaptionBar`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnSize(self, event) Handles the ``wx.EVT_SIZE`` event for :class:`CaptionBar`. :param `event`: a :class:`wx.SizeEvent` event to be processed. .. method:: RedrawIconBitmap(self) Redraws the icons (if they exists). .. method:: SetBoldFont(self) Sets the :class:`CaptionBar` font weight to bold. .. method:: SetCaptionStyle(self, cbstyle=None, applyDefault=True) Sets :class:`CaptionBar` styles with :class:`CaptionBarStyle` class. :param `cbstyle`: an instance of :class:`CaptionBarStyle`; :param `applyDefault`: if ``True``, the colours used in the :class:`CaptionBarStyle` will be reset to their default values. .. note:: All styles that are actually set, are applied. If you set `applyDefault` to ``True``, all other (not defined) styles will be set to default. If it is ``False``, the styles which are not set in the :class:`CaptionBarStyle` will be ignored. .. method:: SetNormalFont(self) Sets the :class:`CaptionBar` font weight to normal. .. method:: SetRightIndent(self, pixels) Sets the amount of pixels on the right from which the bitmap is trailing. :param `pixels`: the number of pixels on the right from which the bitmap is trailing. If this is 0, it will be drawn all the way to the right, default is equal to ``FPB_BMP_RIGHTSPACE``. Assign this before assigning an image list to prevent a redraw.