File: wx.lib.checkbox.GenCheckBox.txt

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (316 lines) | stat: -rw-r--r-- 12,973 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
.. 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.checkbox

.. highlight:: python



.. _wx.lib.checkbox.GenCheckBox:

==========================================================================================================================================
|phoenix_title|  **wx.lib.checkbox.GenCheckBox**
==========================================================================================================================================

A generic class that replicates some of the functionalities of :class:`wx.Checkbox`,
while being completely owner-drawn with a nice check bitmaps.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GenCheckBox</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.checkbox.GenCheckBox_inheritance.png" alt="Inheritance diagram of GenCheckBox" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.checkbox.GenCheckBox.html" title="wx.lib.checkbox.GenCheckBox" alt="" coords="5,392,228,421"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="71,315,163,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="68,237,165,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="52,160,181,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="58,83,175,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="13,5,100,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="125,5,231,35"/> </map> 
   </p>
   </div>

|


|super_classes| Known Superclasses
==================================

:class:`wx.Control`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.checkbox.GenCheckBox.__init__`                                    Default class constructor.
:meth:`~wx.lib.checkbox.GenCheckBox.AcceptsFocus`                                Overridden base class virtual.
:meth:`~wx.lib.checkbox.GenCheckBox.AcceptsFocusFromKeyboard`                    Overridden base class virtual.
:meth:`~wx.lib.checkbox.GenCheckBox.DoGetBestSize`                               Overridden base class virtual.  Determines the best size of the control
:meth:`~wx.lib.checkbox.GenCheckBox.Draw`                                        Actually performs the drawing operations, for the bitmap and
:meth:`~wx.lib.checkbox.GenCheckBox.Enable`                                      Enables/Disables :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.GetBitmap`                                   Returns the appropriated bitmap depending on the checking state
:meth:`~wx.lib.checkbox.GenCheckBox.GetDefaultAttributes`                        Overridden base class virtual.  By default we should use
:meth:`~wx.lib.checkbox.GenCheckBox.GetSpacing`                                  Returns the spacing between the check bitmap and the text.
:meth:`~wx.lib.checkbox.GenCheckBox.GetValue`                                    Returns the state of :class:`GenCheckBox`, ``True`` if checked, ``False`` otherwise.
:meth:`~wx.lib.checkbox.GenCheckBox.HasFocus`                                    Returns whether or not we have the focus.
:meth:`~wx.lib.checkbox.GenCheckBox.InitializeBitmaps`                           Initializes the check bitmaps.
:meth:`~wx.lib.checkbox.GenCheckBox.InitializeColours`                           Initializes the focus indicator pen.
:meth:`~wx.lib.checkbox.GenCheckBox.IsChecked`                                   This is just a maybe more readable synonym for GetValue: just as the
:meth:`~wx.lib.checkbox.GenCheckBox.OnKeyEvent`                                  Handles the ``wx.EVT_KEY_UP`` or ``wx.EVT_KEY_UP`` event (depending on
:meth:`~wx.lib.checkbox.GenCheckBox.OnKillFocus`                                 Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.OnMouseClick`                                Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.OnPaint`                                     Handles the ``wx.EVT_PAINT`` event for :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.OnSetFocus`                                  Handles the ``wx.EVT_SET_FOCUS`` event for :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.OnSize`                                      Handles the ``wx.EVT_SIZE`` event for :class:`GenCheckBox`.
:meth:`~wx.lib.checkbox.GenCheckBox.SendCheckBoxEvent`                           Actually sends the wx.wxEVT_COMMAND_CHECKBOX_CLICKED event.
:meth:`~wx.lib.checkbox.GenCheckBox.SetBackgroundColour`                         Overridden base class virtual.
:meth:`~wx.lib.checkbox.GenCheckBox.SetFont`                                     Sets the :class:`GenCheckBox` text font and updates the control's
:meth:`~wx.lib.checkbox.GenCheckBox.SetForegroundColour`                         Overridden base class virtual.
:meth:`~wx.lib.checkbox.GenCheckBox.SetLabel`                                    Sets the :class:`GenCheckBox` text label and updates the control's
:meth:`~wx.lib.checkbox.GenCheckBox.SetSpacing`                                  Sets a new spacing between the check bitmap and the text.
:meth:`~wx.lib.checkbox.GenCheckBox.SetValue`                                    Sets the :class:`GenCheckBox` to the given state. This does not cause a
:meth:`~wx.lib.checkbox.GenCheckBox.ShouldInheritColours`                        Overridden base class virtual.  If the parent has non-default
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: GenCheckBox(wx.Control)

   A generic class that replicates some of the functionalities of :class:`wx.Checkbox`,
   while being completely owner-drawn with a nice check bitmaps.

   .. method:: __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.
      
      :param `parent`: Pointer to a parent window. Must not be ``None``.
      :type `parent`: `wx.Window`
      :param `id`: Window identifier. ``wx.ID_ANY`` indicates a default value.
      :type `id`: int
      :param `label`: Text to be displayed next to the checkbox.
      :type `label`: str
      :param `pos`: Window position. The value ``wx.DefaultPosition`` indicates
       a default position, chosen by either the windowing system or wxWidgets, depending on platform.
      :type `pos`: `wx.Point`
      :param `size`: Window size. The value ``wx.DefaultSize`` indicates a default size,
       chosen by either the windowing system or wxWidgets, depending on platform.
      :type `size`: `wx.Size`
      :param `style`: Window style. Not used in this widget, GenCheckBox has only 2 state.
      :type `style`: long
      :param `validator`: Window validator.
      :type `validator`: `wx.Validator`
      :param `name`: Window name.
      :type `name`: str


   .. method:: AcceptsFocus(self)

      Overridden base class virtual. 


   .. method:: AcceptsFocusFromKeyboard(self)

      Overridden base class virtual. 


   .. method:: 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.


   .. method:: Draw(self, dc)

      Actually performs the drawing operations, for the bitmap and
      for the text, positioning them centered vertically.
      
      :param `dc`: device context to use.
      :type `dc`: `wx.DC`


   .. method:: Enable(self, enable=True)

      Enables/Disables :class:`GenCheckBox`.
      
      :param `enable`: Set the enabled state of the checkbox.
      :type `enable`: bool


   .. method:: GetBitmap(self)

      Returns the appropriated bitmap depending on the checking state
      (Checked/UnChecked) and the control state (Enabled/Disabled).


   .. method:: GetDefaultAttributes(self)

      Overridden base class virtual.  By default we should use
      the same font/colour attributes as the native wx.CheckBox.


   .. method:: GetSpacing(self)

      Returns the spacing between the check bitmap and the text. 


   .. method:: GetValue(self)

      Returns the state of :class:`GenCheckBox`, ``True`` if checked, ``False`` otherwise.


   .. method:: HasFocus(self)

      Returns whether or not we have the focus. 


   .. method:: InitializeBitmaps(self)

      Initializes the check bitmaps. 


   .. method:: InitializeColours(self)

      Initializes the focus indicator pen. 


   .. method:: IsChecked(self)

      This is just a maybe more readable synonym for GetValue: just as the
      latter, it returns ``True`` if the :class:`GenCheckBox` is checked and ``False`` otherwise.


   .. method:: OnKeyEvent(self, event)

      Handles the ``wx.EVT_KEY_UP`` or ``wx.EVT_KEY_UP`` event (depending on
      platform) for :class:`GenCheckBox`.
      
      :param `event`: A `wx.KeyEvent` to be processed.
      :type `event`: `wx.KeyEvent`


   .. method:: OnKillFocus(self, event)

      Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`GenCheckBox`.
      
      :param `event`: A `wx.FocusEvent` to be processed.
      :type `event`: `wx.FocusEvent`


   .. method:: OnMouseClick(self, event)

      Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`GenCheckBox`.
      
      :param `event`: A `wx.MouseEvent` to be processed.
      :type `event`: `wx.MouseEvent`


   .. method:: OnPaint(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`GenCheckBox`.
      
      :param `event`: A `wx.PaintEvent` to be processed.
      :type `event`: `wx.PaintEvent`


   .. method:: OnSetFocus(self, event)

      Handles the ``wx.EVT_SET_FOCUS`` event for :class:`GenCheckBox`.
      
      :param `event`: A `wx.FocusEvent` to be processed.
      :type `event`: `wx.FocusEvent`


   .. method:: OnSize(self, event)

      Handles the ``wx.EVT_SIZE`` event for :class:`GenCheckBox`.
      
      :param `event`: A `wx.SizeEvent` to be processed.
      :type `event`: `wx.SizeEvent`


   .. method:: SendCheckBoxEvent(self)

      Actually sends the wx.wxEVT_COMMAND_CHECKBOX_CLICKED event. 


   .. method:: SetBackgroundColour(self, colour)

      Overridden base class virtual.
      
      :param `colour`: Set the background colour of the checkbox.
      :type `colour`: `wx.Colour`


   .. method:: SetFont(self, font)

      Sets the :class:`GenCheckBox` text font and updates the control's
      size to exactly fit the label plus the bitmap.
      
      :param `font`: Font to be used to render the checkboxs label.
      :type `font`: `wx.Font`


   .. method:: SetForegroundColour(self, colour)

      Overridden base class virtual.
      
      :param `colour`: Set the foreground colour of the checkboxs label.
      :type `colour`: `wx.Colour`


   .. method:: SetLabel(self, label)

      Sets the :class:`GenCheckBox` text label and updates the control's
      size to exactly fit the label plus the bitmap.
      
      :param `label`: Text to be displayed next to the checkbox.
      :type `label`: str


   .. method:: SetSpacing(self, spacing)

      Sets a new spacing between the check bitmap and the text.
      
      :param `spacing`: Set the amount of space between the checkboxs bitmap and text.
      :type `spacing`: int


   .. method:: SetValue(self, state)

      Sets the :class:`GenCheckBox` to the given state. This does not cause a
      ``wx.wxEVT_COMMAND_CHECKBOX_CLICKED`` event to get emitted.
      
      :param `state`: Set the value of the checkbox. ``True`` or False.
      :type `state`: bool


   .. method:: ShouldInheritColours(self)

      Overridden base class virtual.  If the parent has non-default
      colours then we want this control to inherit them.