- // accessors
- // ---------
-
- // get the total number of items in the control
- size_t GetCount() const;
-
- // indent is the number of pixels the children are indented relative to
- // the parents position. SetIndent() also redraws the control
- // immediately.
- unsigned int GetIndent() const { return m_indent; }
- void SetIndent(unsigned int indent);
-
- // spacing is the number of pixels between the start and the Text
- unsigned int GetSpacing() const { return m_spacing; }
- void SetSpacing(unsigned int spacing);
-
- // image list: these functions allow to associate an image list with
- // the control and retrieve it. Note that the control does _not_ delete
- // the associated image list when it's deleted in order to allow image
- // lists to be shared between different controls.
- //
- // The normal image list is for the icons which correspond to the
- // normal tree item state (whether it is selected or not).
- // Additionally, the application might choose to show a state icon
- // which corresponds to an app-defined item state (for example,
- // checked/unchecked) which are taken from the state image list.
- wxImageList *GetImageList() const;
- wxImageList *GetStateImageList() const;
-
- void SetImageList(wxImageList *imageList);
- void SetStateImageList(wxImageList *imageList);
-
- // Functions to work with tree ctrl items.
-
- // accessors
- // ---------
-
- // retrieve items label
- wxString GetItemText(const wxTreeItemId& item) const;
- // get one of the images associated with the item (normal by default)
- int GetItemImage(const wxTreeItemId& item,
- wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
- // get the data associated with the item
- wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
-
- // modifiers
- // ---------
-
- // set items label
- void SetItemText(const wxTreeItemId& item, const wxString& text);
- // get one of the images associated with the item (normal by default)
- void SetItemImage(const wxTreeItemId& item, int image,
- wxTreeItemIcon which = wxTreeItemIcon_Normal);
- // associate some data with the item
- void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
-
- // force appearance of [+] button near the item. This is useful to
- // allow the user to expand the items which don't have any children now
- // - but instead add them only when needed, thus minimizing memory
- // usage and loading time.
- void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
-
- // the item will be shown in bold
- void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
-
- // set the items text colour
- void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
-
- // set the items background colour
- void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
-
- // set the items font (should be of the same height for all items)
- void SetItemFont(const wxTreeItemId& item, const wxFont& font);
-
- // item status inquiries
- // ---------------------
-
- // 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 HasChildren(const wxTreeItemId& item) const
- { return ItemHasChildren(item); }
- 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;
-
- // number of children
- // ------------------
-
- // 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);