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 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
|
<HTML>
<head><title>wxTreeCtrl</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxtreectrl"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx249.htm#wxtoolbar"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx251.htm#wxtreeitemdata"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxTreeCtrl</H2>
<P>
A tree control presents information as a hierarchy, with items that may be expanded
to show further items. Items in a tree control are referenced by wxTreeItemId handles.<P>
To intercept events from a tree control, use the event table macros described in <A HREF="wx252.htm#wxtreeevent">wxTreeEvent</A>.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>
<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/treectrl.h><P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxTR_HAS_BUTTONS</B>
</TD>
<TD VALIGN=TOP>
Use this style to show + and - buttons to the
left of parent items.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTR_EDIT_LABELS</B>
</TD>
<TD VALIGN=TOP>
Use this style if you wish the user to be
able to edit labels in the tree control.
</TD></TR>
</TABLE>
<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
To process input from a tree control, use these event handler macros to direct input to member
functions that take a <A HREF="wx252.htm#wxtreeevent">wxTreeEvent</A> argument.<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_BEGIN_DRAG(id, func)</B>
</TD>
<TD VALIGN=TOP>
Begin dragging with the left mouse button.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_BEGIN_RDRAG(id, func)</B>
</TD>
<TD VALIGN=TOP>
Begin dragging with the right mouse button.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_BEGIN_LABEL_EDIT(id, func)</B>
</TD>
<TD VALIGN=TOP>
Begin editing a label.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_END_LABEL_EDIT(id, func)</B>
</TD>
<TD VALIGN=TOP>
Finish editing a label.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_DELETE_ITEM(id, func)</B>
</TD>
<TD VALIGN=TOP>
Delete an item.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_GET_INFO(id, func)</B>
</TD>
<TD VALIGN=TOP>
Request information from the application.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_SET_INFO(id, func)</B>
</TD>
<TD VALIGN=TOP>
Information is being supplied.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_ITEM_EXPANDED(id, func)</B>
</TD>
<TD VALIGN=TOP>
Parent has been expanded.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_ITEM_EXPANDING(id, func)</B>
</TD>
<TD VALIGN=TOP>
Parent is being expanded.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_SEL_CHANGED(id, func)</B>
</TD>
<TD VALIGN=TOP>
Selection has changed.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_SEL_CHANGING(id, func)</B>
</TD>
<TD VALIGN=TOP>
Selection is changing.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TREE_KEY_DOWN(id, func)</B>
</TD>
<TD VALIGN=TOP>
A key has been pressed.
</TD></TR>
</TABLE>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx251.htm#wxtreeitemdata">wxTreeItemData</A>, <A HREF="wx288.htm#wxtreectrloverview">wxTreeCtrl overview</A>, <A HREF="wx128.htm#wxlistbox">wxListBox</A>, <A HREF="wx129.htm#wxlistctrl">wxListCtrl</A>,
<A HREF="wx117.htm#wximagelist">wxImageList</A>, <A HREF="wx252.htm#wxtreeevent">wxTreeEvent</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxtreectrlconstr">wxTreeCtrl::wxTreeCtrl</A><BR>
<A HREF="#topic984">wxTreeCtrl::~wxTreeCtrl</A><BR>
<A HREF="#wxtreectrladdroot">wxTreeCtrl::AddRoot</A><BR>
<A HREF="#wxtreectrlappenditem">wxTreeCtrl::AppendItem</A><BR>
<A HREF="#wxtreectrlcollapse">wxTreeCtrl::Collapse</A><BR>
<A HREF="#wxtreectrlcollapseandreset">wxTreeCtrl::CollapseAndReset</A><BR>
<A HREF="#wxtreectrlcreate">wxTreeCtrl::Create</A><BR>
<A HREF="#wxtreectrldelete">wxTreeCtrl::Delete</A><BR>
<A HREF="#wxtreectrldeleteallitems">wxTreeCtrl::DeleteAllItems</A><BR>
<A HREF="#wxtreectrleditlabel">wxTreeCtrl::EditLabel</A><BR>
<A HREF="#wxtreectrlendeditlabel">wxTreeCtrl::EndEditLabel</A><BR>
<A HREF="#wxtreectrlensurevisible">wxTreeCtrl::EnsureVisible</A><BR>
<A HREF="#wxtreectrlexpand">wxTreeCtrl::Expand</A><BR>
<A HREF="#wxtreectrlgetitemrect">wxTreeCtrl::GetBoundingRect</A><BR>
<A HREF="#wxtreectrlgetchildrencount">wxTreeCtrl::GetChildrenCount</A><BR>
<A HREF="#wxtreectrlgetcount">wxTreeCtrl::GetCount</A><BR>
<A HREF="#wxtreectrlgeteditcontrol">wxTreeCtrl::GetEditControl</A><BR>
<A HREF="#wxtreectrlgetfirstchild">wxTreeCtrl::GetFirstChild</A><BR>
<A HREF="#wxtreectrlgetfirstvisibleitem">wxTreeCtrl::GetFirstVisibleItem</A><BR>
<A HREF="#wxtreectrlgetimagelist">wxTreeCtrl::GetImageList</A><BR>
<A HREF="#wxtreectrlgetindent">wxTreeCtrl::GetIndent</A><BR>
<A HREF="#wxtreectrlgetitemdata">wxTreeCtrl::GetItemData</A><BR>
<A HREF="#wxtreectrlgetitemimage">wxTreeCtrl::GetItemImage</A><BR>
<A HREF="#wxtreectrlgetitemtext">wxTreeCtrl::GetItemText</A><BR>
<A HREF="#wxtreectrlgetlastchild">wxTreeCtrl::GetLastChild</A><BR>
<A HREF="#wxtreectrlgetnextchild">wxTreeCtrl::GetNextChild</A><BR>
<A HREF="#wxtreectrlgetnextsibling">wxTreeCtrl::GetNextSibling</A><BR>
<A HREF="#wxtreectrlgetnextvisible">wxTreeCtrl::GetNextVisible</A><BR>
<A HREF="#wxtreectrlgetparent">wxTreeCtrl::GetParent</A><BR>
<A HREF="#wxtreectrlgetprevsibling">wxTreeCtrl::GetPrevSibling</A><BR>
<A HREF="#wxtreectrlgetprevvisible">wxTreeCtrl::GetPrevVisible</A><BR>
<A HREF="#wxtreectrlgetrootitem">wxTreeCtrl::GetRootItem</A><BR>
<A HREF="#wxtreectrlgetitemselectedimage">wxTreeCtrl::GetItemSelectedImage</A><BR>
<A HREF="#wxtreectrlgetselection">wxTreeCtrl::GetSelection</A><BR>
<A HREF="#wxtreectrlhittest">wxTreeCtrl::HitTest</A><BR>
<A HREF="#wxtreectrlinsertitem">wxTreeCtrl::InsertItem</A><BR>
<A HREF="#wxtreectrlisbold">wxTreeCtrl::IsBold</A><BR>
<A HREF="#wxtreectrlisexpanded">wxTreeCtrl::IsExpanded</A><BR>
<A HREF="#wxtreectrlisselected">wxTreeCtrl::IsSelected</A><BR>
<A HREF="#wxtreectrlisvisible">wxTreeCtrl::IsVisible</A><BR>
<A HREF="#wxtreectrlitemhaschildren">wxTreeCtrl::ItemHasChildren</A><BR>
<A HREF="#wxtreectrloncompareitems">wxTreeCtrl::OnCompareItems</A><BR>
<A HREF="#wxtreectrlprependitem">wxTreeCtrl::PrependItem</A><BR>
<A HREF="#wxtreectrlscrollto">wxTreeCtrl::ScrollTo</A><BR>
<A HREF="#wxtreectrlselectitem">wxTreeCtrl::SelectItem</A><BR>
<A HREF="#wxtreectrlsetindent">wxTreeCtrl::SetIndent</A><BR>
<A HREF="#wxtreectrlsetimagelist">wxTreeCtrl::SetImageList</A><BR>
<A HREF="#wxtreectrlsetitembold">wxTreeCtrl::SetItemBold</A><BR>
<A HREF="#wxtreectrlsetitemdata">wxTreeCtrl::SetItemData</A><BR>
<A HREF="#wxtreectrlsetitemhaschildren">wxTreeCtrl::SetItemHasChildren</A><BR>
<A HREF="#wxtreectrlsetitemimage">wxTreeCtrl::SetItemImage</A><BR>
<A HREF="#wxtreectrlsetitemselectedimage">wxTreeCtrl::SetItemSelectedImage</A><BR>
<A HREF="#wxtreectrlsetitemtext">wxTreeCtrl::SetItemText</A><BR>
<A HREF="#wxtreectrlsortchildren">wxTreeCtrl::SortChildren</A><BR>
<A HREF="#wxtreectrltoggle">wxTreeCtrl::Toggle</A><BR>
<A HREF="#wxtreectrlunselect">wxTreeCtrl::Unselect</A><BR>
<P>
<HR>
<A NAME="wxtreectrlconstr"></A>
<H3>wxTreeCtrl::wxTreeCtrl</H3>
<P>
<B></B> <B>wxTreeCtrl</B>()<P>
Default constructor.<P>
<B></B> <B>wxTreeCtrl</B>(<B>wxWindow*</B><I> parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxPoint&</B><I> pos = wxDefaultPosition</I>, <B>const wxSize&</B><I> size = wxDefaultSize</I>,
<B>long</B><I> style = wxTR_HAS_BUTTONS</I>, <B>const wxValidator& </B><I>validator = wxDefaultValidator</I>, <B>const wxString& </B><I>name = "listCtrl"</I>)<P>
Constructor, creating and showing a tree control.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Must not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Window identifier. A value of -1 indicates a default value.</UL></UL>
<P>
<I>pos</I><UL><UL>
Window position.</UL></UL>
<P>
<I>size</I><UL><UL>
Window size. If the default size (-1, -1) is specified then the window is sized
appropriately.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx250.htm#wxtreectrl">wxTreeCtrl</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlcreate">wxTreeCtrl::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>
<HR>
<A NAME="topic984"></A>
<H3>wxTreeCtrl::~wxTreeCtrl</H3>
<P>
<B>void</B> <B>~wxTreeCtrl</B>()<P>
Destructor, destroying the list control.<P>
<HR>
<A NAME="wxtreectrladdroot"></A>
<H3>wxTreeCtrl::AddRoot</H3>
<P>
<B>wxTreeItemId</B> <B>AddRoot</B>(<B>const wxString&</B><I> text</I>,
<B>int</B><I> image = -1</I>, <B>int</B><I> selImage = -1</I>, <B>wxTreeItemData*</B><I> data = NULL</I>)<P>
Adds the root node to the tree, returning the new item.<P>
If <I>image</I> > -1 and <I>selImage</I> is -1, the same image is used for
both selected and unselected items.<P>
<HR>
<A NAME="wxtreectrlappenditem"></A>
<H3>wxTreeCtrl::AppendItem</H3>
<P>
<B>wxTreeItemId</B> <B>AppendItem</B>(<B>const wxTreeItemId& </B><I>parent</I>, <B>const wxString&</B><I> text</I>,
<B>int</B><I> image = -1</I>, <B>int</B><I> selImage = -1</I>, <B>wxTreeItemData*</B><I> data = NULL</I>)<P>
Appends an item to the end of the branch identified by <I>parent</I>, return a new item id.<P>
If <I>image</I> > -1 and <I>selImage</I> is -1, the same image is used for
both selected and unselected items.<P>
<HR>
<A NAME="wxtreectrlcollapse"></A>
<H3>wxTreeCtrl::Collapse</H3>
<P>
<B>void</B> <B>Collapse</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Collapses the given item.<P>
<HR>
<A NAME="wxtreectrlcollapseandreset"></A>
<H3>wxTreeCtrl::CollapseAndReset</H3>
<P>
<B>void</B> <B>CollapseAndReset</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Collapses the given item and removes all children.<P>
<HR>
<A NAME="wxtreectrlcreate"></A>
<H3>wxTreeCtrl::Create</H3>
<P>
<B>bool</B> <B>wxTreeCtrl</B>(<B>wxWindow*</B><I> parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxPoint&</B><I> pos = wxDefaultPosition</I>, <B>const wxSize&</B><I> size = wxDefaultSize</I>,
<B>long</B><I> style = wxTR_HAS_BUTTONS</I>, <B>const wxValidator& </B><I>validator = wxDefaultValidator</I>, <B>const wxString& </B><I>name = "listCtrl"</I>)<P>
Creates the tree control. See <A HREF="wx250.htm#wxtreectrlconstr">wxTreeCtrl::wxTreeCtrl</A> for further details.<P>
<HR>
<A NAME="wxtreectrldelete"></A>
<H3>wxTreeCtrl::Delete</H3>
<P>
<B>void</B> <B>Delete</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Deletes the specified item.<P>
<HR>
<A NAME="wxtreectrldeleteallitems"></A>
<H3>wxTreeCtrl::DeleteAllItems</H3>
<P>
<B>void</B> <B>DeleteAllItems</B>()<P>
Deletes all the items in the control.<P>
<HR>
<A NAME="wxtreectrleditlabel"></A>
<H3>wxTreeCtrl::EditLabel</H3>
<P>
<B>wxTextCtrl*</B> <B>EditLabel</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>wxClassInfo*</B><I> textControlClass = CLASSINFO(wxTextCtrl)</I>)<P>
Starts editing the label of the given item, returning the text control that the tree control uses for editing.<P>
Pass another <I>textControlClass</I> if a derived class is required. It usually will be, in order for
the application to detect when editing has finished and to call <A HREF="wx250.htm#wxtreectrlendeditlabel">wxTreeCtrl::EndEditLabel</A>.<P>
Do not delete the text control yourself.<P>
This function is currently supported under Windows only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlendeditlabel">wxTreeCtrl::EndEditLabel</A><P>
<HR>
<A NAME="wxtreectrlendeditlabel"></A>
<H3>wxTreeCtrl::EndEditLabel</H3>
<P>
<B>void</B> <B>EndEditLabel</B>(<B>bool </B><I>cancelEdit</I>)<P>
Ends label editing. If <I>cancelEdit</I> is TRUE, the edit will be cancelled.<P>
This function is currently supported under Windows only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrleditlabel">wxTreeCtrl::EditLabel</A><P>
<HR>
<A NAME="wxtreectrlensurevisible"></A>
<H3>wxTreeCtrl::EnsureVisible</H3>
<P>
<B>void</B> <B>EnsureVisible</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Scrolls and/or expands items to ensure that the given item is visible.<P>
<HR>
<A NAME="wxtreectrlexpand"></A>
<H3>wxTreeCtrl::Expand</H3>
<P>
<B>void</B> <B>Expand</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Expands the given item.<P>
<HR>
<A NAME="wxtreectrlgetitemrect"></A>
<H3>wxTreeCtrl::GetBoundingRect</H3>
<P>
<B>bool</B> <B>GetBoundingRect</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>wxRect& </B><I>rect</I>, <B>bool </B><I>textOnly = FALSE</I>) <B>const</B><P>
Retrieves the rectangle bounding the <I>item</I>. If <I>textOnly</I> is TRUE,
only the rectangle around the items label will be returned, otherwise the
items image is also taken into account.<P>
The return value is TRUE if the rectangle was successfully retrieved or FALSE
if it was not (in this case <I>rect</I> is not changed) - for example, if the
item is currently invisible.<P>
<HR>
<A NAME="wxtreectrlgetchildrencount"></A>
<H3>wxTreeCtrl::GetChildrenCount</H3>
<P>
<B>size_t</B> <B>GetChildrenCount</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>bool</B><I> recursively = TRUE</I>) <B>const</B><P>
Returns the number of items in the branch. If <I>recursively</I> is TRUE, returns the total number
of descendants, otherwise only one level of children is counted.<P>
<HR>
<A NAME="wxtreectrlgetcount"></A>
<H3>wxTreeCtrl::GetCount</H3>
<P>
<B>int</B> <B>GetCount</B>() <B>const</B><P>
Returns the number of items in the control.<P>
<HR>
<A NAME="wxtreectrlgeteditcontrol"></A>
<H3>wxTreeCtrl::GetEditControl</H3>
<P>
<B>wxTextCtrl&</B> <B>GetEditControl</B>() <B>const</B><P>
Returns the edit control used to edit a label.<P>
<HR>
<A NAME="wxtreectrlgetfirstchild"></A>
<H3>wxTreeCtrl::GetFirstChild</H3>
<P>
<B>wxTreeItemId</B> <B>GetFirstChild</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>long& </B><I>cookie</I>) <B>const</B><P>
Returns the first child; call <A HREF="wx250.htm#wxtreectrlgetnextchild">wxTreeCtrl::GetNextChild</A> for the next child.<P>
For this enumeration function you must pass in a 'cookie' parameter
which is opaque for the application but is necessary for the library
to make these functions reentrant (i.e. allow more than one
enumeration on one and the same object simultaneously). The cookie passed to
GetFirstChild and GetNextChild should be the same.<P>
Returns an invalid tree item if there are no further children.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlgetnextchild">wxTreeCtrl::GetNextChild</A><P>
<HR>
<A NAME="wxtreectrlgetfirstvisibleitem"></A>
<H3>wxTreeCtrl::GetFirstVisibleItem</H3>
<P>
<B>wxTreeItemId</B> <B>GetFirstVisibleItem</B>() <B>const</B><P>
Returns the first visible item.<P>
<HR>
<A NAME="wxtreectrlgetimagelist"></A>
<H3>wxTreeCtrl::GetImageList</H3>
<P>
<B>wxImageList*</B> <B>GetImageList</B>(<B>int </B><I>which = wxIMAGE_LIST_NORMAL</I>) <B>const</B><P>
Returns the specified image list. <I>which</I> may be one of:<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxIMAGE_LIST_NORMAL</B>
</TD>
<TD VALIGN=TOP>
The normal (large icon) image list.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxIMAGE_LIST_SMALL</B>
</TD>
<TD VALIGN=TOP>
The small icon image list.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxIMAGE_LIST_STATE</B>
</TD>
<TD VALIGN=TOP>
The user-defined state image list (unimplemented).
</TD></TR>
</TABLE>
<P>
<HR>
<A NAME="wxtreectrlgetindent"></A>
<H3>wxTreeCtrl::GetIndent</H3>
<P>
<B>int</B> <B>GetIndent</B>() <B>const</B><P>
Returns the current tree control indentation.<P>
<HR>
<A NAME="wxtreectrlgetitemdata"></A>
<H3>wxTreeCtrl::GetItemData</H3>
<P>
<B>wxTreeItemData*</B> <B>GetItemData</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the tree item data associated with the item.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx251.htm#wxtreeitemdata">wxTreeItemData</A><P>
<HR>
<A NAME="wxtreectrlgetitemimage"></A>
<H3>wxTreeCtrl::GetItemImage</H3>
<P>
<B>int</B> <B>GetItemImage</B>(<B>const wxTreeItemId& </B><I>item</I>) <B>const</B><P>
Gets the normal item image.<P>
<HR>
<A NAME="wxtreectrlgetitemtext"></A>
<H3>wxTreeCtrl::GetItemText</H3>
<P>
<B>wxString</B> <B>GetItemText</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the item label.<P>
<HR>
<A NAME="wxtreectrlgetlastchild"></A>
<H3>wxTreeCtrl::GetLastChild</H3>
<P>
<B>wxTreeItemId</B> <B>GetLastChild</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the last child of the item (or an invalid tree item if this item has no children).<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlgetfirstchild">GetFirstChild</A>,
<A HREF="wx250.htm#wxtreectrlgetlastchild">GetLastChild</A><P>
<HR>
<A NAME="wxtreectrlgetnextchild"></A>
<H3>wxTreeCtrl::GetNextChild</H3>
<P>
<B>wxTreeItemId</B> <B>GetNextChild</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>long& </B><I>cookie</I>) <B>const</B><P>
Returns the next child; call <A HREF="wx250.htm#wxtreectrlgetfirstchild">wxTreeCtrl::GetFirstChild</A> for the first child.<P>
For this enumeration function you must pass in a 'cookie' parameter
which is opaque for the application but is necessary for the library
to make these functions reentrant (i.e. allow more than one
enumeration on one and the same object simultaneously). The cookie passed to
GetFirstChild and GetNextChild should be the same.<P>
Returns an invalid tree item if there are no further children.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlgetfirstchild">wxTreeCtrl::GetFirstChild</A><P>
<HR>
<A NAME="wxtreectrlgetnextsibling"></A>
<H3>wxTreeCtrl::GetNextSibling</H3>
<P>
<B>wxTreeItemId</B> <B>GetNextSibling</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the next sibling of the specified item; call <A HREF="wx250.htm#wxtreectrlgetprevsibling">wxTreeCtrl::GetPrevSibling</A> for the previous sibling.<P>
Returns an invalid tree item if there are no further siblings.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlgetprevsibling">wxTreeCtrl::GetPrevSibling</A><P>
<HR>
<A NAME="wxtreectrlgetnextvisible"></A>
<H3>wxTreeCtrl::GetNextVisible</H3>
<P>
<B>wxTreeItemId</B> <B>GetNextVisible</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the next visible item.<P>
<HR>
<A NAME="wxtreectrlgetparent"></A>
<H3>wxTreeCtrl::GetParent</H3>
<P>
<B>wxTreeItemId</B> <B>GetParent</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the item's parent.<P>
<HR>
<A NAME="wxtreectrlgetprevsibling"></A>
<H3>wxTreeCtrl::GetPrevSibling</H3>
<P>
<B>wxTreeItemId</B> <B>GetPrevSibling</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the previous sibling of the specified item; call <A HREF="wx250.htm#wxtreectrlgetnextsibling">wxTreeCtrl::GetNextSibling</A> for the next sibling.<P>
Returns an invalid tree item if there are no further children.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrlgetnextsibling">wxTreeCtrl::GetNextSibling</A><P>
<HR>
<A NAME="wxtreectrlgetprevvisible"></A>
<H3>wxTreeCtrl::GetPrevVisible</H3>
<P>
<B>wxTreeItemId</B> <B>GetPrevVisible</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns the previous visible item.<P>
<HR>
<A NAME="wxtreectrlgetrootitem"></A>
<H3>wxTreeCtrl::GetRootItem</H3>
<P>
<B>wxTreeItemId</B> <B>GetRootItem</B>() <B>const</B><P>
Returns the root item for the tree control.<P>
<HR>
<A NAME="wxtreectrlgetitemselectedimage"></A>
<H3>wxTreeCtrl::GetItemSelectedImage</H3>
<P>
<B>int</B> <B>GetItemSelectedImage</B>(<B>const wxTreeItemId& </B><I>item</I>) <B>const</B><P>
Gets the selected item image.<P>
<HR>
<A NAME="wxtreectrlgetselection"></A>
<H3>wxTreeCtrl::GetSelection</H3>
<P>
<B>wxTreeItemId</B> <B>GetSelection</B>() <B>const</B><P>
Returns the selection, or an invalid item if there is no selection.<P>
<HR>
<A NAME="wxtreectrlhittest"></A>
<H3>wxTreeCtrl::HitTest</H3>
<P>
<B>long</B> <B>HitTest</B>(<B>const wxPoint& </B><I>point</I>, <B>int& </B><I>flags</I>)<P>
Calculates which (if any) item is under the given point, returning extra information
in <I>flags</I>. <I>flags</I> is a bitlist of the following:<P>
<TABLE>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ABOVE
</TD>
<TD VALIGN=TOP>
Above the client area.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_BELOW
</TD>
<TD VALIGN=TOP>
Below the client area.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_NOWHERE
</TD>
<TD VALIGN=TOP>
In the client area but below the last item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMBUTTON
</TD>
<TD VALIGN=TOP>
On the button associated with an item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMICON
</TD>
<TD VALIGN=TOP>
On the bitmap associated with an item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMINDENT
</TD>
<TD VALIGN=TOP>
In the indentation associated with an item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMLABEL
</TD>
<TD VALIGN=TOP>
On the label (string) associated with an item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMRIGHT
</TD>
<TD VALIGN=TOP>
In the area to the right of an item.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_ONITEMSTATEICON
</TD>
<TD VALIGN=TOP>
On the state icon for a tree view item that is in a user-defined state.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_TOLEFT
</TD>
<TD VALIGN=TOP>
To the right of the client area.
</TD></TR>
<TR><TD VALIGN=TOP>
wxTREE_HITTEST_TORIGHT
</TD>
<TD VALIGN=TOP>
To the left of the client area.
</TD></TR>
</TABLE>
<P>
<HR>
<A NAME="wxtreectrlinsertitem"></A>
<H3>wxTreeCtrl::InsertItem</H3>
<P>
<B>wxTreeItemId</B> <B>InsertItem</B>(<B>const wxTreeItemId& </B><I>parent</I>, <B>const wxTreeItemId& </B><I>previous</I>, <B>const wxString&</B><I> text</I>,
<B>int</B><I> image = -1</I>, <B>int</B><I> selImage = -1</I>, <B>wxTreeItemData*</B><I> data = NULL</I>)<P>
Inserts an item after a given one.<P>
If <I>image</I> > -1 and <I>selImage</I> is -1, the same image is used for
both selected and unselected items.<P>
<HR>
<A NAME="wxtreectrlisbold"></A>
<H3>wxTreeCtrl::IsBold</H3>
<P>
<B>bool</B> <B>IsBold</B>(<B>const wxTreeItemId& </B><I>item</I>) <B>const</B><P>
Returns TRUE if the given item is in bold state.<P>
See also: <A HREF="wx250.htm#wxtreectrlsetitembold">SetItemBold</A><P>
<HR>
<A NAME="wxtreectrlisexpanded"></A>
<H3>wxTreeCtrl::IsExpanded</H3>
<P>
<B>bool</B> <B>IsExpanded</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns TRUE if the item is expanded (only makes sense if it has children).<P>
<HR>
<A NAME="wxtreectrlisselected"></A>
<H3>wxTreeCtrl::IsSelected</H3>
<P>
<B>bool</B> <B>IsSelected</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns TRUE if the item is selected.<P>
<HR>
<A NAME="wxtreectrlisvisible"></A>
<H3>wxTreeCtrl::IsVisible</H3>
<P>
<B>bool</B> <B>IsVisible</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns TRUE if the item is visible (it might be outside the view, or not expanded).<P>
<HR>
<A NAME="wxtreectrlitemhaschildren"></A>
<H3>wxTreeCtrl::ItemHasChildren</H3>
<P>
<B>bool</B> <B>ItemHasChildren</B>(<B>const wxTreeItemId&</B><I> item</I>) <B>const</B><P>
Returns TRUE if the item has children.<P>
<HR>
<A NAME="wxtreectrloncompareitems"></A>
<H3>wxTreeCtrl::OnCompareItems</H3>
<P>
<B>int</B> <B>OnCompareItems</B>(<B>const wxTreeItemId& </B><I>item1</I>, <B>const wxTreeItemId& </B><I>item2</I>)<P>
Override this function in the derived class to change the sort order of the
items in the tree control. The function should return a negative, zero or
positive value if the first item is less than, equal to or greater than the
second one.<P>
The base class version compares items alphabetically.<P>
See also: <A HREF="wx250.htm#wxtreectrlsortchildren">SortChildren</A><P>
<HR>
<A NAME="wxtreectrlprependitem"></A>
<H3>wxTreeCtrl::PrependItem</H3>
<P>
<B>wxTreeItemId</B> <B>PrependItem</B>(<B>const wxTreeItemId& </B><I>parent</I>, <B>const wxString&</B><I> text</I>,
<B>int</B><I> image = -1</I>, <B>int</B><I> selImage = -1</I>, <B>wxTreeItemData*</B><I> data = NULL</I>)<P>
Appends an item as the first child of <I>parent</I>, return a new item id.<P>
If <I>image</I> > -1 and <I>selImage</I> is -1, the same image is used for
both selected and unselected items.<P>
<HR>
<A NAME="wxtreectrlscrollto"></A>
<H3>wxTreeCtrl::ScrollTo</H3>
<P>
<B>void</B> <B>ScrollTo</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Scrolls the specified item into view.<P>
<HR>
<A NAME="wxtreectrlselectitem"></A>
<H3>wxTreeCtrl::SelectItem</H3>
<P>
<B>bool</B> <B>SelectItem</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Selects the given item.<P>
<HR>
<A NAME="wxtreectrlsetindent"></A>
<H3>wxTreeCtrl::SetIndent</H3>
<P>
<B>void</B> <B>SetIndent</B>(<B>int </B><I>indent</I>)<P>
Sets the indentation for the tree control.<P>
<HR>
<A NAME="wxtreectrlsetimagelist"></A>
<H3>wxTreeCtrl::SetImageList</H3>
<P>
<B>void</B> <B>SetImageList</B>(<B>wxImageList*</B><I> imageList</I>, <B>int </B><I>which = wxIMAGE_LIST_NORMAL</I>)<P>
Sets the image list. <I>which</I> should be one of wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL and
wxIMAGE_LIST_STATE.<P>
<HR>
<A NAME="wxtreectrlsetitembold"></A>
<H3>wxTreeCtrl::SetItemBold</H3>
<P>
<B>void</B> <B>SetItemBold</B>(<B>const wxTreeItemId& </B><I>item</I>, <B>bool</B><I> bold = TRUE</I>)<P>
Makes item appear in bold font if <I>bold</I> parameter is TRUE or resets it to
the normal state.<P>
See also: <A HREF="wx250.htm#wxtreectrlisbold">IsBold</A><P>
<HR>
<A NAME="wxtreectrlsetitemdata"></A>
<H3>wxTreeCtrl::SetItemData</H3>
<P>
<B>void</B> <B>SetItemData</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>wxTreeItemData* </B><I>data</I>)<P>
Sets the item client data.<P>
<HR>
<A NAME="wxtreectrlsetitemhaschildren"></A>
<H3>wxTreeCtrl::SetItemHasChildren</H3>
<P>
<B>void</B> <B>SetItemHasChildren</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>bool </B><I>hasChildren = TRUE</I>)<P>
Force appearance of the button next to the item. This is useful to
allow the user to expand the items which don't have any children now,
but instead adding them only when needed, thus minimizing memory
usage and loading time.<P>
<HR>
<A NAME="wxtreectrlsetitemimage"></A>
<H3>wxTreeCtrl::SetItemImage</H3>
<P>
<B>void</B> <B>SetItemImage</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>int </B><I>image</I>)<P>
Sets the normal item image. This is an index into the assciated image list.<P>
<HR>
<A NAME="wxtreectrlsetitemselectedimage"></A>
<H3>wxTreeCtrl::SetItemSelectedImage</H3>
<P>
<B>void</B> <B>SetItemSelectedImage</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>int </B><I>selImage</I>)<P>
Sets the item selected image. This is an index into the assciated image list.<P>
<HR>
<A NAME="wxtreectrlsetitemtext"></A>
<H3>wxTreeCtrl::SetItemText</H3>
<P>
<B>void</B> <B>SetItemText</B>(<B>const wxTreeItemId&</B><I> item</I>, <B>const wxString& </B><I>text</I>)<P>
Sets the item label.<P>
<HR>
<A NAME="wxtreectrlsortchildren"></A>
<H3>wxTreeCtrl::SortChildren</H3>
<P>
<B>void</B> <B>SortChildren</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Sorts the children of the given item using
<A HREF="wx250.htm#wxtreectrloncompareitems">OnCompareItems</A> method of wxTreeCtrl. You
should override that method to change the sort order (default is ascending
alphabetical order).<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx251.htm#wxtreeitemdata">wxTreeItemData</A>, <A HREF="wx250.htm#wxtreectrloncompareitems">OnCompareItems</A><P>
<HR>
<A NAME="wxtreectrltoggle"></A>
<H3>wxTreeCtrl::Toggle</H3>
<P>
<B>void</B> <B>Toggle</B>(<B>const wxTreeItemId&</B><I> item</I>)<P>
Toggles the given item between collapsed and expanded states.<P>
<HR>
<A NAME="wxtreectrlunselect"></A>
<H3>wxTreeCtrl::Unselect</H3>
<P>
<B>void</B> <B>Unselect</B>()<P>
Removes the selection from the currently selected item (if any).<P>
</BODY></HTML>
|