1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13const int wxTR_NO_BUTTONS;
14const int wxTR_HAS_BUTTONS;
15const int wxTR_NO_LINES;
16const int wxTR_LINES_AT_ROOT;
17const int wxTR_TWIST_BUTTONS;
18const int wxTR_SINGLE;
19const int wxTR_MULTIPLE;
20const int wxTR_HAS_VARIABLE_ROW_HEIGHT;
21const int wxTR_EDIT_LABELS;
22const int wxTR_ROW_LINES;
23const int wxTR_HIDE_ROOT;
24const int wxTR_FULL_ROW_HIGHLIGHT;
25const int wxTR_DEFAULT_STYLE;
26enum wxTreeItemIcon
27{
28    wxTreeItemIcon_Normal,
29    wxTreeItemIcon_Selected,
30    wxTreeItemIcon_Expanded,
31    wxTreeItemIcon_SelectedExpanded,
32    wxTreeItemIcon_Max
33};
34
35const int wxTREE_ITEMSTATE_NONE;
36
37const int wxTREE_ITEMSTATE_NEXT;
38
39const int wxTREE_ITEMSTATE_PREV;
40
41const int wxTREE_HITTEST_ABOVE;
42
43const int wxTREE_HITTEST_BELOW;
44
45const int wxTREE_HITTEST_NOWHERE;
46
47const int wxTREE_HITTEST_ONITEMBUTTON;
48
49const int wxTREE_HITTEST_ONITEMICON;
50
51const int wxTREE_HITTEST_ONITEMINDENT;
52
53const int wxTREE_HITTEST_ONITEMLABEL;
54
55const int wxTREE_HITTEST_ONITEMRIGHT;
56
57const int wxTREE_HITTEST_ONITEMSTATEICON;
58
59const int wxTREE_HITTEST_TOLEFT;
60
61const int wxTREE_HITTEST_TORIGHT;
62
63const int wxTREE_HITTEST_ONITEMUPPERPART;
64
65const int wxTREE_HITTEST_ONITEMLOWERPART;
66
67const int wxTREE_HITTEST_ONITEM;
68
69wxEventType wxEVT_TREE_BEGIN_DRAG   /PyName=wxEVT_TREE_BEGIN_DRAG/;
70
71wxEventType wxEVT_TREE_BEGIN_RDRAG   /PyName=wxEVT_TREE_BEGIN_RDRAG/;
72
73wxEventType wxEVT_TREE_BEGIN_LABEL_EDIT   /PyName=wxEVT_TREE_BEGIN_LABEL_EDIT/;
74
75wxEventType wxEVT_TREE_END_LABEL_EDIT   /PyName=wxEVT_TREE_END_LABEL_EDIT/;
76
77wxEventType wxEVT_TREE_DELETE_ITEM   /PyName=wxEVT_TREE_DELETE_ITEM/;
78
79wxEventType wxEVT_TREE_GET_INFO   /PyName=wxEVT_TREE_GET_INFO/;
80
81wxEventType wxEVT_TREE_SET_INFO   /PyName=wxEVT_TREE_SET_INFO/;
82
83wxEventType wxEVT_TREE_ITEM_EXPANDED   /PyName=wxEVT_TREE_ITEM_EXPANDED/;
84
85wxEventType wxEVT_TREE_ITEM_EXPANDING   /PyName=wxEVT_TREE_ITEM_EXPANDING/;
86
87wxEventType wxEVT_TREE_ITEM_COLLAPSED   /PyName=wxEVT_TREE_ITEM_COLLAPSED/;
88
89wxEventType wxEVT_TREE_ITEM_COLLAPSING   /PyName=wxEVT_TREE_ITEM_COLLAPSING/;
90
91wxEventType wxEVT_TREE_SEL_CHANGED   /PyName=wxEVT_TREE_SEL_CHANGED/;
92
93wxEventType wxEVT_TREE_SEL_CHANGING   /PyName=wxEVT_TREE_SEL_CHANGING/;
94
95wxEventType wxEVT_TREE_KEY_DOWN   /PyName=wxEVT_TREE_KEY_DOWN/;
96
97wxEventType wxEVT_TREE_ITEM_ACTIVATED   /PyName=wxEVT_TREE_ITEM_ACTIVATED/;
98
99wxEventType wxEVT_TREE_ITEM_RIGHT_CLICK   /PyName=wxEVT_TREE_ITEM_RIGHT_CLICK/;
100
101wxEventType wxEVT_TREE_ITEM_MIDDLE_CLICK   /PyName=wxEVT_TREE_ITEM_MIDDLE_CLICK/;
102
103wxEventType wxEVT_TREE_END_DRAG   /PyName=wxEVT_TREE_END_DRAG/;
104
105wxEventType wxEVT_TREE_STATE_IMAGE_CLICK   /PyName=wxEVT_TREE_STATE_IMAGE_CLICK/;
106
107wxEventType wxEVT_TREE_ITEM_GETTOOLTIP   /PyName=wxEVT_TREE_ITEM_GETTOOLTIP/;
108
109wxEventType wxEVT_TREE_ITEM_MENU   /PyName=wxEVT_TREE_ITEM_MENU/;
110
111typedef void* wxTreeItemIdValue;
112
113class wxTreeItemId
114{
115    %Docstring
116        TreeItemId()
117        TreeItemId(pItem)
118
119        An opaque reference to a tree item.
120    %End
121    %TypeHeaderCode
122        #include <wx/treebase.h>
123    %End
124
125public:
126    wxTreeItemId();
127
128    wxTreeItemId(
129        void* pItem
130    );
131
132    bool IsOk() const;
133    %Docstring
134        IsOk() -> bool
135
136        Returns true if this instance is referencing a valid tree item.
137    %End
138
139    void * GetID() const;
140    %Docstring
141        GetID() -> void
142    %End
143
144    void Unset();
145    %Docstring
146        Unset()
147    %End
148
149    int __nonzero__();
150    %Docstring
151        __nonzero__() -> int
152    %End
153    %MethodCode
154        PyErr_Clear();
155        Py_BEGIN_ALLOW_THREADS
156        sipRes = _wxTreeItemId___nonzero__(sipCpp);
157        Py_END_ALLOW_THREADS
158        if (PyErr_Occurred()) sipIsErr = 1;
159    %End
160    %TypeCode
161    int _wxTreeItemId___nonzero__(wxTreeItemId* self)
162    {
163        return self->IsOk();
164    }
165    %End
166
167    int __bool__();
168    %Docstring
169        __bool__() -> int
170    %End
171    %MethodCode
172        PyErr_Clear();
173        Py_BEGIN_ALLOW_THREADS
174        sipRes = _wxTreeItemId___bool__(sipCpp);
175        Py_END_ALLOW_THREADS
176        if (PyErr_Occurred()) sipIsErr = 1;
177    %End
178    %TypeCode
179    int _wxTreeItemId___bool__(wxTreeItemId* self)
180    {
181        return self->IsOk();
182    }
183    %End
184
185    bool __eq__(const wxTreeItemId& other);
186    %Docstring
187        __eq__(other) -> bool
188    %End
189    %MethodCode
190        PyErr_Clear();
191        Py_BEGIN_ALLOW_THREADS
192        sipRes = _wxTreeItemId___eq__(sipCpp, other);
193        Py_END_ALLOW_THREADS
194        if (PyErr_Occurred()) sipIsErr = 1;
195    %End
196    %TypeCode
197    bool _wxTreeItemId___eq__(wxTreeItemId* self, const wxTreeItemId* other)
198    {
199        return *self == *other;
200    }
201    %End
202
203    bool __ne__(const wxTreeItemId& other);
204    %Docstring
205        __ne__(other) -> bool
206    %End
207    %MethodCode
208        PyErr_Clear();
209        Py_BEGIN_ALLOW_THREADS
210        sipRes = _wxTreeItemId___ne__(sipCpp, other);
211        Py_END_ALLOW_THREADS
212        if (PyErr_Occurred()) sipIsErr = 1;
213    %End
214    %TypeCode
215    bool _wxTreeItemId___ne__(wxTreeItemId* self, const wxTreeItemId* other)
216    {
217        return *self != *other;
218    }
219    %End
220
221    public:
222
223
224    %Property(name=ID, get=GetID)
225};  // end of class wxTreeItemId
226
227
228%Extract(id=pycode_core)
229def _TreeItemId___hash__(self):
230    return hash(int(self.GetID()))
231TreeItemId.__hash__ = _TreeItemId___hash__
232del _TreeItemId___hash__
233%End
234
235const char* wxTreeCtrlNameStr;
236
237class wxTreeCtrl : wxControl
238{
239    %Docstring
240        TreeCtrl()
241        TreeCtrl(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TR_DEFAULT_STYLE, validator=DefaultValidator, name=TreeCtrlNameStr)
242
243        A tree control presents information as a hierarchy, with items that
244        may be expanded to show further items.
245    %End
246    %TypeHeaderCode
247        #include <wx/treectrl.h>
248    %End
249
250public:
251    wxTreeCtrl();
252    %PreMethodCode
253        if (!wxPyCheckForApp()) return NULL;
254    %End
255
256    wxTreeCtrl(
257        wxWindow * parent   /TransferThis/,
258        wxWindowID id = wxID_ANY,
259        const wxPoint & pos = wxDefaultPosition,
260        const wxSize & size = wxDefaultSize,
261        long style = wxTR_DEFAULT_STYLE,
262        const wxValidator & validator = wxDefaultValidator,
263        const wxString & name = wxTreeCtrlNameStr
264    );
265    %PreMethodCode
266        if (!wxPyCheckForApp()) return NULL;
267    %End
268
269    ~wxTreeCtrl();
270
271    wxTreeItemId AddRoot(
272        const wxString & text,
273        int image = -1,
274        int selImage = -1,
275        wxTreeItemData * data   /Transfer/ = NULL
276    );
277    %Docstring
278        AddRoot(text, image=-1, selImage=-1, data=None) -> TreeItemId
279
280        Adds the root node to the tree, returning the new item.
281    %End
282
283    wxTreeItemId AppendItem(
284        const wxTreeItemId & parent,
285        const wxString & text,
286        int image = -1,
287        int selImage = -1,
288        wxTreeItemData * data   /Transfer/ = NULL
289    );
290    %Docstring
291        AppendItem(parent, text, image=-1, selImage=-1, data=None) -> TreeItemId
292
293        Appends an item to the end of the branch identified by parent, return
294        a new item id.
295    %End
296
297    void AssignImageList(
298        wxImageList * imageList   /Transfer/
299    );
300    %Docstring
301        AssignImageList(imageList)
302
303        Sets the normal image list.
304    %End
305
306    void AssignStateImageList(
307        wxImageList * imageList   /Transfer/
308    );
309    %Docstring
310        AssignStateImageList(imageList)
311
312        Sets the state image list.
313    %End
314
315    void Collapse(
316        const wxTreeItemId & item
317    );
318    %Docstring
319        Collapse(item)
320
321        Collapses the given item.
322    %End
323
324    void CollapseAll();
325    %Docstring
326        CollapseAll()
327
328        Collapses the root item.
329    %End
330
331    void CollapseAllChildren(
332        const wxTreeItemId & item
333    );
334    %Docstring
335        CollapseAllChildren(item)
336
337        Collapses this item and all of its children, recursively.
338    %End
339
340    void CollapseAndReset(
341        const wxTreeItemId & item
342    );
343    %Docstring
344        CollapseAndReset(item)
345
346        Collapses the given item and removes all children.
347    %End
348
349    bool Create(
350        wxWindow * parent   /TransferThis/,
351        wxWindowID id = wxID_ANY,
352        const wxPoint & pos = wxDefaultPosition,
353        const wxSize & size = wxDefaultSize,
354        long style = wxTR_DEFAULT_STYLE,
355        const wxValidator & validator = wxDefaultValidator,
356        const wxString & name = wxTreeCtrlNameStr
357    );
358    %Docstring
359        Create(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TR_DEFAULT_STYLE, validator=DefaultValidator, name=TreeCtrlNameStr) -> bool
360
361        Creates the tree control.
362    %End
363
364    void Delete(
365        const wxTreeItemId & item
366    );
367    %Docstring
368        Delete(item)
369
370        Deletes the specified item.
371    %End
372
373    void DeleteAllItems();
374    %Docstring
375        DeleteAllItems()
376
377        Deletes all items in the control.
378    %End
379
380    void DeleteChildren(
381        const wxTreeItemId & item
382    );
383    %Docstring
384        DeleteChildren(item)
385
386        Deletes all children of the given item (but not the item itself).
387    %End
388
389    wxTextCtrl * EditLabel(
390        const wxTreeItemId & item
391    );
392    %Docstring
393        EditLabel(item) -> TextCtrl
394
395        Starts editing the label of the given item.
396    %End
397
398    void EnableBellOnNoMatch(
399        bool on = true
400    );
401    %Docstring
402        EnableBellOnNoMatch(on=True)
403
404        Enable or disable a beep if there is no match for the currently
405        entered text when searching for the item from keyboard.
406    %End
407
408    void EndEditLabel(
409        const wxTreeItemId & item,
410        bool discardChanges = false
411    );
412    %Docstring
413        EndEditLabel(item, discardChanges=False)
414
415        Ends label editing.
416    %End
417
418    void EnsureVisible(
419        const wxTreeItemId & item
420    );
421    %Docstring
422        EnsureVisible(item)
423
424        Scrolls and/or expands items to ensure that the given item is visible.
425    %End
426
427    void Expand(
428        const wxTreeItemId & item
429    );
430    %Docstring
431        Expand(item)
432
433        Expands the given item.
434    %End
435
436    void ExpandAll();
437    %Docstring
438        ExpandAll()
439
440        Expands all items in the tree.
441    %End
442
443    void ExpandAllChildren(
444        const wxTreeItemId & item
445    );
446    %Docstring
447        ExpandAllChildren(item)
448
449        Expands the given item and all its children recursively.
450    %End
451
452    PyObject* GetBoundingRect(const wxTreeItemId& item,  bool textOnly=false);
453    %Docstring
454        GetBoundingRect(item, textOnly=False) -> PyObject
455
456        Returns the rectangle bounding the item. If textOnly is true,
457        only the rectangle around the item's label will be returned, otherwise
458        the item's image is also taken into account. The return value may be
459        None
460        if the rectangle was not successfully retrieved, such as if the item
461        is
462        currently not visible.
463    %End
464    %MethodCode
465        PyErr_Clear();
466        Py_BEGIN_ALLOW_THREADS
467        sipRes = _wxTreeCtrl_GetBoundingRect(sipCpp, item, textOnly);
468        Py_END_ALLOW_THREADS
469        if (PyErr_Occurred()) sipIsErr = 1;
470    %End
471    %TypeCode
472    PyObject* _wxTreeCtrl_GetBoundingRect(wxTreeCtrl* self, const wxTreeItemId* item, bool textOnly)
473    {
474        wxRect rect;
475        if (self->GetBoundingRect(*item, rect, textOnly)) {
476            wxPyThreadBlocker blocker;
477            wxRect* r = new wxRect(rect);
478            PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), true);
479            return val;
480        }
481        else
482            RETURN_NONE();
483    }
484    %End
485
486    size_t GetChildrenCount(
487        const wxTreeItemId & item,
488        bool recursively = true
489    ) const;
490    %Docstring
491        GetChildrenCount(item, recursively=True) -> size_t
492
493        Returns the number of items in the branch.
494    %End
495
496    unsigned int GetCount() const;
497    %Docstring
498        GetCount() -> unsignedint
499
500        Returns the number of items in the control.
501    %End
502
503    wxTextCtrl * GetEditControl() const;
504    %Docstring
505        GetEditControl() -> TextCtrl
506
507        Returns the edit control being currently used to edit a label.
508    %End
509
510    wxTreeItemId GetFirstChild(
511        const wxTreeItemId & item,
512        wxTreeItemIdValue & cookie   /Out/
513    ) const;
514    %Docstring
515        GetFirstChild(item) -> (TreeItemId, cookie)
516
517        Returns the first child; call GetNextChild() for the next child.
518    %End
519
520    wxTreeItemId GetFirstVisibleItem() const;
521    %Docstring
522        GetFirstVisibleItem() -> TreeItemId
523
524        Returns the first visible item.
525    %End
526
527    wxTreeItemId GetFocusedItem() const;
528    %Docstring
529        GetFocusedItem() -> TreeItemId
530
531        Returns the item last clicked or otherwise selected.
532    %End
533
534    void ClearFocusedItem();
535    %Docstring
536        ClearFocusedItem()
537
538        Clears the currently focused item.
539    %End
540
541    void SetFocusedItem(
542        const wxTreeItemId & item
543    );
544    %Docstring
545        SetFocusedItem(item)
546
547        Sets the currently focused item.
548    %End
549
550    wxImageList * GetImageList() const;
551    %Docstring
552        GetImageList() -> ImageList
553
554        Returns the normal image list.
555    %End
556
557    unsigned int GetIndent() const;
558    %Docstring
559        GetIndent() -> unsignedint
560
561        Returns the current tree control indentation.
562    %End
563
564    wxColour GetItemBackgroundColour(
565        const wxTreeItemId & item
566    ) const;
567    %Docstring
568        GetItemBackgroundColour(item) -> Colour
569
570        Returns the background colour of the item.
571    %End
572
573    wxTreeItemData * GetItemData(
574        const wxTreeItemId & item
575    ) const;
576    %Docstring
577        GetItemData(item) -> TreeItemData
578
579        Returns the tree item data associated with the item.
580    %End
581
582    wxFont GetItemFont(
583        const wxTreeItemId & item
584    ) const;
585    %Docstring
586        GetItemFont(item) -> Font
587
588        Returns the font of the item label.
589    %End
590
591    int GetItemImage(
592        const wxTreeItemId & item,
593        wxTreeItemIcon which = wxTreeItemIcon_Normal
594    ) const;
595    %Docstring
596        GetItemImage(item, which=TreeItemIcon_Normal) -> int
597
598        Gets the specified item image.
599    %End
600
601    wxTreeItemId GetItemParent(
602        const wxTreeItemId & item
603    ) const;
604    %Docstring
605        GetItemParent(item) -> TreeItemId
606
607        Returns the item's parent.
608    %End
609
610    int GetItemState(
611        const wxTreeItemId & item
612    ) const;
613    %Docstring
614        GetItemState(item) -> int
615
616        Gets the specified item state.
617    %End
618
619    wxString GetItemText(
620        const wxTreeItemId & item
621    ) const;
622    %Docstring
623        GetItemText(item) -> String
624
625        Returns the item label.
626    %End
627
628    wxColour GetItemTextColour(
629        const wxTreeItemId & item
630    ) const;
631    %Docstring
632        GetItemTextColour(item) -> Colour
633
634        Returns the colour of the item label.
635    %End
636
637    wxTreeItemId GetLastChild(
638        const wxTreeItemId & item
639    ) const;
640    %Docstring
641        GetLastChild(item) -> TreeItemId
642
643        Returns the last child of the item (or an invalid tree item if this
644        item has no children).
645    %End
646
647    wxTreeItemId GetNextChild(
648        const wxTreeItemId & item,
649        wxTreeItemIdValue & cookie   /In, Out/
650    ) const;
651    %Docstring
652        GetNextChild(item, cookie) -> (TreeItemId, cookie)
653
654        Returns the next child; call GetFirstChild() for the first child.
655    %End
656
657    wxTreeItemId GetNextSibling(
658        const wxTreeItemId & item
659    ) const;
660    %Docstring
661        GetNextSibling(item) -> TreeItemId
662
663        Returns the next sibling of the specified item; call GetPrevSibling()
664        for the previous sibling.
665    %End
666
667    wxTreeItemId GetNextVisible(
668        const wxTreeItemId & item
669    ) const;
670    %Docstring
671        GetNextVisible(item) -> TreeItemId
672
673        Returns the next visible item or an invalid item if this item is the
674        last visible one.
675    %End
676
677    wxTreeItemId GetPrevSibling(
678        const wxTreeItemId & item
679    ) const;
680    %Docstring
681        GetPrevSibling(item) -> TreeItemId
682
683        Returns the previous sibling of the specified item; call
684        GetNextSibling() for the next sibling.
685    %End
686
687    wxTreeItemId GetPrevVisible(
688        const wxTreeItemId & item
689    ) const;
690    %Docstring
691        GetPrevVisible(item) -> TreeItemId
692
693        Returns the previous visible item or an invalid item if this item is
694        the first visible one.
695    %End
696
697    bool GetQuickBestSize() const;
698    %Docstring
699        GetQuickBestSize() -> bool
700
701        Returns true if the control will use a quick calculation for the best
702        size, looking only at the first and last items.
703    %End
704
705    wxTreeItemId GetRootItem() const;
706    %Docstring
707        GetRootItem() -> TreeItemId
708
709        Returns the root item for the tree control.
710    %End
711
712    wxTreeItemId GetSelection() const;
713    %Docstring
714        GetSelection() -> TreeItemId
715
716        Returns the selection, or an invalid item if there is no selection.
717    %End
718
719    PyObject* GetSelections();
720    %Docstring
721        GetSelections() -> PyObject
722
723        Returns a list of currently selected items in the tree.  This function
724        can be called only if the control has the wx.TR_MULTIPLE style.
725    %End
726    %MethodCode
727        PyErr_Clear();
728        Py_BEGIN_ALLOW_THREADS
729        sipRes = _wxTreeCtrl_GetSelections(sipCpp);
730        Py_END_ALLOW_THREADS
731        if (PyErr_Occurred()) sipIsErr = 1;
732    %End
733    %TypeCode
734    PyObject* _wxTreeCtrl_GetSelections(wxTreeCtrl* self)
735    {
736        wxPyThreadBlocker blocker;
737        PyObject*           rval = PyList_New(0);
738        wxArrayTreeItemIds  array;
739        size_t              num, x;
740        num = self->GetSelections(array);
741        for (x=0; x < num; x++) {
742            wxTreeItemId *tii = new wxTreeItemId(array.Item(x));
743            PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), true);
744            PyList_Append(rval, item);
745            Py_DECREF(item);
746        }
747        return rval;
748    }
749    %End
750
751    wxImageList * GetStateImageList() const;
752    %Docstring
753        GetStateImageList() -> ImageList
754
755        Returns the state image list (from which application-defined state
756        images are taken).
757    %End
758
759    wxTreeItemId HitTest(
760        const wxPoint & point,
761        int & flags
762    ) const;
763    %Docstring
764        HitTest(point, flags) -> TreeItemId
765
766        Calculates which (if any) item is under the given point, returning the
767        tree item id at this point plus extra information flags.
768    %End
769
770    wxTreeItemId InsertItem(
771        const wxTreeItemId & parent,
772        const wxTreeItemId & previous,
773        const wxString & text,
774        int image = -1,
775        int selImage = -1,
776        wxTreeItemData * data   /Transfer/ = NULL
777    );
778    %Docstring
779        InsertItem(parent, previous, text, image=-1, selImage=-1, data=None) -> TreeItemId
780        InsertItem(parent, pos, text, image=-1, selImage=-1, data=None) -> TreeItemId
781
782        Inserts an item after a given one (previous).
783    %End
784
785    wxTreeItemId InsertItem(
786        const wxTreeItemId & parent,
787        size_t pos,
788        const wxString & text,
789        int image = -1,
790        int selImage = -1,
791        wxTreeItemData * data   /Transfer/ = NULL
792    );
793
794    bool IsBold(
795        const wxTreeItemId & item
796    ) const;
797    %Docstring
798        IsBold(item) -> bool
799
800        Returns true if the given item is in bold state.
801    %End
802
803    bool IsEmpty() const;
804    %Docstring
805        IsEmpty() -> bool
806
807        Returns true if the control is empty (i.e. has no items, even no root
808        one).
809    %End
810
811    bool IsExpanded(
812        const wxTreeItemId & item
813    ) const;
814    %Docstring
815        IsExpanded(item) -> bool
816
817        Returns true if the item is expanded (only makes sense if it has
818        children).
819    %End
820
821    bool IsSelected(
822        const wxTreeItemId & item
823    ) const;
824    %Docstring
825        IsSelected(item) -> bool
826
827        Returns true if the item is selected.
828    %End
829
830    bool IsVisible(
831        const wxTreeItemId & item
832    ) const;
833    %Docstring
834        IsVisible(item) -> bool
835
836        Returns true if the item is visible on the screen.
837    %End
838
839    bool ItemHasChildren(
840        const wxTreeItemId & item
841    ) const;
842    %Docstring
843        ItemHasChildren(item) -> bool
844
845        Returns true if the item has children.
846    %End
847
848    virtual
849    int OnCompareItems(
850        const wxTreeItemId & item1,
851        const wxTreeItemId & item2
852    );
853    %Docstring
854        OnCompareItems(item1, item2) -> int
855
856        Override this function in the derived class to change the sort order
857        of the items in the tree control.
858    %End
859
860    wxTreeItemId PrependItem(
861        const wxTreeItemId & parent,
862        const wxString & text,
863        int image = -1,
864        int selImage = -1,
865        wxTreeItemData * data   /Transfer/ = NULL
866    );
867    %Docstring
868        PrependItem(parent, text, image=-1, selImage=-1, data=None) -> TreeItemId
869
870        Appends an item as the first child of parent, return a new item id.
871    %End
872
873    void ScrollTo(
874        const wxTreeItemId & item
875    );
876    %Docstring
877        ScrollTo(item)
878
879        Scrolls the specified item into view.
880    %End
881
882    void SelectItem(
883        const wxTreeItemId & item,
884        bool select = true
885    );
886    %Docstring
887        SelectItem(item, select=True)
888
889        Selects the given item.
890    %End
891
892    void SetImageList(
893        wxImageList * imageList
894    );
895    %Docstring
896        SetImageList(imageList)
897
898        Sets the normal image list.
899    %End
900
901    void SetIndent(
902        unsigned int indent
903    );
904    %Docstring
905        SetIndent(indent)
906
907        Sets the indentation for the tree control.
908    %End
909
910    void SetItemBackgroundColour(
911        const wxTreeItemId & item,
912        const wxColour & col
913    );
914    %Docstring
915        SetItemBackgroundColour(item, col)
916
917        Sets the colour of the item's background.
918    %End
919
920    void SetItemBold(
921        const wxTreeItemId & item,
922        bool bold = true
923    );
924    %Docstring
925        SetItemBold(item, bold=True)
926
927        Makes item appear in bold font if bold parameter is true or resets it
928        to the normal state.
929    %End
930
931    void SetItemData(
932        const wxTreeItemId & item,
933        wxTreeItemData * data   /Transfer/
934    );
935    %Docstring
936        SetItemData(item, data)
937
938        Sets the item client data.
939    %End
940
941    void SetItemDropHighlight(
942        const wxTreeItemId & item,
943        bool highlight = true
944    );
945    %Docstring
946        SetItemDropHighlight(item, highlight=True)
947
948        Gives the item the visual feedback for Drag'n'Drop actions, which is
949        useful if something is dragged from the outside onto the tree control
950        (as opposed to a DnD operation within the tree control, which already
951        is implemented internally).
952    %End
953
954    void SetItemFont(
955        const wxTreeItemId & item,
956        const wxFont & font
957    );
958    %Docstring
959        SetItemFont(item, font)
960
961        Sets the item's font.
962    %End
963
964    void SetItemHasChildren(
965        const wxTreeItemId & item,
966        bool hasChildren = true
967    );
968    %Docstring
969        SetItemHasChildren(item, hasChildren=True)
970
971        Force appearance of the button next to the item.
972    %End
973
974    void SetItemImage(
975        const wxTreeItemId & item,
976        int image,
977        wxTreeItemIcon which = wxTreeItemIcon_Normal
978    );
979    %Docstring
980        SetItemImage(item, image, which=TreeItemIcon_Normal)
981
982        Sets the specified item's image.
983    %End
984
985    void SetItemState(
986        const wxTreeItemId & item,
987        int state
988    );
989    %Docstring
990        SetItemState(item, state)
991
992        Sets the specified item state.
993    %End
994
995    void SetItemText(
996        const wxTreeItemId & item,
997        const wxString & text
998    );
999    %Docstring
1000        SetItemText(item, text)
1001
1002        Sets the item label.
1003    %End
1004
1005    void SetItemTextColour(
1006        const wxTreeItemId & item,
1007        const wxColour & col
1008    );
1009    %Docstring
1010        SetItemTextColour(item, col)
1011
1012        Sets the colour of the item's text.
1013    %End
1014
1015    void SetQuickBestSize(
1016        bool quickBestSize
1017    );
1018    %Docstring
1019        SetQuickBestSize(quickBestSize)
1020
1021        If true is passed, specifies that the control will use a quick
1022        calculation for the best size, looking only at the first and last
1023        items.
1024    %End
1025
1026    void SetStateImageList(
1027        wxImageList * imageList
1028    );
1029    %Docstring
1030        SetStateImageList(imageList)
1031
1032        Sets the state image list (from which application-defined state images
1033        are taken).
1034    %End
1035
1036    void SetWindowStyle(
1037        long styles
1038    );
1039    %Docstring
1040        SetWindowStyle(styles)
1041
1042        Sets the mode flags associated with the display of the tree control.
1043    %End
1044
1045    void SortChildren(
1046        const wxTreeItemId & item
1047    );
1048    %Docstring
1049        SortChildren(item)
1050
1051        Sorts the children of the given item using OnCompareItems().
1052    %End
1053
1054    void Toggle(
1055        const wxTreeItemId & item
1056    );
1057    %Docstring
1058        Toggle(item)
1059
1060        Toggles the given item between collapsed and expanded states.
1061    %End
1062
1063    void ToggleItemSelection(
1064        const wxTreeItemId & item
1065    );
1066    %Docstring
1067        ToggleItemSelection(item)
1068
1069        Toggles the given item between selected and unselected states.
1070    %End
1071
1072    void Unselect();
1073    %Docstring
1074        Unselect()
1075
1076        Removes the selection from the currently selected item (if any).
1077    %End
1078
1079    void UnselectAll();
1080    %Docstring
1081        UnselectAll()
1082
1083        This function either behaves the same as Unselect() if the control
1084        doesn't have wxTR_MULTIPLE style, or removes the selection from all
1085        items if it does have this style.
1086    %End
1087
1088    void UnselectItem(
1089        const wxTreeItemId & item
1090    );
1091    %Docstring
1092        UnselectItem(item)
1093
1094        Unselects the given item.
1095    %End
1096
1097    void SelectChildren(
1098        const wxTreeItemId & parent
1099    );
1100    %Docstring
1101        SelectChildren(parent)
1102
1103        Select all the immediate children of the given parent.
1104    %End
1105
1106    public:
1107    virtual wxPoint GetClientAreaOrigin() const;
1108    virtual bool Validate();
1109    virtual bool TransferDataToWindow();
1110    virtual bool TransferDataFromWindow();
1111    virtual void InitDialog();
1112    virtual bool AcceptsFocus() const;
1113    virtual bool AcceptsFocusRecursively() const;
1114    virtual bool AcceptsFocusFromKeyboard() const;
1115    virtual void AddChild( wxWindowBase *child );
1116    virtual void RemoveChild( wxWindowBase *child );
1117    virtual void InheritAttributes();
1118    virtual bool ShouldInheritColours() const;
1119    virtual void OnInternalIdle();
1120    virtual wxWindow *GetMainWindowOfCompositeControl();
1121    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
1122    virtual void SetCanFocus(bool canFocus);
1123    virtual bool Destroy();
1124    virtual void SetValidator( const wxValidator &validator );
1125    virtual wxValidator* GetValidator();
1126
1127
1128    protected:
1129    virtual bool ProcessEvent(wxEvent & event);
1130    virtual void DoEnable(bool enable);
1131    virtual void DoGetPosition(int *x, int *y) const;
1132    virtual void DoGetSize(int *width, int *height) const;
1133    virtual void DoGetClientSize(int *width, int *height) const;
1134    virtual wxSize DoGetBestSize() const;
1135    virtual wxSize DoGetBestClientSize() const;
1136    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
1137    virtual void DoSetClientSize(int width, int height);
1138    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
1139    virtual wxSize DoGetBorderSize() const;
1140    virtual void DoMoveWindow(int x, int y, int width, int height);
1141    virtual void DoSetWindowVariant( wxWindowVariant variant);
1142    virtual wxBorder GetDefaultBorder() const;
1143    virtual wxBorder GetDefaultBorderForControl() const;
1144    virtual void DoFreeze();
1145    virtual void DoThaw();
1146    virtual bool HasTransparentBackground();
1147    virtual bool TryBefore(wxEvent& event);
1148    virtual bool TryAfter(wxEvent& event);
1149
1150
1151    public:
1152
1153
1154    static
1155    wxVisualAttributes GetClassDefaultAttributes(
1156        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
1157    );
1158    %Docstring
1159        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
1160    %End
1161    %PreMethodCode
1162        if (!wxPyCheckForApp()) return NULL;
1163    %End
1164
1165    public:
1166
1167
1168    %Property(name=BoundingRect, get=GetBoundingRect)
1169    %Property(name=Count, get=GetCount)
1170    %Property(name=EditControl, get=GetEditControl)
1171    %Property(name=FirstVisibleItem, get=GetFirstVisibleItem)
1172    %Property(name=FocusedItem, get=GetFocusedItem, set=SetFocusedItem)
1173    %Property(name=ImageList, get=GetImageList, set=SetImageList)
1174    %Property(name=Indent, get=GetIndent, set=SetIndent)
1175    %Property(name=QuickBestSize, get=GetQuickBestSize, set=SetQuickBestSize)
1176    %Property(name=RootItem, get=GetRootItem)
1177    %Property(name=Selection, get=GetSelection)
1178    %Property(name=Selections, get=GetSelections)
1179    %Property(name=StateImageList, get=GetStateImageList, set=SetStateImageList)
1180};  // end of class wxTreeCtrl
1181
1182
1183%Extract(id=pycode_core)
1184TreeCtrl.GetItemPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.')
1185TreeCtrl.SetItemPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.')
1186TreeCtrl.GetPyData = wx.deprecated(TreeCtrl.GetItemData, 'Use GetItemData instead.')
1187TreeCtrl.SetPyData = wx.deprecated(TreeCtrl.SetItemData, 'Use SetItemData instead.')
1188
1189%End
1190
1191class wxTreeEvent : wxNotifyEvent
1192{
1193    %Docstring
1194        TreeEvent(commandType, tree, item=TreeItemId())
1195
1196        A tree event holds information about events associated with wxTreeCtrl
1197        objects.
1198    %End
1199    %TypeHeaderCode
1200        #include <wx/treectrl.h>
1201    %End
1202
1203public:
1204    wxTreeEvent(
1205        wxEventType commandType,
1206        wxTreeCtrl * tree,
1207        const wxTreeItemId & item = wxTreeItemId()
1208    );
1209
1210    wxTreeItemId GetItem() const;
1211    %Docstring
1212        GetItem() -> TreeItemId
1213
1214        Returns the item (valid for all events).
1215    %End
1216
1217    int GetKeyCode() const;
1218    %Docstring
1219        GetKeyCode() -> int
1220
1221        Returns the key code if the event is a key event.
1222    %End
1223
1224    const wxKeyEvent & GetKeyEvent() const;
1225    %Docstring
1226        GetKeyEvent() -> KeyEvent
1227
1228        Returns the key event for EVT_TREE_KEY_DOWN events.
1229    %End
1230
1231    const wxString & GetLabel() const;
1232    %Docstring
1233        GetLabel() -> String
1234
1235        Returns the label if the event is a begin or end edit label event.
1236    %End
1237
1238    wxTreeItemId GetOldItem() const;
1239    %Docstring
1240        GetOldItem() -> TreeItemId
1241
1242        Returns the old item index (valid for EVT_TREE_ITEM_CHANGING and
1243        EVT_TREE_ITEM_CHANGED events).
1244    %End
1245
1246    wxPoint GetPoint() const;
1247    %Docstring
1248        GetPoint() -> Point
1249
1250        Returns the position of the mouse pointer if the event is a drag or
1251        menu-context event.
1252    %End
1253
1254    bool IsEditCancelled() const;
1255    %Docstring
1256        IsEditCancelled() -> bool
1257
1258        Returns true if the label edit was cancelled.
1259    %End
1260
1261    void SetToolTip(
1262        const wxString & tooltip
1263    );
1264    %Docstring
1265        SetToolTip(tooltip)
1266
1267        Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP
1268        events).
1269    %End
1270
1271    public:
1272    virtual wxEvent* Clone() const /Factory/;
1273
1274
1275    private:
1276        wxTreeEvent& operator=(const wxTreeEvent&);
1277
1278
1279    public:
1280
1281
1282    %Property(name=Item, get=GetItem)
1283    %Property(name=KeyCode, get=GetKeyCode)
1284    %Property(name=KeyEvent, get=GetKeyEvent)
1285    %Property(name=Label, get=GetLabel)
1286    %Property(name=OldItem, get=GetOldItem)
1287    %Property(name=Point, get=GetPoint)
1288};  // end of class wxTreeEvent
1289
1290
1291%Extract(id=pycode_core)
1292def TreeItemData(data):
1293    return data
1294TreeItemData = deprecated(TreeItemData, "The TreeItemData class no longer exists, just pass your object directly to the tree instead.")
1295
1296%End
1297
1298%Extract(id=pycode_core)
1299EVT_TREE_BEGIN_DRAG        = PyEventBinder(wxEVT_TREE_BEGIN_DRAG       , 1)
1300EVT_TREE_BEGIN_RDRAG       = PyEventBinder(wxEVT_TREE_BEGIN_RDRAG      , 1)
1301EVT_TREE_BEGIN_LABEL_EDIT  = PyEventBinder(wxEVT_TREE_BEGIN_LABEL_EDIT , 1)
1302EVT_TREE_END_LABEL_EDIT    = PyEventBinder(wxEVT_TREE_END_LABEL_EDIT   , 1)
1303EVT_TREE_DELETE_ITEM       = PyEventBinder(wxEVT_TREE_DELETE_ITEM      , 1)
1304EVT_TREE_GET_INFO          = PyEventBinder(wxEVT_TREE_GET_INFO         , 1)
1305EVT_TREE_SET_INFO          = PyEventBinder(wxEVT_TREE_SET_INFO         , 1)
1306EVT_TREE_ITEM_EXPANDED     = PyEventBinder(wxEVT_TREE_ITEM_EXPANDED    , 1)
1307EVT_TREE_ITEM_EXPANDING    = PyEventBinder(wxEVT_TREE_ITEM_EXPANDING   , 1)
1308EVT_TREE_ITEM_COLLAPSED    = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSED   , 1)
1309EVT_TREE_ITEM_COLLAPSING   = PyEventBinder(wxEVT_TREE_ITEM_COLLAPSING  , 1)
1310EVT_TREE_SEL_CHANGED       = PyEventBinder(wxEVT_TREE_SEL_CHANGED      , 1)
1311EVT_TREE_SEL_CHANGING      = PyEventBinder(wxEVT_TREE_SEL_CHANGING     , 1)
1312EVT_TREE_KEY_DOWN          = PyEventBinder(wxEVT_TREE_KEY_DOWN         , 1)
1313EVT_TREE_ITEM_ACTIVATED    = PyEventBinder(wxEVT_TREE_ITEM_ACTIVATED   , 1)
1314EVT_TREE_ITEM_RIGHT_CLICK  = PyEventBinder(wxEVT_TREE_ITEM_RIGHT_CLICK , 1)
1315EVT_TREE_ITEM_MIDDLE_CLICK = PyEventBinder(wxEVT_TREE_ITEM_MIDDLE_CLICK, 1)
1316EVT_TREE_END_DRAG          = PyEventBinder(wxEVT_TREE_END_DRAG         , 1)
1317EVT_TREE_STATE_IMAGE_CLICK = PyEventBinder(wxEVT_TREE_STATE_IMAGE_CLICK, 1)
1318EVT_TREE_ITEM_GETTOOLTIP   = PyEventBinder(wxEVT_TREE_ITEM_GETTOOLTIP,   1)
1319EVT_TREE_ITEM_MENU         = PyEventBinder(wxEVT_TREE_ITEM_MENU,         1)
1320
1321# deprecated wxEVT aliases
1322wxEVT_COMMAND_TREE_BEGIN_DRAG         = wxEVT_TREE_BEGIN_DRAG
1323wxEVT_COMMAND_TREE_BEGIN_RDRAG        = wxEVT_TREE_BEGIN_RDRAG
1324wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT   = wxEVT_TREE_BEGIN_LABEL_EDIT
1325wxEVT_COMMAND_TREE_END_LABEL_EDIT     = wxEVT_TREE_END_LABEL_EDIT
1326wxEVT_COMMAND_TREE_DELETE_ITEM        = wxEVT_TREE_DELETE_ITEM
1327wxEVT_COMMAND_TREE_GET_INFO           = wxEVT_TREE_GET_INFO
1328wxEVT_COMMAND_TREE_SET_INFO           = wxEVT_TREE_SET_INFO
1329wxEVT_COMMAND_TREE_ITEM_EXPANDED      = wxEVT_TREE_ITEM_EXPANDED
1330wxEVT_COMMAND_TREE_ITEM_EXPANDING     = wxEVT_TREE_ITEM_EXPANDING
1331wxEVT_COMMAND_TREE_ITEM_COLLAPSED     = wxEVT_TREE_ITEM_COLLAPSED
1332wxEVT_COMMAND_TREE_ITEM_COLLAPSING    = wxEVT_TREE_ITEM_COLLAPSING
1333wxEVT_COMMAND_TREE_SEL_CHANGED        = wxEVT_TREE_SEL_CHANGED
1334wxEVT_COMMAND_TREE_SEL_CHANGING       = wxEVT_TREE_SEL_CHANGING
1335wxEVT_COMMAND_TREE_KEY_DOWN           = wxEVT_TREE_KEY_DOWN
1336wxEVT_COMMAND_TREE_ITEM_ACTIVATED     = wxEVT_TREE_ITEM_ACTIVATED
1337wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK   = wxEVT_TREE_ITEM_RIGHT_CLICK
1338wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK  = wxEVT_TREE_ITEM_MIDDLE_CLICK
1339wxEVT_COMMAND_TREE_END_DRAG           = wxEVT_TREE_END_DRAG
1340wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK  = wxEVT_TREE_STATE_IMAGE_CLICK
1341wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP    = wxEVT_TREE_ITEM_GETTOOLTIP
1342wxEVT_COMMAND_TREE_ITEM_MENU          = wxEVT_TREE_ITEM_MENU
1343
1344%End
1345
1346
1347//---------------------------------------------------------------------------
1348
1349