AGW Logo

agw_title CaptionBar

This class is a graphical caption component that consists of a caption and a clickable arrow.

The CaptionBar fires an event EVT_CAPTIONBAR which is a 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.

hierarchy Inheritance Diagram

Inheritance diagram for: CaptionBar

Inheritance diagram of CaptionBar


method_summary Methods Summary

__init__Default class constructor.
ApplyCaptionStyleApplies the style defined in cbstyle to the CaptionBar.
CollapseThis sets the internal state/representation to collapsed.
DoGetBestSizeReturns the best size for this panel, based upon the font assigned to this window, and the caption string.
DrawHorizontalGradientGradient fill from colour 1 to colour 2 from left to right.
DrawSingleColourSingle colour fill for CaptionBar.
DrawSingleRectangleSingle rectangle for CaptionBar.
DrawVerticalGradientGradient fill from colour 1 to colour 2 from top to bottom.
ExpandThis sets the internal state/representation to expanded.
FillCaptionBackgroundFills the background of the caption with either a gradient or a solid colour.
GetCaptionStyleReturns the current style of the captionbar in a CaptionBarStyle class.
IsCollapsedReturns wether the status of the bar is expanded or collapsed.
IsVerticalReturns wether the CaptionBar has a default orientation or not.
OnCharHandles the wx.EVT_CHAR event for CaptionBar.
OnMouseEventHandles the wx.EVT_MOUSE_EVENTS event for CaptionBar.
OnPaintHandles the wx.EVT_PAINT event for CaptionBar.
OnSizeHandles the wx.EVT_SIZE event for CaptionBar.
RedrawIconBitmapRedraws the icons (if they exists).
SetBoldFontSets the CaptionBar font weight to bold.
SetCaptionStyleSets CaptionBar styles with CaptionBarStyle class.
SetNormalFontSets the CaptionBar font weight to normal.
SetRightIndentSets the amount of pixels on the right from which the bitmap is trailing.

API Class API

class CaptionBar(wx.Window)[source]

This class is a graphical caption component that consists of a caption and a clickable arrow.

The CaptionBar fires an event EVT_CAPTIONBAR which is a 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.



__init__(parent, id, pos, size, caption="", foldIcons=None, cbstyle=None, rightIndent=FPB_BMP_RIGHTSPACE, iconWidth=16, iconHeight=16, collapsed=False)[source]

Default class constructor.

Parameters:
  • parent – the CaptionBar parent window;
  • id – an identifier for the control: a value of -1 is taken to mean a default;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • caption – the string to be displayed in CaptionBar;
  • foldIcons – an instance of wx.ImageList containing the icons to display next to the caption text;
  • cbstyle – the CaptionBar window style. Must be an instance of CaptionBarStyle;
  • rightIndent – number of pixels of the bmp to be aligned from the right filled with space;
  • iconWidth – the CaptionBar icon width;
  • iconHeight – the CaptionBar icon height;
  • collapsedTrue if the CaptionBar should start in the collapsed state, False otherwise.


ApplyCaptionStyle(cbstyle=None, applyDefault=True)[source]

Applies the style defined in cbstyle to the CaptionBar.

Parameters:
  • cbstyle – an instance of CaptionBarStyle;
  • applyDefault – if True, the colours used in the CaptionBarStyle will be reset to their default values.


Collapse()[source]

This sets the internal state/representation to collapsed.

Note

This does not trigger a CaptionBarEvent to be sent to the parent.



DoGetBestSize()[source]

Returns the best size for this panel, based upon the font assigned to this window, and the caption string.

Note

Overridden from wx.Window.



DrawHorizontalGradient(dc, rect)[source]

Gradient fill from colour 1 to colour 2 from left to right.

Parameters:


DrawSingleColour(dc, rect)[source]

Single colour fill for CaptionBar.

Parameters:


DrawSingleRectangle(dc, rect)[source]

Single rectangle for CaptionBar.

Parameters:


DrawVerticalGradient(dc, rect)[source]

Gradient fill from colour 1 to colour 2 from top to bottom.

Parameters:


Expand()[source]

This sets the internal state/representation to expanded.

Note

This does not trigger a CaptionBarEvent to be sent to the parent.



FillCaptionBackground(dc)[source]

Fills the background of the caption with either a gradient or a solid colour.

Parameters:dc – an instance of wx.DC.



GetCaptionStyle()[source]

Returns the current style of the captionbar in a CaptionBarStyle class.

Note

This can be used to change and set back the changes.



IsCollapsed()[source]

Returns wether the status of the bar is expanded or collapsed.



IsVertical()[source]

Returns wether the CaptionBar has a default orientation or not. Default is vertical.



OnChar(event)[source]

Handles the wx.EVT_CHAR event for CaptionBar.

Parameters:event – a wx.KeyEvent event to be processed.

Note

This method currently does nothing.



OnMouseEvent(event)[source]

Handles the wx.EVT_MOUSE_EVENTS event for CaptionBar.

Parameters:event – a wx.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.



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for CaptionBar.

Parameters:event – a wx.PaintEvent event to be processed.


OnSize(event)[source]

Handles the wx.EVT_SIZE event for CaptionBar.

Parameters:event – a wx.SizeEvent event to be processed.


RedrawIconBitmap()[source]

Redraws the icons (if they exists).



SetBoldFont()[source]

Sets the CaptionBar font weight to bold.



SetCaptionStyle(cbstyle=None, applyDefault=True)[source]

Sets CaptionBar styles with CaptionBarStyle class.

Parameters:
  • cbstyle – an instance of CaptionBarStyle;
  • applyDefault – if True, the colours used in the 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 CaptionBarStyle will be ignored.



SetNormalFont()[source]

Sets the CaptionBar font weight to normal.



SetRightIndent(pixels)[source]

Sets the amount of pixels on the right from which the bitmap is trailing.

Parameters: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.
Tree

Table Of Contents

Previous topic

foldpanelbar

Next topic

CaptionBarEvent