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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.DelegateRendererNative:
==========================================================================================================================================
|phoenix_title| **wx.DelegateRendererNative**
==========================================================================================================================================
:ref:`wx.DelegateRendererNative` allows reuse of renderers code by forwarding all the :ref:`wx.RendererNative` methods to the given object and thus allowing you to only modify some of its methods
Note that the "normal", inheritance-based approach, doesn't work with the renderers as it is impossible to derive from a class unknown at compile-time and the renderer is only chosen at run-time. So suppose that you want to only add something to the drawing of the tree control buttons but leave all the other methods unchanged
Except for the constructor, it has exactly the same methods as :ref:`wx.RendererNative` and their implementation is trivial: they are simply forwarded to the real renderer. Note that the "real" renderer may, in turn, be a :ref:`wx.DelegateRendererNative` as well and that there may be arbitrarily many levels like this
.. seealso:: :ref:`wx.RendererNative`
|
|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>DelegateRendererNative</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.DelegateRendererNative_inheritance.png" alt="Inheritance diagram of DelegateRendererNative" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.RendererNative.html" title="wx.RendererNative" alt="" coords="34,5,173,35"/> <area shape="rect" id="node2" href="wx.DelegateRendererNative.html" title="wx.DelegateRendererNative" alt="" coords="5,83,203,112"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.DelegateRendererNative.__init__` The default constructor does the same thing as the other one except that it uses the :ref:`generic renderer <wx.RendererNative>` instead of the user-specified `rendererNative`.
:meth:`~wx.DelegateRendererNative.DrawCheckBox` Draw a check box.
:meth:`~wx.DelegateRendererNative.DrawComboBoxDropButton` Draw a button like the one used by :ref:`wx.ComboBox` to show a drop down window.
:meth:`~wx.DelegateRendererNative.DrawDropArrow` Draw a drop down arrow that is suitable for use outside a combo box.
:meth:`~wx.DelegateRendererNative.DrawFocusRect` Draw a focus rectangle using the specified rectangle.
:meth:`~wx.DelegateRendererNative.DrawHeaderButton` Draw the header control button (used, for example, by :ref:`wx.ListCtrl`).
:meth:`~wx.DelegateRendererNative.DrawHeaderButtonContents` Draw the contents of a header control button (label, sort arrows, etc.).
:meth:`~wx.DelegateRendererNative.DrawItemSelectionRect` Draw a selection rectangle underneath the text as used e.g.
:meth:`~wx.DelegateRendererNative.DrawPushButton` Draw a blank push button that looks very similar to :ref:`wx.Button`.
:meth:`~wx.DelegateRendererNative.DrawSplitterBorder` Draw the border for sash window: this border must be such that the sash drawn by :meth:`~DelegateRendererNative.DrawSplitterSash` blends into it well.
:meth:`~wx.DelegateRendererNative.DrawSplitterSash` Draw a sash.
:meth:`~wx.DelegateRendererNative.DrawTreeItemButton` Draw the expanded/collapsed icon for a tree control item.
:meth:`~wx.DelegateRendererNative.GetCheckBoxSize` Returns the size of a check box.
:meth:`~wx.DelegateRendererNative.GetHeaderButtonHeight` Returns the height of a header button, either a fixed platform height if available, or a generic height based on the `win` window's font.
:meth:`~wx.DelegateRendererNative.GetHeaderButtonMargin` Returns the horizontal margin on the left and right sides of header button's label.
:meth:`~wx.DelegateRendererNative.GetSplitterParams` Get the splitter parameters, see :ref:`wx.SplitterRenderParams`.
:meth:`~wx.DelegateRendererNative.GetVersion` This function is used for version checking: :meth:`~DelegateRendererNative.Load` refuses to load any shared libraries implementing an older or incompatible version.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.DelegateRendererNative.Version` See :meth:`~wx.DelegateRendererNative.GetVersion`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.DelegateRendererNative(RendererNative)
**Possible constructors**::
DelegateRendererNative()
DelegateRendererNative(rendererNative)
DelegateRendererNative allows reuse of renderers code by forwarding
all the RendererNative methods to the given object and thus allowing
you to only modify some of its methods without having to reimplement
all of them.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
The default constructor does the same thing as the other one except that it uses the :ref:`generic renderer <wx.RendererNative>` instead of the user-specified `rendererNative`.
In any case, this sets up the delegate renderer object to follow all calls to the specified real renderer.
**~~~**
**__init__** `(self, rendererNative)`
This constructor uses the user-specified `rendererNative` to set up the delegate renderer object to follow all calls to the specified real renderer.
:param `rendererNative`:
:type `rendererNative`: wx.RendererNative
.. note::
This object does not take ownership of (i.e. won't delete) `rendererNative`.
**~~~**
.. method:: DrawCheckBox(self, win, dc, rect, flags=0)
Draw a check box.
`flags` may have the ``CONTROL_CHECKED`` , ``CONTROL_CURRENT`` or ``CONTROL_UNDETERMINED`` bit set, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawComboBoxDropButton(self, win, dc, rect, flags=0)
Draw a button like the one used by :ref:`wx.ComboBox` to show a drop down window.
The usual appearance is a downwards pointing arrow.
`flags` may have the ``CONTROL_PRESSED`` or ``CONTROL_CURRENT`` bit set, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawDropArrow(self, win, dc, rect, flags=0)
Draw a drop down arrow that is suitable for use outside a combo box.
Arrow will have transparent background.
`rect` is not entirely filled by the arrow. Instead, you should use bounding rectangle of a drop down button which arrow matches the size you need.
`flags` may have the ``CONTROL_PRESSED`` or ``CONTROL_CURRENT`` bit set, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawFocusRect(self, win, dc, rect, flags=0)
Draw a focus rectangle using the specified rectangle.
:ref:`wx.ListCtrl`.
The only supported flags is ``CONTROL_SELECTED`` for items which are selected. see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawHeaderButton(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)
Draw the header control button (used, for example, by :ref:`wx.ListCtrl`).
Depending on platforms the `flags` parameter may support the ``CONTROL_SELECTED`` ``CONTROL_DISABLED`` and ``CONTROL_CURRENT`` bits, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
:param `sortArrow`:
:type `sortArrow`: wx.HeaderSortIconType
:param `params`:
:type `params`: wx.HeaderButtonParams
:rtype: `int`
:returns:
The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.
.. method:: DrawHeaderButtonContents(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)
Draw the contents of a header control button (label, sort arrows, etc.).
This function is normally only called by :meth:`DrawHeaderButton` .
Depending on platforms the `flags` parameter may support the ``CONTROL_SELECTED`` ``CONTROL_DISABLED`` and ``CONTROL_CURRENT`` bits, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
:param `sortArrow`:
:type `sortArrow`: wx.HeaderSortIconType
:param `params`:
:type `params`: wx.HeaderButtonParams
:rtype: `int`
:returns:
The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.
.. method:: DrawItemSelectionRect(self, win, dc, rect, flags=0)
Draw a selection rectangle underneath the text as used e.g.
in a :ref:`wx.ListCtrl`.
The supported `flags` are ``CONTROL_SELECTED`` for items which are selected (e.g. often a blue rectangle) and ``CONTROL_CURRENT`` for the item that has the focus (often a dotted line around the item's text). ``CONTROL_FOCUSED`` may be used to indicate if the control has the focus (otherwise the selection rectangle is e.g. often grey and not blue). This may be ignored by the renderer or deduced by the code directly from the `win`.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawPushButton(self, win, dc, rect, flags=0)
Draw a blank push button that looks very similar to :ref:`wx.Button`.
`flags` may have the ``CONTROL_PRESSED`` , ``CONTROL_CURRENT`` or ``CONTROL_ISDEFAULT`` bit set, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawSplitterBorder(self, win, dc, rect, flags=0)
Draw the border for sash window: this border must be such that the sash drawn by :meth:`DrawSplitterSash` blends into it well.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: DrawSplitterSash(self, win, dc, size, position, orient, flags=0)
Draw a sash.
The `orient` parameter defines whether the sash should be vertical or horizontal and how the `position` should be interpreted.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `size`:
:type `size`: wx.Size
:param `position`:
:type `position`: int
:param `orient`:
:type `orient`: wx.Orientation
:param `flags`:
:type `flags`: int
.. method:: DrawTreeItemButton(self, win, dc, rect, flags=0)
Draw the expanded/collapsed icon for a tree control item.
To draw an expanded button the `flags` parameter must contain ``CONTROL_EXPANDED`` bit, see ``CONTROL_FLAGS``.
:param `win`:
:type `win`: wx.Window
:param `dc`:
:type `dc`: wx.DC
:param `rect`:
:type `rect`: wx.Rect
:param `flags`:
:type `flags`: int
.. method:: GetCheckBoxSize(self, win)
Returns the size of a check box.
The `win` parameter is not used currently and can be ``None``.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.Size`
.. method:: GetHeaderButtonHeight(self, win)
Returns the height of a header button, either a fixed platform height if available, or a generic height based on the `win` window's font.
:param `win`:
:type `win`: wx.Window
:rtype: `int`
.. method:: GetHeaderButtonMargin(self, win)
Returns the horizontal margin on the left and right sides of header button's label.
:param `win`:
:type `win`: wx.Window
:rtype: `int`
.. versionadded:: 2.9.2
.. method:: GetSplitterParams(self, win)
Get the splitter parameters, see :ref:`wx.SplitterRenderParams`.
The `win` parameter should be a :ref:`wx.SplitterWindow`.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.SplitterRenderParams`
.. method:: GetVersion(self)
This function is used for version checking: :meth:`Load` refuses to load any shared libraries implementing an older or incompatible version.
:rtype: :ref:`wx.RendererVersion`
.. note::
The implementation of this method is always the same in all renderers (simply construct :ref:`wx.RendererVersion` using the ``RendererVersion::Current_XXX`` values), but it has to be in the derived, not base, class, to detect mismatches between the renderers versions and so you have to implement it anew in all renderers.
.. attribute:: Version
See :meth:`~wx.DelegateRendererNative.GetVersion`
|