X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e21a504837179fc2be49f72e03664c8d8cc82148..702ca7c0704ae15a0ae7aa68588004d6f8d469f4:/include/wx/gtk/treectrl.h?ds=sidebyside diff --git a/include/wx/gtk/treectrl.h b/include/wx/gtk/treectrl.h index afdd14c5cc..34ac6d2df6 100644 --- a/include/wx/gtk/treectrl.h +++ b/include/wx/gtk/treectrl.h @@ -6,7 +6,7 @@ // Created: 08/08/98 // RCS-ID: $Id$ // Copyright: (c) Denis Pershin -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TREECTRL_H_ @@ -108,6 +108,7 @@ public: // for wxTreeCtrl usage only wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; } operator GtkTreeItem *() const { return m_itemId; } + void operator =(GtkTreeItem *item) { m_itemId = item; } protected: GtkTreeItem *m_itemId; @@ -126,25 +127,18 @@ protected: // Because the objects of this class are deleted by the tree, they should // always be allocated on the heap! // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTreeItemData { -friend class wxTreeCtrl; +class WXDLLEXPORT wxTreeItemData : private wxTreeItemId { public: - // creation/destruction - // -------------------- - // default ctor - wxTreeItemData() { } + // default ctor/copy ctor/assignment operator are ok - // default 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 - virtual ~wxTreeItemData() { } + // 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; } }; class WXDLLEXPORT wxTreeCtrl: public wxControl { @@ -240,6 +234,13 @@ public: // is this item currently selected (the same as has focus)? bool IsSelected(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); + // navigation // ---------- @@ -381,6 +382,7 @@ public: void SendSelChanging(const wxTreeItemId& item); void SendSelChanged(const wxTreeItemId& item); protected: + wxTreeItemId m_editItem; GtkTree *m_tree; GtkTreeItem *m_anchor; wxTextCtrl* m_textCtrl; @@ -389,6 +391,7 @@ protected: long m_curitemId; + void SendMessage(wxEventType command, const wxTreeItemId& item); // GtkTreeItem *findGtkTreeItem(wxTreeCtrlId &id) const; // the common part of all ctors