wx.lib.agw.foldpanelbar.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.
Class Hierarchy¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Applies the style defined in cbstyle to the |
|
This sets the internal state/representation to collapsed. |
|
Returns the best size for this panel, based upon the font |
|
Gradient fill from colour 1 to colour 2 from left to right. |
|
Single colour fill for |
|
Single rectangle for |
|
Gradient fill from colour 1 to colour 2 from top to bottom. |
|
This sets the internal state/representation to expanded. |
|
Fills the background of the caption with either a gradient or |
|
Returns the current style of the captionbar in a |
|
Returns whether the status of the bar is expanded or collapsed. |
|
Returns whether the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Redraws the icons (if they exists). |
|
Sets the |
|
Sets |
|
Sets the |
|
Sets the amount of pixels on the right from which the bitmap |
Class API¶
- class CaptionBar(wx.Window)¶
This class is a graphical caption component that consists of a caption and a clickable arrow.
The
CaptionBarfires an eventEVT_CAPTIONBARwhich is aCaptionBarEvent. 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.
Methods¶
- __init__(self, parent, id, pos, size, caption='', foldIcons=None, cbstyle=None, rightIndent=FPB_BMP_RIGHTSPACE, iconWidth=16, iconHeight=16, collapsed=False)¶
Default class constructor.
- Parameters:
parent – the
CaptionBarparent 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.ImageListcontaining the icons to display next to the caption text;cbstyle – the
CaptionBarwindow style. Must be an instance ofCaptionBarStyle;rightIndent – number of pixels of the bmp to be aligned from the right filled with space;
iconWidth – the
CaptionBaricon width;iconHeight – the
CaptionBaricon height;collapsed –
Trueif theCaptionBarshould start in the collapsed state,Falseotherwise.
- ApplyCaptionStyle(self, cbstyle=None, applyDefault=True)¶
Applies the style defined in cbstyle to the
CaptionBar.- Parameters:
cbstyle – an instance of
CaptionBarStyle;applyDefault – if
True, the colours used in theCaptionBarStylewill be reset to their default values.
- Collapse(self)¶
This sets the internal state/representation to collapsed.
Note
This does not trigger a
CaptionBarEventto be sent to the parent.
- DoGetBestSize(self)¶
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(self, dc, rect)¶
Gradient fill from colour 1 to colour 2 from left to right.
- Parameters:
dc – an instance of
wx.DC;rect – the
CaptionBarclient rectangle.
- DrawSingleColour(self, dc, rect)¶
Single colour fill for
CaptionBar.- Parameters:
dc – an instance of
wx.DC;rect – the
CaptionBarclient rectangle.
- DrawSingleRectangle(self, dc, rect)¶
Single rectangle for
CaptionBar.- Parameters:
dc – an instance of
wx.DC;rect – the
CaptionBarclient rectangle.
- DrawVerticalGradient(self, dc, rect)¶
Gradient fill from colour 1 to colour 2 from top to bottom.
- Parameters:
dc – an instance of
wx.DC;rect – the
CaptionBarclient rectangle.
- Expand(self)¶
This sets the internal state/representation to expanded.
Note
This does not trigger a
CaptionBarEventto be sent to the parent.
- FillCaptionBackground(self, dc)¶
Fills the background of the caption with either a gradient or a solid colour.
- Parameters:
dc – an instance of
wx.DC.
- GetCaptionStyle(self)¶
Returns the current style of the captionbar in a
CaptionBarStyleclass.Note
This can be used to change and set back the changes.
- IsCollapsed(self)¶
Returns whether the status of the bar is expanded or collapsed.
- IsVertical(self)¶
Returns whether the
CaptionBarhas a default orientation or not. Default is vertical.
- OnChar(self, event)¶
Handles the
wx.EVT_CHARevent forCaptionBar.- Parameters:
event – a
KeyEventevent to be processed.
Note
This method currently does nothing.
- OnMouseEvent(self, event)¶
Handles the
wx.EVT_MOUSE_EVENTSevent forCaptionBar.- Parameters:
event – a
MouseEventevent 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(self, event)¶
Handles the
wx.EVT_PAINTevent forCaptionBar.- Parameters:
event – a
PaintEventevent to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZEevent forCaptionBar.- Parameters:
event – a
wx.SizeEventevent to be processed.
- RedrawIconBitmap(self)¶
Redraws the icons (if they exists).
- SetBoldFont(self)¶
Sets the
CaptionBarfont weight to bold.
- SetCaptionStyle(self, cbstyle=None, applyDefault=True)¶
Sets
CaptionBarstyles withCaptionBarStyleclass.- Parameters:
cbstyle – an instance of
CaptionBarStyle;applyDefault – if
True, the colours used in theCaptionBarStylewill 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 isFalse, the styles which are not set in theCaptionBarStylewill be ignored.
- SetNormalFont(self)¶
Sets the
CaptionBarfont weight to normal.
- SetRightIndent(self, pixels)¶
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.