wx.lib.checkbox.GenCheckBox¶
A generic class that replicates some of the functionalities of wx.Checkbox
,
while being completely owner-drawn with a nice check bitmaps.
Class Hierarchy¶
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Overridden base class virtual. |
|
Overridden base class virtual. |
|
Overridden base class virtual. Determines the best size of the control |
|
Actually performs the drawing operations, for the bitmap and |
|
Enables/Disables |
|
Returns the appropriated bitmap depending on the checking state |
|
Overridden base class virtual. By default we should use |
|
Returns the spacing between the check bitmap and the text. |
|
Returns the state of |
|
Returns whether or not we have the focus. |
|
Initializes the check bitmaps. |
|
Initializes the focus indicator pen. |
|
This is just a maybe more readable synonym for GetValue: just as the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Actually sends the wx.wxEVT_COMMAND_CHECKBOX_CLICKED event. |
|
Overridden base class virtual. |
|
Sets the |
|
Overridden base class virtual. |
|
Sets the |
|
Sets a new spacing between the check bitmap and the text. |
|
Sets the |
|
Overridden base class virtual. If the parent has non-default |
Class API¶
- class GenCheckBox(wx.Control)¶
A generic class that replicates some of the functionalities of
wx.Checkbox
, while being completely owner-drawn with a nice check bitmaps.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, label='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name='GenCheckBox')¶
Default class constructor.
- Parameters:
parent (
wx.Window
) – Pointer to a parent window. Must not beNone
.id (int) – Window identifier.
wx.ID_ANY
indicates a default value.label (str) – Text to be displayed next to the checkbox.
pos (
wx.Point
) – Window position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.size (
wx.Size
) – Window size. The valuewx.DefaultSize
indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.style (long) – Window style. Not used in this widget, GenCheckBox has only 2 state.
validator (
wx.Validator
) – Window validator.name (str) – Window name.
- AcceptsFocus(self)¶
Overridden base class virtual.
- AcceptsFocusFromKeyboard(self)¶
Overridden base class virtual.
- DoGetBestSize(self)¶
Overridden base class virtual. Determines the best size of the control based on the label size, the bitmap size and the current font.
- Draw(self, dc)¶
Actually performs the drawing operations, for the bitmap and for the text, positioning them centered vertically.
- Parameters:
dc (
wx.DC
) – device context to use.
- Enable(self, enable=True)¶
Enables/Disables
GenCheckBox
.- Parameters:
enable (bool) – Set the enabled state of the checkbox.
- GetBitmap(self)¶
Returns the appropriated bitmap depending on the checking state (Checked/UnChecked) and the control state (Enabled/Disabled).
- GetDefaultAttributes(self)¶
Overridden base class virtual. By default we should use the same font/colour attributes as the native wx.CheckBox.
- GetSpacing(self)¶
Returns the spacing between the check bitmap and the text.
- GetValue(self)¶
Returns the state of
GenCheckBox
,True
if checked,False
otherwise.
- HasFocus(self)¶
Returns whether or not we have the focus.
- InitializeBitmaps(self)¶
Initializes the check bitmaps.
- InitializeColours(self)¶
Initializes the focus indicator pen.
- IsChecked(self)¶
This is just a maybe more readable synonym for GetValue: just as the latter, it returns
True
if theGenCheckBox
is checked andFalse
otherwise.
- OnKeyEvent(self, event)¶
Handles the
wx.EVT_KEY_UP
orwx.EVT_KEY_UP
event (depending on platform) forGenCheckBox
.- Parameters:
event (
wx.KeyEvent
) – Awx.KeyEvent
to be processed.
- OnKillFocus(self, event)¶
Handles the
wx.EVT_KILL_FOCUS
event forGenCheckBox
.- Parameters:
event (
wx.FocusEvent
) – Awx.FocusEvent
to be processed.
- OnMouseClick(self, event)¶
Handles the
wx.EVT_LEFT_DOWN
event forGenCheckBox
.- Parameters:
event (
wx.MouseEvent
) – Awx.MouseEvent
to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINT
event forGenCheckBox
.- Parameters:
event (
wx.PaintEvent
) – Awx.PaintEvent
to be processed.
- OnSetFocus(self, event)¶
Handles the
wx.EVT_SET_FOCUS
event forGenCheckBox
.- Parameters:
event (
wx.FocusEvent
) – Awx.FocusEvent
to be processed.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZE
event forGenCheckBox
.- Parameters:
event (
wx.SizeEvent
) – Awx.SizeEvent
to be processed.
- SendCheckBoxEvent(self)¶
Actually sends the wx.wxEVT_COMMAND_CHECKBOX_CLICKED event.
- SetBackgroundColour(self, colour)¶
Overridden base class virtual.
- Parameters:
colour (
wx.Colour
) – Set the background colour of the checkbox.
- SetFont(self, font)¶
Sets the
GenCheckBox
text font and updates the control’s size to exactly fit the label plus the bitmap.- Parameters:
font (
wx.Font
) – Font to be used to render the checkboxs label.
- SetForegroundColour(self, colour)¶
Overridden base class virtual.
- Parameters:
colour (
wx.Colour
) – Set the foreground colour of the checkboxs label.
- SetLabel(self, label)¶
Sets the
GenCheckBox
text label and updates the control’s size to exactly fit the label plus the bitmap.- Parameters:
label (str) – Text to be displayed next to the checkbox.
- SetSpacing(self, spacing)¶
Sets a new spacing between the check bitmap and the text.
- Parameters:
spacing (int) – Set the amount of space between the checkboxs bitmap and text.
- SetValue(self, state)¶
Sets the
GenCheckBox
to the given state. This does not cause awx.wxEVT_COMMAND_CHECKBOX_CLICKED
event to get emitted.- Parameters:
state (bool) – Set the value of the checkbox.
True
or False.
- ShouldInheritColours(self)¶
Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them.