+public:
+ // ctors & dtor
+ wxGenericTreeItem() { m_data = NULL; }
+ wxGenericTreeItem( wxGenericTreeItem *parent,
+ const wxString& text,
+ wxDC& dc,
+ int image, int selImage,
+ wxTreeItemData *data );
+
+ ~wxGenericTreeItem();
+
+ // trivial accessors
+ wxArrayTreeItems& GetChildren() { return m_children; }
+
+ const wxString& GetText() const { return m_text; }
+ int GetImage() const { return m_image; }
+ int GetSelectedImage() const { return m_selImage; }
+ wxTreeItemData *GetData() const { return m_data; }
+
+ void SetText( const wxString &text, wxDC& dc );
+ void SetImage(int image) { m_image = image; }
+ void SetSelectedImage(int image) { m_selImage = image; }
+ void SetData(wxTreeItemData *data) { m_data = data; }
+
+ void SetHasPlus(bool has = TRUE) { m_hasPlus = has; }
+
+ int GetX() const { return m_x; }
+ int GetY() const { return m_y; }
+
+ void SetHeight(int h) { m_height = h; }
+
+ void SetX(int x) { m_x = x; }
+ void SetY(int y) { m_y = y; }
+
+ wxGenericTreeItem *GetParent() const { return m_parent; }
+
+ // operations
+ void Reset();
+
+ // get count of all children (and grand children if 'recursively')
+ size_t GetChildrenCount(bool recursively = TRUE) const;
+
+ void Insert(wxGenericTreeItem *child, size_t index)
+ { m_children.Insert(child, index); }
+
+ void SetCross( int x, int y );
+ void GetSize( int &x, int &y );
+
+ // return the item at given position (or NULL if no item), onButton is TRUE
+ // if the point belongs to the item's button, otherwise it lies on the
+ // button's label
+ wxGenericTreeItem *HitTest( const wxPoint& point, bool &onButton );
+
+ void Expand() { m_isCollapsed = FALSE; }
+ void Collapse() { m_isCollapsed = TRUE; }
+
+ void SetHilight( bool set = TRUE ) { m_hasHilight = set; }
+
+ // status inquiries
+ bool HasChildren() const { return !m_children.IsEmpty(); }
+ bool HasHilight() const { return m_hasHilight; }
+ bool IsExpanded() const { return !m_isCollapsed; }
+ bool HasPlus() const { return m_hasPlus || HasChildren(); }
+
+private:
+ wxString m_text;
+
+ int m_image,
+ m_selImage;
+
+ wxTreeItemData *m_data;
+
+ // @@ probably should use bitfields to save size
+ bool m_isCollapsed,
+ m_hasHilight, // same as focused
+ m_hasPlus; // used for item which doesn't have
+ // children but still has a [+] button
+
+ int m_x, m_y;
+ long m_height, m_width;
+ int m_xCross, m_yCross;
+ int m_level;
+ wxArrayTreeItems m_children;
+ wxGenericTreeItem *m_parent;