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 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
|
.. 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
.. currentmodule:: wx.lib.agw.customtreectrl
.. highlight:: python
.. _wx.lib.agw.customtreectrl.GenericTreeItem:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.customtreectrl.GenericTreeItem**
==========================================================================================================================================
This class holds all the information and methods for every single item in
:class:`CustomTreeCtrl`. This is a generic implementation of :class:`TreeItem`.
|
|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>GenericTreeItem</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.agw.customtreectrl.GenericTreeItem_inheritance.png" alt="Inheritance diagram of GenericTreeItem" 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.lib.agw.customtreectrl.GenericTreeItem.html" title="wx.lib.agw.customtreectrl.GenericTreeItem" alt="" coords="5,5,296,35"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.__init__` Default class constructor.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.AssignAttributes` Assigns the item attributes (font, colours, etc...) for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Attr` Creates a new attribute (font, colours, etc...) for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Check` Checks/unchecks an item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Collapse` Collapses the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.DeleteChildren` Deletes the item children. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.DeleteWindow` Deletes the window associated to the item (if any). Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Enable` Enables/disables the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Expand` Expands the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Get3StateValue` Gets the state of a 3-state checkbox item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetAttributes` Returns the item attributes (font, colours, etc...).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCheckedImage` Returns the item check image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetChildren` Returns the item's children.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetChildrenCount` Gets the number of children of this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCurrentCheckedImage` Returns the current item check image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCurrentImage` Returns the current item image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetData` Returns the data associated to this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetHeight` Returns the height of the item, in pixels.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetImage` Returns the item image for a particular item state.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetLeftImage` Returns the leftmost image associated to this item, i.e. the image on the
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetParent` Gets the item parent (another instance of :class:`GenericTreeItem` or ``None`` for
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetSize` Returns the item size.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetText` Returns the item text.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetType` Returns the item type.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetValue` Returns whether the item is checked or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetVisited` Returns whether an hypertext item was visited or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWidth` Returns the width of the item, in pixels.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindow` Returns the window associated to the item (if any).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindowEnabled` Returns whether the associated window is enabled or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindowSize` Returns the associated window size.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetX` Returns the `x` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetY` Returns the `y` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HasChildren` Returns whether the item has children or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HasPlus` Returns whether the item has the plus button or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HitTest` :meth:`~GenericTreeItem.HitTest` method for an item. Called from the main window :meth:`CustomTreeCtrl.HitTest() <customtreectrl.CustomTreeCtrl.HitTest>`.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Insert` Inserts an item in the item children list for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Is3State` Returns whether or not the checkbox item is a 3-state checkbox.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsBold` Returns whether the item font is bold or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsChecked` This is just a maybe more readable synonym for :meth:`~GenericTreeItem.GetValue`.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsEnabled` Returns whether the item is enabled or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsExpanded` Returns whether the item is expanded or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsHyperText` Returns whether the item is hypetext or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsItalic` Returns whether the item font is italic or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsOk` Returns whether the item is ok or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsSelected` Returns whether the item is selected or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsSeparator` Returns whether the item is meant to be an horizontal line separator or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.OnSetFocus` Handles the ``wx.EVT_SET_FOCUS`` event for the window associated with the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.OnTreeItemCollapsing` Handles the ``wx.EVT_TREE_ITEM_COLLAPSING`` event for the window associated with the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Set3State` Sets whether the item has a 3-state value checkbox assigned to it or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Set3StateValue` Sets the checkbox item to the given `state`.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetAttributes` Sets the item attributes (font, colours, etc...).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetBold` Sets the item font bold.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetData` Sets the data associated to this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHasPlus` Sets whether an item has the 'plus' button.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHeight` Sets the item's height.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHilight` Sets the item focus/unfocus.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHyperText` Sets whether the item is hypertext or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetImage` Sets the item image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetItalic` Sets the item font italic.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetLeftImage` Sets the item leftmost image, i.e. the image associated to the item on the leftmost
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetText` Sets the item text.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetType` Sets the item type.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetVisited` Sets whether an hypertext item was visited or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWidth` Sets the item's width.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWindow` Sets the window associated to the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWindowEnabled` Sets whether the associated window is enabled or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetX` Sets the `x` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetY` Sets the `y` position on an item, in logical coordinates.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: GenericTreeItem(object)
This class holds all the information and methods for every single item in
:class:`CustomTreeCtrl`. This is a generic implementation of :class:`TreeItem`.
.. method:: __init__(self, parent, text="", ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Default class constructor.
For internal use: do not call it in your code!
:param `parent`: the tree item parent, an instance of :class:`GenericTreeItem` (may
be ``None`` for root items);
:param string `text`: the tree item text;
:param integer `ct_type`: the tree item kind. May be one of the following integers:
=============== =========================================
`ct_type` Value Description
=============== =========================================
0 A normal item
1 A checkbox-like item
2 A radiobutton-type item
=============== =========================================
:param `wnd`: if not ``None``, a non-toplevel window to be displayed next to
the item, an instance of :class:`wx.Window`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
:note: Regarding radiobutton-type items (with `ct_type` = 2), the following
approach is used:
- All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
only one of a set of radiobuttons that share a common parent can be checked at
once. If a radiobutton node becomes checked, then all of its peer radiobuttons
must be unchecked.
- If a radiobutton node becomes unchecked, then all of its child nodes will become
inactive.
:note: Separator items should not have children, labels, data or an associated window.
Other issues/features associated to separator items:
- You can change the color of individual separators by using :meth:`CustomTreeCtrl.SetItemTextColour() <customtreectrl.CustomTreeCtrl.SetItemTextColour>`,
or you can use :meth:`CustomTreeCtrl.SetSeparatorColour() <customtreectrl.CustomTreeCtrl.SetSeparatorColour>` to change the color of all
separators. The default separator colour is that returned by `SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)`;
- Separators can be selected just like any other tree item;
- Separators cannot have text;
- Separators cannot have children;
- Separators cannot be edited via the ``EVT_TREE_BEGIN_LABEL_EDIT`` event.
.. method:: AssignAttributes(self, attr)
Assigns the item attributes (font, colours, etc...) for this item.
:param `attr`: an instance of :class:`TreeItemAttr`.
.. method:: Attr(self)
Creates a new attribute (font, colours, etc...) for this item.
:return: An instance of :class:`TreeItemAttr`.
.. method:: Check(self, checked=True)
Checks/unchecks an item. Internal use only.
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
:note: This is meaningful only for checkbox-like and radiobutton-like items.
:note: Always use :meth:`~CustomTreeCtrl.CheckItem` instead to update the tree properly and send events.
.. method:: Collapse(self)
Collapses the item. Internal use only.
:note: Always use :meth:`~CustomTreeCtrl.Collapse` instead to update the tree properly and send events.
.. method:: DeleteChildren(self, tree)
Deletes the item children. Internal use only.
:param `tree`: the main :class:`CustomTreeCtrl` instance.
:note: Always use :meth:`~CustomTreeCtrl.DeleteChildren` instead to update the tree properly.
.. method:: DeleteWindow(self)
Deletes the window associated to the item (if any). Internal use only.
:note: Always use :meth:`~CustomTreeCtrl.DeleteItemWindow` instead to update the tree properly.
.. method:: Enable(self, enable=True)
Enables/disables the item.
:param bool `enable`: ``True`` to enable the item, ``False`` to disable it.
:note: Call :meth:`~CustomTreeCtrl.EnableItem` instead to update the tree properly.
.. method:: Expand(self)
Expands the item. Internal use only.
:note: Always use :meth:`~CustomTreeCtrl.Expand` instead to update the tree properly and send events.
.. method:: Get3StateValue(self)
Gets the state of a 3-state checkbox item.
:return: ``wx.CHK_UNCHECKED`` when the checkbox is unchecked, ``wx.CHK_CHECKED``
when it is checked and ``wx.CHK_UNDETERMINED`` when it's in the undetermined
state.
:raise: `Exception` when the item is not a 3-state checkbox item.
:note: This method raises an exception when the function is used with a 2-state
checkbox item.
:note: This method is meaningful only for checkbox-like items.
.. method:: GetAttributes(self)
Returns the item attributes (font, colours, etc...).
:return: An instance of :class:`TreeItemAttr`.
.. method:: GetCheckedImage(self, which=TreeItemIcon_Checked)
Returns the item check image.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Checked`` To get the checkbox checked item image
``TreeItemIcon_NotChecked`` To get the checkbox unchecked item image
``TreeItemIcon_Undetermined`` To get the checkbox undetermined state item image
``TreeItemIcon_Flagged`` To get the radiobutton checked image
``TreeItemIcon_NotFlagged`` To get the radiobutton unchecked image
================================= ========================
:return: An integer index that can be used to retrieve the item check image inside
a :class:`wx.ImageList`.
:note: This method is meaningful only for radio & check items.
.. method:: GetChildren(self)
Returns the item's children.
:return: A Python list containing instances of :class:`GenericTreeItem`, representing
this item's children.
:note: The returned value is a reference to the list of children
used internally by the tree. It is advised not to change this list
and to make a copy before calling other tree methods as they could
change the contents of the list.
.. method:: GetChildrenCount(self, recursively=True)
Gets the number of children of this item.
:param bool `recursively`: if ``True``, returns the total number of descendants,
otherwise only one level of children is counted.
.. method:: GetCurrentCheckedImage(self)
Returns the current item check image.
:return: An integer index that can be used to retrieve the item check image inside
a :class:`wx.ImageList`.
.. method:: GetCurrentImage(self)
Returns the current item image.
:return: An integer index that can be used to retrieve the item image inside
a :class:`wx.ImageList`.
.. method:: GetData(self)
Returns the data associated to this item.
:return: A Python object representing the item data, or ``None`` if no data
has been assigned to this item.
.. method:: GetHeight(self)
Returns the height of the item, in pixels.
.. method:: GetImage(self, which=TreeItemIcon_Normal)
Returns the item image for a particular item state.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Normal`` To get the normal item image
``TreeItemIcon_Selected`` To get the selected item image (i.e. the image which is shown when the item is currently selected)
``TreeItemIcon_Expanded`` To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed)
``TreeItemIcon_SelectedExpanded`` To get the selected expanded image (which is shown when an expanded item is currently selected)
================================= ========================
:return: An integer index that can be used to retrieve the item image inside
a :class:`wx.ImageList`.
.. method:: GetLeftImage(self)
Returns the leftmost image associated to this item, i.e. the image on the
leftmost part of the client area of :class:`CustomTreeCtrl`.
:return: An integer index that can be used to retrieve the item leftmost image inside
a :class:`wx.ImageList`.
.. method:: GetParent(self)
Gets the item parent (another instance of :class:`GenericTreeItem` or ``None`` for
root items.
:return: An instance of :class:`GenericTreeItem` or ``None`` for root items.
.. method:: GetSize(self, x, y, theButton)
Returns the item size.
:param integer `x`: the current item's x position;
:param integer `y`: the current item's y position;
:param `theButton`: an instance of the main :class:`CustomTreeCtrl`.
:return: A tuple of (`x`, `y`) dimensions, in pixels, representing the
item's width and height.
.. method:: GetText(self)
Returns the item text.
:return: A string containing the item text.
.. method:: GetType(self)
Returns the item type.
:see: :meth:`~GenericTreeItem.SetType` and :meth:`~GenericTreeItem.__init__` for a description of valid item types.
.. method:: GetValue(self)
Returns whether the item is checked or not.
:note: This is meaningful only for checkbox-like and radiobutton-like items.
.. method:: GetVisited(self)
Returns whether an hypertext item was visited or not.
.. method:: GetWidth(self)
Returns the width of the item, in pixels.
.. method:: GetWindow(self)
Returns the window associated to the item (if any).
:return: An instance of any :class:`wx.Window` derived class, excluding top-level windows.
.. method:: GetWindowEnabled(self)
Returns whether the associated window is enabled or not.
:return: ``True`` if the associated window is enabled, ``False`` if it is disabled.
:raise: `Exception` when the item has no associated window.
.. method:: GetWindowSize(self)
Returns the associated window size.
.. method:: GetX(self)
Returns the `x` position on an item, in logical coordinates.
.. method:: GetY(self)
Returns the `y` position on an item, in logical coordinates.
.. method:: HasChildren(self)
Returns whether the item has children or not.
:return: ``True`` if the item has children, ``False`` otherwise.
.. method:: HasPlus(self)
Returns whether the item has the plus button or not.
:return: ``True`` if the item has a 'plus' mark, ``False`` otherwise.
.. method:: HitTest(self, point, theCtrl, flags=0, level=0)
:meth:`~GenericTreeItem.HitTest` method for an item. Called from the main window :meth:`CustomTreeCtrl.HitTest() <customtreectrl.CustomTreeCtrl.HitTest>`.
:param `point`: the point to test for the hit (an instance of :class:`wx.Point`);
:param `theCtrl`: the main :class:`CustomTreeCtrl` tree;
:param integer `flags`: a bitlist of hit locations;
:param integer `level`: the item's level inside the tree hierarchy.
:see: :meth:`CustomTreeCtrl.HitTest() <customtreectrl.CustomTreeCtrl.HitTest>` method for the flags explanation.
.. method:: Insert(self, child, index)
Inserts an item in the item children list for this item.
:param `child`: an instance of :class:`GenericTreeItem`;
:param integer `index`: the index at which we should insert the new child.
.. method:: Is3State(self)
Returns whether or not the checkbox item is a 3-state checkbox.
:return: ``True`` if this checkbox is a 3-state checkbox, ``False`` if it's a
2-state checkbox item.
:note: This method is meaningful only for checkbox-like items.
.. method:: IsBold(self)
Returns whether the item font is bold or not.
:return: ``True`` if the item has bold text, ``False`` otherwise.
.. method:: IsChecked(self)
This is just a maybe more readable synonym for :meth:`~GenericTreeItem.GetValue`.
Returns whether the item is checked or not.
:note: This is meaningful only for checkbox-like and radiobutton-like items.
.. method:: IsEnabled(self)
Returns whether the item is enabled or not.
:return: ``True`` if the item is enabled, ``False`` if it is disabled.
.. method:: IsExpanded(self)
Returns whether the item is expanded or not.
:return: ``True`` if the item is expanded, ``False`` if it is collapsed.
.. method:: IsHyperText(self)
Returns whether the item is hypetext or not.
.. method:: IsItalic(self)
Returns whether the item font is italic or not.
:return: ``True`` if the item has italic text, ``False`` otherwise.
.. method:: IsOk(self)
Returns whether the item is ok or not.
:note: This method always returns ``True``, it has been added for
backward compatibility with the wxWidgets C++ implementation.
.. method:: IsSelected(self)
Returns whether the item is selected or not.
:return: ``True`` if the item is selected, ``False`` otherwise.
.. method:: IsSeparator(self)
Returns whether the item is meant to be an horizontal line separator or not.
:return: ``True`` if this item is a separator, ``False`` otherwise.
.. method:: OnSetFocus(self, event)
Handles the ``wx.EVT_SET_FOCUS`` event for the window associated with the item.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnTreeItemCollapsing(self, event)
Handles the ``wx.EVT_TREE_ITEM_COLLAPSING`` event for the window associated with the item.
:param `event`: a :class:`GenericTreeItem` to be processed.
.. method:: Set3State(self, allow)
Sets whether the item has a 3-state value checkbox assigned to it or not.
:param bool `allow`: ``True`` to set an item as a 3-state checkbox, ``False`` to set it
to a 2-state checkbox.
:return: ``True`` if the change was successful, ``False`` otherwise.
:note: This method is meaningful only for checkbox-like items.
.. method:: Set3StateValue(self, state)
Sets the checkbox item to the given `state`.
:param integer `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED``
(check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed).
:raise: `Exception` when the item is not a 3-state checkbox item.
:note: This method raises an exception when the checkbox item is a 2-state checkbox
and setting the state to ``wx.CHK_UNDETERMINED``.
:note: This method is meaningful only for checkbox-like items.
.. method:: SetAttributes(self, attr)
Sets the item attributes (font, colours, etc...).
:param `attr`: an instance of :class:`TreeItemAttr`.
.. method:: SetBold(self, bold)
Sets the item font bold.
:parameter bool `bold`: ``True`` to have a bold font item, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SetItemBold` instead to refresh the tree properly.
.. method:: SetData(self, data)
Sets the data associated to this item.
:param object `data`: can be any Python object.
.. method:: SetHasPlus(self, has=True)
Sets whether an item has the 'plus' button.
:param bool `has`: ``True`` to set the 'plus' button on the item, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SetItemHasChildren` instead to refresh the tree properly.
.. method:: SetHeight(self, h)
Sets the item's height.
:param integer `h`: an integer specifying the item's height, in pixels.
.. method:: SetHilight(self, set=True)
Sets the item focus/unfocus.
:param bool `set`: ``True`` to set the focus to the item, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SelectItem` instead to update the tree properly and send events.
.. method:: SetHyperText(self, hyper=True)
Sets whether the item is hypertext or not.
:param bool `hyper`: ``True`` to set hypertext behaviour, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SetItemHyperText` instead to refresh the tree properly.
.. method:: SetImage(self, image, which)
Sets the item image.
:param integer `image`: an index within the normal image list specifying the image to use;
:param integer `which`: the image kind.
:see: :meth:`~GenericTreeItem.GetImage` for a description of the `which` parameter.
:note: Call :meth:`~CustomTreeCtrl.SetItemImage` instead to refresh the tree properly.
.. method:: SetItalic(self, italic)
Sets the item font italic.
:parameter bool `italic`: ``True`` to have an italic font item, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SetItemItalic` instead to refresh the tree properly.
.. method:: SetLeftImage(self, image)
Sets the item leftmost image, i.e. the image associated to the item on the leftmost
part of the :class:`CustomTreeCtrl` client area.
:param integer `image`: an index within the left image list specifying the image to
use for the item in the leftmost part of the client area.
:note: Call :meth:`~CustomTreeCtrl.SetItemLeftImage` instead to refresh the tree properly.
.. method:: SetText(self, text)
Sets the item text.
:param string `text`: the new item label.
:raise: `Exception` if the item is a separator.
:note: Call :meth:`~CustomTreeCtrl.SetItemText` to refresh the tree properly.
.. method:: SetType(self, ct_type)
Sets the item type.
:param integer `ct_type`: may be one of the following integers:
=============== =========================================
`ct_type` Value Description
=============== =========================================
0 A normal item
1 A checkbox-like item
2 A radiobutton-type item
=============== =========================================
:note: Regarding radiobutton-type items (with `ct_type` = 2), the following
approach is used:
- All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
only one of a set of radiobuttons that share a common parent can be checked at
once. If a radiobutton node becomes checked, then all of its peer radiobuttons
must be unchecked.
- If a radiobutton node becomes unchecked, then all of its child nodes will become
inactive.
:note: Call :meth:`~CustomTreeCtrl.SetItemType` instead to refresh the tree properly.
.. method:: SetVisited(self, visited=True)
Sets whether an hypertext item was visited or not.
:param bool `visited`: ``True`` to set a hypertext item as visited, ``False`` otherwise.
:note: Call :meth:`~CustomTreeCtrl.SetItemVisited` instead to refresh the tree properly.
.. method:: SetWidth(self, w)
Sets the item's width.
:param integer `w`: an integer specifying the item's width, in pixels.
.. method:: SetWindow(self, wnd, on_the_right=True)
Sets the window associated to the item. Internal use only.
:param `wnd`: a non-toplevel window to be displayed next to the item, any
subclass of :class:`wx.Window`.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image. New in wxPython 4.0.4.
:raise: `Exception` if the input `item` is a separator and `wnd` is not ``None``.
:note: Always use :meth:`~CustomTreeCtrl.SetItemWindow` instead to update the tree properly.
.. method:: SetWindowEnabled(self, enable=True)
Sets whether the associated window is enabled or not.
:param bool `enable`: ``True`` to enable the associated window, ``False`` to disable it.
:raise: `Exception` when the item has no associated window.
.. method:: SetX(self, x)
Sets the `x` position on an item, in logical coordinates.
:param integer `x`: an integer specifying the x position of the item.
.. method:: SetY(self, y)
Sets the `y` position on an item, in logical coordinates.
:param integer `y`: an integer specifying the y position of the item.
|