1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     wxTreeListCtrl and helpers
 
   7 // Created:     12-Sept-2006
 
   9 // Copyright:   (c) 2006 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  19 #include "wx/treelistctrl.h"
 
  20 #include "wx/wxPython/pytree.h"
 
  24 //---------------------------------------------------------------------------
 
  28 MAKE_CONST_WXSTRING2(TreeListCtrlNameStr,    wxT("treelistctrl"));
 
  31 //----------------------------------------------------------------------------
 
  32 // wxTreeListCtrl - the multicolumn tree control
 
  33 //----------------------------------------------------------------------------
 
  38     DEFAULT_COL_WIDTH = 100
 
  41 // modes for navigation
 
  43     wxTL_MODE_NAV_FULLTREE,
 
  44     wxTL_MODE_NAV_EXPANDED,
 
  45     wxTL_MODE_NAV_VISIBLE,
 
  52     wxTL_MODE_FIND_PARTIAL,
 
  56 // additional flag for HitTest
 
  58     wxTREE_HITTEST_ONITEMCOLUMN
 
  60 %pythoncode { wx.TREE_HITTEST_ONITEMCOLUMN = TREE_HITTEST_ONITEMCOLUMN }
 
  63 // additional style flags
 
  65     wxTR_COLUMN_LINES, // put border around items
 
  66     wxTR_VIRTUAL      // The application provides items text on demand.
 
  69     wx.TR_COLUMN_LINES = TR_COLUMN_LINES
 
  70     wxTR_VIRTUAL = TR_VIRTUAL    
 
  75 %#// Compatibility aliases for old names/values
 
  76 TL_ALIGN_LEFT   = wx.ALIGN_LEFT
 
  77 TL_ALIGN_RIGHT  = wx.ALIGN_RIGHT
 
  78 TL_ALIGN_CENTER = wx.ALIGN_CENTER
 
  80 TL_SEARCH_VISIBLE = TL_MODE_NAV_VISIBLE
 
  81 TL_SEARCH_LEVEL   = TL_MODE_NAV_LEVEL
 
  82 TL_SEARCH_FULL    = TL_MODE_FIND_EXACT
 
  83 TL_SEARCH_PARTIAL = TL_MODE_FIND_PARTIAL
 
  84 TL_SEARCH_NOCASE  = TL_MODE_FIND_NOCASE
 
  86 TR_DONT_ADJUST_MAC = 0
 
  87 wx.TR_DONT_ADJUST_MAC = TR_DONT_ADJUST_MAC
 
  93 class wxTreeListColumnInfo: public wxObject {
 
  95     wxTreeListColumnInfo(const wxString& text = wxPyEmptyString,
 
  96                          int width = DEFAULT_COL_WIDTH,
 
  97                          int flag = wxALIGN_LEFT,
 
 102     ~wxTreeListColumnInfo();
 
 104     int GetAlignment() const;
 
 105     wxString GetText() const;
 
 106     int GetImage() const;
 
 107     int GetSelectedImage() const;
 
 108     size_t GetWidth() const;
 
 109     bool IsEditable() const { return m_edit; }
 
 110     bool IsShown() const { return m_shown; }
 
 112     // TODO:  These all actually return wxTreeListColumnInfo&, any problem with doing it for Python too?
 
 113     void SetAlignment(int alignment);
 
 114     void SetText(const wxString& text);
 
 115     void SetImage(int image);
 
 116     void SetSelectedImage(int image);
 
 117     void SetWidth(size_t with);
 
 118     void SetEditable (bool edit);
 
 119     void SetShown(bool shown);
 
 121     %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
 
 122     %property(Image, GetImage, SetImage, doc="See `GetImage` and `SetImage`");
 
 123     %property(SelectedImage, GetSelectedImage, SetSelectedImage, doc="See `GetSelectedImage` and `SetSelectedImage`");
 
 124     %property(Text, GetText, SetText, doc="See `GetText` and `SetText`");
 
 125     %property(Width, GetWidth, SetWidth, doc="See `GetWidth` and `SetWidth`");
 
 126     %property(Editable, IsEditable, SetEditable);
 
 127     %property(Shown, IsShown, SetShown);
 
 133 %{ // C++ version of Python aware control
 
 134 class wxPyTreeListCtrl : public wxTreeListCtrl {
 
 135     DECLARE_ABSTRACT_CLASS(wxPyTreeListCtrl);
 
 137     wxPyTreeListCtrl() : wxTreeListCtrl() {}
 
 138     wxPyTreeListCtrl(wxWindow *parent, wxWindowID id,
 
 142                      const wxValidator &validator,
 
 143                      const wxString& name) :
 
 144         wxTreeListCtrl(parent, id, pos, size, style, validator, name) {}
 
 146     virtual int OnCompareItems(const wxTreeItemId& item1,
 
 147                                const wxTreeItemId& item2) {
 
 150         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 151         if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) {
 
 152             PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0);
 
 153             PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0);
 
 154             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",o1,o2));
 
 158         wxPyEndBlockThreads(blocked);
 
 160             rval = wxTreeListCtrl::OnCompareItems(item1, item2);
 
 164     virtual wxString  OnGetItemText( wxTreeItemData* item, long column ) const {
 
 167         wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 168         if ((found = wxPyCBH_findCallback(m_myInst, "OnGetItemText"))) {
 
 170             PyObject* itemo = wxPyConstructObject((void*)&item, wxT("wxTreeItemId"), 0);
 
 171             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", itemo, column));
 
 174                 rval = Py2wxString(ro);
 
 178         wxPyEndBlockThreads(blocked);
 
 180             rval = wxTreeListCtrl::OnGetItemText(item, column);
 
 187 IMPLEMENT_ABSTRACT_CLASS(wxPyTreeListCtrl, wxTreeListCtrl)
 
 196 MustHaveApp(wxPyTreeListCtrl);
 
 198 %rename(TreeListCtrl) wxPyTreeListCtrl;
 
 199 class wxPyTreeListCtrl : public wxControl
 
 202     %pythonAppend wxPyTreeListCtrl         "self._setOORInfo(self);" setCallbackInfo(TreeListCtrl)
 
 203     %pythonAppend wxPyTreeListCtrl()       ""
 
 205     wxPyTreeListCtrl(wxWindow *parent, wxWindowID id = -1,
 
 206                    const wxPoint& pos = wxDefaultPosition,
 
 207                    const wxSize& size = wxDefaultSize,
 
 208                    long style = wxTR_DEFAULT_STYLE,
 
 209                    const wxValidator &validator = wxDefaultValidator,
 
 210                    const wxString& name = wxPyTreeListCtrlNameStr );
 
 211     %RenameCtor(PreTreeListCtrl, wxPyTreeListCtrl());
 
 213     bool Create(wxWindow *parent, wxWindowID id = -1,
 
 214                 const wxPoint& pos = wxDefaultPosition,
 
 215                 const wxSize& size = wxDefaultSize,
 
 216                 long style = wxTR_DEFAULT_STYLE,
 
 217                 const wxValidator &validator = wxDefaultValidator,
 
 218                 const wxString& name = wxPyTreeListCtrlNameStr );
 
 220     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
 223     // get the total number of items in the control
 
 224     size_t GetCount() const;
 
 226     // indent is the number of pixels the children are indented relative to
 
 227     // the parents position. SetIndent() also redraws the control
 
 229     unsigned int GetIndent() const;
 
 230     void SetIndent(unsigned int indent);
 
 232     // line spacing is the space above and below the text on each line
 
 233     unsigned int GetLineSpacing() const;
 
 234     void SetLineSpacing(unsigned int spacing);
 
 236     // image list: these functions allow to associate an image list with
 
 237     // the control and retrieve it. Note that when assigned with
 
 238     // SetImageList, the control does _not_ delete
 
 239     // the associated image list when it's deleted in order to allow image
 
 240     // lists to be shared between different controls. If you use
 
 241     // AssignImageList, the control _does_ delete the image list.
 
 243     // The normal image list is for the icons which correspond to the
 
 244     // normal tree item state (whether it is selected or not).
 
 245     // Additionally, the application might choose to show a state icon
 
 246     // which corresponds to an app-defined item state (for example,
 
 247     // checked/unchecked) which are taken from the state image list.
 
 248     wxImageList *GetImageList() const;
 
 249     wxImageList *GetStateImageList() const;
 
 250     wxImageList *GetButtonsImageList() const;
 
 252     void SetImageList(wxImageList *imageList);
 
 253     void SetStateImageList(wxImageList *imageList);
 
 254     void SetButtonsImageList(wxImageList *imageList);
 
 256     %disownarg( wxImageList *imageList );
 
 257     void AssignImageList(wxImageList *imageList);
 
 258     void AssignStateImageList(wxImageList *imageList);
 
 259     void AssignButtonsImageList(wxImageList *imageList);
 
 260     %cleardisown( wxImageList *imageList );
 
 264     void AddColumn (const wxString& text,
 
 265                     int width = DEFAULT_COL_WIDTH,
 
 266                     int flag = wxALIGN_LEFT,
 
 270     %Rename(AddColumnInfo,  void,  AddColumn(const wxTreeListColumnInfo& col));
 
 272     // inserts a column before the given one
 
 273     void InsertColumn (int before,
 
 274                        const wxString& text,
 
 275                        int width = DEFAULT_COL_WIDTH,
 
 276                        int flag = wxALIGN_LEFT,
 
 280     %Rename(InsertColumnInfo,  void,  InsertColumn(size_t before, const wxTreeListColumnInfo& col));
 
 282     // deletes the given column - does not delete the corresponding column
 
 284     void RemoveColumn(size_t column);
 
 286     // returns the number of columns in the ctrl
 
 287     size_t GetColumnCount() const;
 
 289     // tells which column is the "main" one, i.e. the "threaded" one
 
 290     void SetMainColumn(size_t column);
 
 291     size_t GetMainColumn() const;
 
 293     void SetColumn (int column, const wxTreeListColumnInfo& colInfo);
 
 294     wxTreeListColumnInfo& GetColumn (int column);
 
 296     void SetColumnText (int column, const wxString& text);
 
 297     wxString GetColumnText (int column) const;
 
 299     void SetColumnWidth (int column, int width);
 
 300     int GetColumnWidth (int column) const;
 
 302     void SetColumnAlignment (int column, int flag);
 
 303     int GetColumnAlignment (int column) const;
 
 305     void SetColumnImage (int column, int image);
 
 306     int GetColumnImage (int column) const;
 
 308     void SetColumnShown (int column, bool shown = true);
 
 309     bool IsColumnShown (int column) const;
 
 310     %pythoncode { ShowColumn = SetColumnShown }
 
 312     void SetColumnEditable (int column, bool edit = true);
 
 313     bool IsColumnEditable (int column) const;
 
 319         // retrieves item's label of the given column (main column by default)
 
 320         wxString GetItemText(const wxTreeItemId& item, int column = -1) {
 
 321             if (column < 0) column = self->GetMainColumn();
 
 322             return self->GetItemText(item, column);
 
 325         // get one of the images associated with the item (normal by default)
 
 326         int GetItemImage(const wxTreeItemId& item, int column = -1,
 
 327                          wxTreeItemIcon which = wxTreeItemIcon_Normal) {
 
 328             if (column < 0) column = self->GetMainColumn();
 
 329             return self->GetItemImage(item, column, which);
 
 332         // set item's label (main column by default)
 
 333         void SetItemText(const wxTreeItemId& item, const wxString& text, int column = -1) {
 
 334             if (column < 0) column = self->GetMainColumn();
 
 335             self->SetItemText(item, column, text);
 
 338         // set one of the images associated with the item (normal by default)
 
 339         // the which parameter is ignored for all columns but the main one
 
 340         void SetItemImage(const wxTreeItemId& item, int image, int column = -1,
 
 341                           wxTreeItemIcon which = wxTreeItemIcon_Normal) {
 
 342             if (column < 0) column = self->GetMainColumn();
 
 343             self->SetItemImage(item, column, image, which);
 
 347         // [Get|Set]ItemData substitutes.  Automatically create wxPyTreeItemData
 
 349         wxPyTreeItemData* GetItemData(const wxTreeItemId& item) {
 
 350             wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
 
 352                 data = new wxPyTreeItemData();
 
 353                 data->SetId(item); // set the id
 
 354                 self->SetItemData(item, data);
 
 359         %disownarg( wxPyTreeItemData* data );
 
 360         void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
 
 361             data->SetId(item); // set the id
 
 362             self->SetItemData(item, data);
 
 364         %cleardisown(wxPyTreeItemData* data );
 
 366         // [Get|Set]ItemPyData are short-cuts.  Also made somewhat crash-proof by
 
 367         // automatically creating data classes.
 
 368         PyObject* GetItemPyData(const wxTreeItemId& item) {
 
 369             wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
 
 371                 data = new wxPyTreeItemData();
 
 372                 data->SetId(item); // set the id
 
 373                 self->SetItemData(item, data);
 
 375             return data->GetData();
 
 378         void SetItemPyData(const wxTreeItemId& item, PyObject* obj) {
 
 379             wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
 
 381                 data = new wxPyTreeItemData(obj);
 
 382                 data->SetId(item); // set the id
 
 383                 self->SetItemData(item, data);
 
 388     %pythoncode { GetPyData = GetItemPyData }
 
 389     %pythoncode { SetPyData = SetItemPyData }
 
 392     bool GetItemBold(const wxTreeItemId& item) const;
 
 393     wxColour GetItemTextColour(const wxTreeItemId& item) const;
 
 394     wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
 
 395     wxFont GetItemFont(const wxTreeItemId& item) const;
 
 398     // force appearance of [+] button near the item. This is useful to
 
 399     // allow the user to expand the items which don't have any children now
 
 400     // - but instead add them only when needed, thus minimizing memory
 
 401     // usage and loading time.
 
 402     void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
 
 404     // the item will be shown in bold
 
 405     void SetItemBold(const wxTreeItemId& item, bool bold = true);
 
 407     // set the item's text colour
 
 408     void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour);
 
 410     // set the item's background colour
 
 411     void SetItemBackgroundColour(const wxTreeItemId& item,
 
 412                                  const wxColour& colour);
 
 414     // set the item's font (should be of the same height for all items)
 
 415     void SetItemFont(const wxTreeItemId& item, const wxFont& font);
 
 419     // is the item visible (it might be outside the view or not expanded)?
 
 420     bool IsVisible(const wxTreeItemId& item) const;
 
 422     // does the item has any children?
 
 423     bool HasChildren(const wxTreeItemId& item) const;
 
 424     %pythoncode { ItemHasChildren = HasChildren }
 
 426     // is the item expanded (only makes sense if HasChildren())?
 
 427     bool IsExpanded(const wxTreeItemId& item) const;
 
 429     // is this item currently selected (the same as has focus)?
 
 430     bool IsSelected(const wxTreeItemId& item) const;
 
 432     // is item text in bold font?
 
 433     bool IsBold(const wxTreeItemId& item) const;
 
 436     // if 'recursively' is False, only immediate children count, otherwise
 
 437     // the returned number is the number of all items in this branch
 
 438     size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true);
 
 441     // wxTreeItemId.IsOk() will return False if there is no such item
 
 443     // get the root tree item
 
 444     wxTreeItemId GetRootItem() const;
 
 446     // get the item currently selected (may return NULL if no selection)
 
 447     wxTreeItemId GetSelection() const;
 
 449     // get the items currently selected, return the number of such item
 
 450     //size_t GetSelections(wxArrayTreeItemIds&) const;
 
 452         PyObject* GetSelections() {
 
 453             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 454             PyObject*           rval = PyList_New(0);
 
 455             wxArrayTreeItemIds  array;
 
 457             num = self->GetSelections(array);
 
 458             for (x=0; x < num; x++) {
 
 459                 wxTreeItemId *tii = new wxTreeItemId(array.Item(x));
 
 460                 PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), true);
 
 461                 PyList_Append(rval, item);
 
 464             wxPyEndBlockThreads(blocked);
 
 470     // get the parent of this item (may return NULL if root)
 
 471     wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
 
 473     // for this enumeration function you must pass in a "cookie" parameter
 
 474     // which is opaque for the application but is necessary for the library
 
 475     // to make these functions reentrant (i.e. allow more than one
 
 476     // enumeration on one and the same object simultaneously). Of course,
 
 477     // the "cookie" passed to GetFirstChild() and GetNextChild() should be
 
 481     // NOTE: These are a copy of the same methods in _treectrl.i, be sure to
 
 482     // update both at the same time.  (Or find a good way to refactor!)
 
 484         // Get the first child of this item.  Returns a wxTreeItemId and an
 
 485         // opaque "cookie" value that should be passed to GetNextChild in
 
 486         // order to continue the search.
 
 487         PyObject* GetFirstChild(const wxTreeItemId& item) {
 
 489             wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie));
 
 490             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 491             PyObject* tup = PyTuple_New(2);
 
 492             PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
 
 493             PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
 
 494             wxPyEndBlockThreads(blocked);
 
 499         // Get the next child of this item.  The cookie parameter is the 2nd
 
 500         // value returned from GetFirstChild or the previous GetNextChild.
 
 501         // Returns a wxTreeItemId and an opaque "cookie" value that should be
 
 502         // passed to GetNextChild in order to continue the search.
 
 503         PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) {
 
 504             wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie));
 
 505             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 506             PyObject* tup = PyTuple_New(2);
 
 507             PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
 
 508             PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
 
 509             wxPyEndBlockThreads(blocked);
 
 514         PyObject* GetLastChild(const wxTreeItemId& item) {
 
 516             wxTreeItemId* ritem = new wxTreeItemId(self->GetLastChild(item, cookie));
 
 517             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 518             PyObject* tup = PyTuple_New(2);
 
 519             PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
 
 520             PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
 
 521             wxPyEndBlockThreads(blocked);
 
 526         PyObject* GetPrevChild(const wxTreeItemId& item, void* cookie) {
 
 527             wxTreeItemId* ritem = new wxTreeItemId(self->GetPrevChild(item, cookie));
 
 528             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 529             PyObject* tup = PyTuple_New(2);
 
 530             PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true));
 
 531             PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void")));
 
 532             wxPyEndBlockThreads(blocked);
 
 538     // get the next sibling of this item
 
 539     wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
 
 541     // get the previous sibling
 
 542     wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
 
 545     // get item in the full tree (currently only for internal use)
 
 546     wxTreeItemId GetNext(const wxTreeItemId& item) const;
 
 547     wxTreeItemId GetPrev(const wxTreeItemId& item) const;
 
 549      // get expanded item, see IsExpanded()
 
 550     wxTreeItemId GetFirstExpandedItem() const;
 
 551     wxTreeItemId GetNextExpanded(const wxTreeItemId& item) const;
 
 552     wxTreeItemId GetPrevExpanded(const wxTreeItemId& item) const;
 
 554     // get visible item, see IsVisible()
 
 555     wxTreeItemId GetFirstVisibleItem(bool fullRow = false) const;
 
 556     wxTreeItemId GetNextVisible(const wxTreeItemId& item, bool fullRow = false) const;
 
 557     wxTreeItemId GetPrevVisible(const wxTreeItemId& item, bool fullRow = false) const;
 
 561     %disownarg( wxPyTreeItemData* data );
 
 563     // add the root node to the tree
 
 564     wxTreeItemId AddRoot(const wxString& text,
 
 565                          int image = -1, int selectedImage = -1,
 
 566                          wxPyTreeItemData *data = NULL);
 
 568     // insert a new item in as the first child of the parent
 
 569     wxTreeItemId PrependItem(const wxTreeItemId& parent,
 
 570                              const wxString& text,
 
 571                              int image = -1, int selectedImage = -1,
 
 572                              wxPyTreeItemData *data = NULL);
 
 574     // insert a new item after a given one
 
 575     wxTreeItemId InsertItem(const wxTreeItemId& parent,
 
 576                             const wxTreeItemId& idPrevious,
 
 577                             const wxString& text,
 
 578                             int image = -1, int selectedImage = -1,
 
 579                             wxPyTreeItemData *data = NULL);
 
 581     // insert a new item before the one with the given index
 
 582     %Rename(InsertItemBefore,
 
 583         wxTreeItemId,  InsertItem(const wxTreeItemId& parent,
 
 585                                 const wxString& text,
 
 586                                 int image = -1, int selectedImage = -1,
 
 587                                 wxPyTreeItemData *data = NULL));
 
 589     // insert a new item in as the last child of the parent
 
 590     wxTreeItemId AppendItem(const wxTreeItemId& parent,
 
 591                             const wxString& text,
 
 592                             int image = -1, int selectedImage = -1,
 
 593                             wxPyTreeItemData *data = NULL);
 
 595     %cleardisown(wxPyTreeItemData* data );
 
 597     // delete this item and associated data if any
 
 598     void Delete(const wxTreeItemId& item);
 
 600     // delete all children (but don't delete the item itself)
 
 601     // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
 
 602     void DeleteChildren(const wxTreeItemId& item);
 
 604     // delete all items from the tree
 
 605     // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
 
 607     %pythoncode { DeleteAllItems = DeleteRoot }
 
 612     void Expand(const wxTreeItemId& item);
 
 614     // expand this item and all subitems recursively
 
 615     void ExpandAll(const wxTreeItemId& item);
 
 617     // collapse the item without removing its children
 
 618     void Collapse(const wxTreeItemId& item);
 
 620     // collapse the item and remove all children
 
 621     void CollapseAndReset(const wxTreeItemId& item);
 
 623     // toggles the current state
 
 624     void Toggle(const wxTreeItemId& item);
 
 626     // remove the selection from currently selected item (if any)
 
 631     void SelectItem(const wxTreeItemId& item,
 
 632                     const wxTreeItemId& last = (wxTreeItemId*)NULL,
 
 633                     bool unselect_others=true);
 
 637     // make sure this item is visible (expanding the parent item and/or
 
 638     // scrolling to this item if necessary)
 
 639     void EnsureVisible(const wxTreeItemId& item);
 
 641     // scroll to this item (but don't expand its parent)
 
 642     void ScrollTo(const wxTreeItemId& item);
 
 644     // Returns wxTreeItemId, flags, and column
 
 645     wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT, int& OUTPUT);
 
 648         // get the bounding rectangle of the item (or of its label only)
 
 649         PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = false) {
 
 651             if (self->GetBoundingRect(item, rect, textOnly)) {
 
 652                 wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 653                 wxRect* r = new wxRect(rect);
 
 654                 PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1);
 
 655                 wxPyEndBlockThreads(blocked);
 
 666         // Start editing the item label: this (temporarily) replaces the item
 
 667         // with a one line edit control. The item will be selected if it hadn't
 
 669         void EditLabel(const wxTreeItemId& item, int column = -1) {
 
 670             if (column < 0) column = self->GetMainColumn();
 
 671             self->EditLabel(item, column);
 
 674     %pythoncode { Edit = EditLabel }
 
 676     // sort the children of this item using OnCompareItems
 
 677     void SortChildren(const wxTreeItemId& item);
 
 680     wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
 
 683     void SetDragItem (const wxTreeItemId& item = (wxTreeItemId*)NULL);
 
 685     wxWindow* GetHeaderWindow() const;
 
 686     wxScrolledWindow* GetMainWindow() const;
 
 688     %property(ButtonsImageList, GetButtonsImageList, SetButtonsImageList, doc="See `GetButtonsImageList` and `SetButtonsImageList`");
 
 689     %property(ColumnCount, GetColumnCount, doc="See `GetColumnCount`");
 
 690     %property(Count, GetCount, doc="See `GetCount`");
 
 691     %property(HeaderWindow, GetHeaderWindow, doc="See `GetHeaderWindow`");
 
 692     %property(ImageList, GetImageList, SetImageList, doc="See `GetImageList` and `SetImageList`");
 
 693     %property(Indent, GetIndent, SetIndent, doc="See `GetIndent` and `SetIndent`");
 
 694     %property(LineSpacing, GetLineSpacing, SetLineSpacing, doc="See `GetLineSpacing` and `SetLineSpacing`");
 
 695     %property(MainColumn, GetMainColumn, SetMainColumn, doc="See `GetMainColumn` and `SetMainColumn`");
 
 696     %property(MainWindow, GetMainWindow, doc="See `GetMainWindow`");
 
 697     %property(Next, GetNext, doc="See `GetNext`");
 
 698     %property(RootItem, GetRootItem, doc="See `GetRootItem`");
 
 699     %property(Selection, GetSelection, doc="See `GetSelection`");
 
 700     %property(Selections, GetSelections, doc="See `GetSelections`");
 
 701     %property(StateImageList, GetStateImageList, SetStateImageList, doc="See `GetStateImageList` and `SetStateImageList`");
 
 704 //----------------------------------------------------------------------
 
 707    wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl");
 
 710 //----------------------------------------------------------------------