-
- bool GetItemBold(const wxTreeItemId& item) const;
- wxColour GetItemTextColour(const wxTreeItemId& item) const;
- wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
- wxFont GetItemFont(const wxTreeItemId& item) const;
-
- // is the item visible (it might be outside the view or not expanded)?
- bool IsVisible(const wxTreeItemId& item) const;
-
- // does the item has any children?
- bool ItemHasChildren(const wxTreeItemId& item) const;
-
- // is the item expanded (only makes sense if HasChildren())?
- bool IsExpanded(const wxTreeItemId& item) const;
-
- // is this item currently selected (the same as has focus)?
- bool IsSelected(const wxTreeItemId& item) const;
-
- // is item text in bold font?
- bool IsBold(const wxTreeItemId& item) const;
-
- // if 'recursively' is False, only immediate children count, otherwise
- // the returned number is the number of all items in this branch
- size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = True);
-
-
- // wxTreeItemId.IsOk() will return False if there is no such item
-
- // get the root tree item
- wxTreeItemId GetRootItem() const;
-
- // get the item currently selected (may return NULL if no selection)
- wxTreeItemId GetSelection() const;
-
- // get the items currently selected, return the number of such item
- //size_t GetSelections(wxArrayTreeItemIds&) const;
- %extend {
- PyObject* GetSelections() {
- wxPyBeginBlockThreads();
- PyObject* rval = PyList_New(0);
- wxArrayTreeItemIds array;
- size_t num, x;
- num = self->GetSelections(array);
- for (x=0; x < num; x++) {
- wxTreeItemId *tii = new wxTreeItemId(array.Item(x));
- PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), True);
- PyList_Append(rval, item);
- }
- wxPyEndBlockThreads();
- return rval;
- }
- }
-
-
- // get the parent of this item (may return NULL if root)
- %name(GetItemParent)wxTreeItemId GetParent(const wxTreeItemId& item) const;
-
- // 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). Of course,
- // the "cookie" passed to GetFirstChild() and GetNextChild() should be
- // the same!
-
-
- %extend {
- // Get the first child of this item. Returns a wxTreeItemId and an
- // opaque "cookie" value that should be passed to GetNextChild in
- // order to continue the search.
- PyObject* GetFirstChild(const wxTreeItemId& item) {
- long cookie = 0;
- wxTreeItemId ritem = self->GetFirstChild(item, cookie);
- wxPyBeginBlockThreads();
- PyObject* tup = PyTuple_New(2);
- PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
- PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
- wxPyEndBlockThreads();
- return tup;
- }
-
-
- // Get the next child of this item. The cookie parameter is the 2nd
- // value returned from GetFirstChild or the previous GetNextChild.
- // Returns a wxTreeItemId and an opaque "cookie" value that should be
- // passed to GetNextChild in order to continue the search.
- PyObject* GetNextChild(const wxTreeItemId& item, long cookie) {
- wxTreeItemId ritem = self->GetNextChild(item, cookie);
- wxPyBeginBlockThreads();
- PyObject* tup = PyTuple_New(2);
- PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(&ritem, wxT("wxTreeItemId"), true));
- PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie));
- wxPyEndBlockThreads();
- return tup;
- }
- }
-
- // get the last child of this item - this method doesn't use cookies
- wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
-
- // get the next sibling of this item
- wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
-
- // get the previous sibling
- wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
-
- // get first visible item
- wxTreeItemId GetFirstVisibleItem() const;
-
- // get the next visible item: item must be visible itself!
- // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
- wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
-
- // get the previous visible item: item must be visible itself!
- wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
-
- // Only for internal use right now, but should probably be public
- wxTreeItemId GetNext(const wxTreeItemId& item) const;
-
-
- // add the root node to the tree
- wxTreeItemId AddRoot(const wxString& text,
- int image = -1, int selectedImage = -1,
- wxPyTreeItemData *data = NULL);
-
- // insert a new item in as the first child of the parent
- wxTreeItemId PrependItem(const wxTreeItemId& parent,
- const wxString& text,
- int image = -1, int selectedImage = -1,
- wxPyTreeItemData *data = NULL);
-
- // insert a new item after a given one
- wxTreeItemId InsertItem(const wxTreeItemId& parent,
- const wxTreeItemId& idPrevious,
- const wxString& text,
- int image = -1, int selectedImage = -1,
- wxPyTreeItemData *data = NULL);
-
- // insert a new item before the one with the given index
- %name(InsertItemBefore)
- wxTreeItemId InsertItem(const wxTreeItemId& parent,
- size_t index,
- const wxString& text,
- int image = -1, int selectedImage = -1,
- wxPyTreeItemData *data = NULL);
-
- // insert a new item in as the last child of the parent
- wxTreeItemId AppendItem(const wxTreeItemId& parent,
- const wxString& text,
- int image = -1, int selectedImage = -1,
- wxPyTreeItemData *data = NULL);
-
- // delete this item and associated data if any
- void Delete(const wxTreeItemId& item);
-
- // delete all children (but don't delete the item itself)
- // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
- void DeleteChildren(const wxTreeItemId& item);
-
- // delete all items from the tree
- // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
- void DeleteAllItems();
-
- // expand this item
- void Expand(const wxTreeItemId& item);
-
- // expand this item and all subitems recursively
- void ExpandAll(const wxTreeItemId& item);
-
- // collapse the item without removing its children
- void Collapse(const wxTreeItemId& item);
-
- // collapse the item and remove all children
- void CollapseAndReset(const wxTreeItemId& item);
-
- // toggles the current state
- void Toggle(const wxTreeItemId& item);
-
- // remove the selection from currently selected item (if any)
- void Unselect();
- void UnselectAll();
-
- // select this item
- void SelectItem(const wxTreeItemId& item, bool unselect_others=True,
- bool extended_select=False);
-
- // make sure this item is visible (expanding the parent item and/or
- // scrolling to this item if necessary)
- void EnsureVisible(const wxTreeItemId& item);
-
- // scroll to this item (but don't expand its parent)
- void ScrollTo(const wxTreeItemId& item);
-
- // Returns wxTreeItemId, flags, and column
- wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT, int& OUTPUT);
-
- %extend {
- // get the bounding rectangle of the item (or of its label only)
- PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = False) {
- wxRect rect;
- if (self->GetBoundingRect(item, rect, textOnly)) {
- wxPyBeginBlockThreads();
- wxRect* r = new wxRect(rect);
- PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1);
- wxPyEndBlockThreads();
- return val;
- }
- else {
- RETURN_NONE();
- }
- }
- }
-
-
- // Start editing the item label: this (temporarily) replaces the item
- // with a one line edit control. The item will be selected if it hadn't
- // been before.
- void EditLabel( const wxTreeItemId& item );
- void Edit( const wxTreeItemId& item );
-
- // sort the children of this item using OnCompareItems
- void SortChildren(const wxTreeItemId& item);
-
- // get the selected item image
- int GetItemSelectedImage(const wxTreeItemId& item) const;
-
- // set the selected item image
- void SetItemSelectedImage(const wxTreeItemId& item, int image);
-
-
- wxWindow* GetHeaderWindow() const;
- wxWindow* GetMainWindow() const;