X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/08b7c251c45573a76706a5bbd4e667e186e01f61..f5e27805de786dbb3976782ba2a3365c27256031:/include/wx/msw/treectrl.h diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index f8b34757c2..021c68d66a 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -26,8 +26,8 @@ typedef long wxDataType; // fwd decl -class wxImageList; -struct wxTreeViewItem; +class WXDLLEXPORT wxImageList; +struct WXDLLEXPORT wxTreeViewItem; // a callback function used for sorting tree items, it should return -1 if the // first item precedes the second, +1 if the second precedes the first or 0 if @@ -106,15 +106,13 @@ public: // to "long" which used to be the type for tree item ids in previous // versions of wxWindows -#ifdef wxHTREEITEM_DEFINED // for wxTreeCtrl usage only - wxTreeItemId(HTREEITEM itemId) { m_itemId = (long)itemId; } - operator HTREEITEM() const { return (HTREEITEM)m_itemId; } -#else // !wxHTREEITEM_DEFINED - // deprecated: only for compatibility - wxTreeItemId(long itemId) { m_itemId = itemId; } - operator long() const { return m_itemId; } -#endif // wxHTREEITEM_DEFINED + wxTreeItemId(WXHTREEITEM itemId) { m_itemId = (long)itemId; } + operator WXHTREEITEM() const { return (WXHTREEITEM)m_itemId; } + + void operator =(WXHTREEITEM item) { m_itemId = (long) item; } + +// wxTreeItemId(long itemId) { m_itemId = itemId; } protected: long m_itemId; @@ -133,27 +131,19 @@ protected: // Because the objects of this class are deleted by the tree, they should // always be allocated on the heap! // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTreeItemData +class WXDLLEXPORT wxTreeItemData : private wxTreeItemId { -friend class wxTreeCtrl; public: - // creation/destruction - // -------------------- - // default ctor - wxTreeItemData() { } - - // default copy ctor/assignment operator are ok + // default ctor/copy ctor/assignment operator are ok - // dtor is virtual and all the items are deleted by the tree control - // when it's deleted, so you normally don't have to care about freeing - // memory allocated in your wxTreeItemData-derived class + // dtor is virtual and all the items are deleted by the tree control when + // it's deleted, so you normally don't have to care about freeing memory + // allocated in your wxTreeItemData-derived class virtual ~wxTreeItemData() { } - // accessor: get the item associated with us - const wxTreeItemId& GetItemId() const { return m_itemId; } - -protected: - wxTreeItemId m_itemId; + // accessors: set/get the item associated with this node + void SetId(const wxTreeItemId& id) { m_itemId = id; } + const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; } }; // ---------------------------------------------------------------------------- @@ -242,6 +232,12 @@ public: // 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); + // item status inquiries // --------------------- @@ -276,9 +272,9 @@ public: // the same! // get the first child of this item - wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const; + wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& _cookie) const; // get the next child - wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const; + wxTreeItemId GetNextChild(const wxTreeItemId& item, long& _cookie) const; // get the next sibling of this item wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;