A generic class that replicates some of the functionalities of wx.Checkbox
,
while being completely owner-drawn with a nice check bitmaps.
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 |
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.
__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.
parent (wx.Window
) – Pointer to a parent window. Must not be None
.
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 value wx.DefaultPosition
indicates
a default position, chosen by either the windowing system or wxWidgets, depending on platform.
size (wx.Size
) – Window size. The value wx.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.
dc (wx.DC
) – device context to use.
Enable
(self, enable=True)¶Enables/Disables GenCheckBox
.
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 the GenCheckBox
is checked and False
otherwise.
OnKeyEvent
(self, event)¶Handles the wx.EVT_KEY_UP
or wx.EVT_KEY_UP
event (depending on
platform) for GenCheckBox
.
event (wx.KeyEvent
) – A wx.KeyEvent
to be processed.
OnKillFocus
(self, event)¶Handles the wx.EVT_KILL_FOCUS
event for GenCheckBox
.
event (wx.FocusEvent
) – A wx.FocusEvent
to be processed.
OnMouseClick
(self, event)¶Handles the wx.EVT_LEFT_DOWN
event for GenCheckBox
.
event (wx.MouseEvent
) – A wx.MouseEvent
to be processed.
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for GenCheckBox
.
event (wx.PaintEvent
) – A wx.PaintEvent
to be processed.
OnSetFocus
(self, event)¶Handles the wx.EVT_SET_FOCUS
event for GenCheckBox
.
event (wx.FocusEvent
) – A wx.FocusEvent
to be processed.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for GenCheckBox
.
event (wx.SizeEvent
) – A wx.SizeEvent
to be processed.
SendCheckBoxEvent
(self)¶Actually sends the wx.wxEVT_COMMAND_CHECKBOX_CLICKED event.
SetBackgroundColour
(self, colour)¶Overridden base class virtual.
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.
font (wx.Font
) – Font to be used to render the checkboxs label.
SetForegroundColour
(self, colour)¶Overridden base class virtual.
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.
label (str) – Text to be displayed next to the checkbox.
SetSpacing
(self, spacing)¶Sets a new spacing between the check bitmap and the text.
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 a
wx.wxEVT_COMMAND_CHECKBOX_CLICKED
event to get emitted.
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.