Minor modifications...
Vadim skipped some mistakes due to wxTreeItemId on msw == long git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,7 @@ public:
|
|||||||
// for wxTreeCtrl usage only
|
// for wxTreeCtrl usage only
|
||||||
wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; }
|
wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; }
|
||||||
operator GtkTreeItem *() const { return m_itemId; }
|
operator GtkTreeItem *() const { return m_itemId; }
|
||||||
|
void operator =(GtkTreeItem *item) { m_itemId = item; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GtkTreeItem *m_itemId;
|
GtkTreeItem *m_itemId;
|
||||||
@@ -126,25 +127,18 @@ protected:
|
|||||||
// Because the objects of this class are deleted by the tree, they should
|
// Because the objects of this class are deleted by the tree, they should
|
||||||
// always be allocated on the heap!
|
// always be allocated on the heap!
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
class WXDLLEXPORT wxTreeItemData {
|
class WXDLLEXPORT wxTreeItemData : private wxTreeItemId {
|
||||||
friend class wxTreeCtrl;
|
|
||||||
public:
|
public:
|
||||||
// creation/destruction
|
// default ctor/copy ctor/assignment operator are ok
|
||||||
// --------------------
|
|
||||||
// default ctor
|
|
||||||
wxTreeItemData() { }
|
|
||||||
|
|
||||||
// default copy ctor/assignment operator are ok
|
// dtor is virtual and all the items are deleted by the tree control when
|
||||||
// dtor is virtual and all the items are deleted by the tree control
|
// it's deleted, so you normally don't have to care about freeing memory
|
||||||
// when it's deleted, so you normally don't have to care about freeing
|
// allocated in your wxTreeItemData-derived class
|
||||||
// memory allocated in your wxTreeItemData-derived class
|
virtual ~wxTreeItemData() { }
|
||||||
virtual ~wxTreeItemData() { }
|
|
||||||
|
|
||||||
// accessor: get the item associated with us
|
// accessors: set/get the item associated with this node
|
||||||
const wxTreeItemId& GetItemId() const { return m_itemId; }
|
void SetId(const wxTreeItemId& id) { m_itemId = id; }
|
||||||
|
const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; }
|
||||||
protected:
|
|
||||||
wxTreeItemId m_itemId;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxTreeCtrl: public wxControl {
|
class WXDLLEXPORT wxTreeCtrl: public wxControl {
|
||||||
|
@@ -108,6 +108,7 @@ public:
|
|||||||
// for wxTreeCtrl usage only
|
// for wxTreeCtrl usage only
|
||||||
wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; }
|
wxTreeItemId(GtkTreeItem *itemId) { m_itemId = itemId; }
|
||||||
operator GtkTreeItem *() const { return m_itemId; }
|
operator GtkTreeItem *() const { return m_itemId; }
|
||||||
|
void operator =(GtkTreeItem *item) { m_itemId = item; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GtkTreeItem *m_itemId;
|
GtkTreeItem *m_itemId;
|
||||||
@@ -126,25 +127,18 @@ protected:
|
|||||||
// Because the objects of this class are deleted by the tree, they should
|
// Because the objects of this class are deleted by the tree, they should
|
||||||
// always be allocated on the heap!
|
// always be allocated on the heap!
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
class WXDLLEXPORT wxTreeItemData {
|
class WXDLLEXPORT wxTreeItemData : private wxTreeItemId {
|
||||||
friend class wxTreeCtrl;
|
|
||||||
public:
|
public:
|
||||||
// creation/destruction
|
// default ctor/copy ctor/assignment operator are ok
|
||||||
// --------------------
|
|
||||||
// default ctor
|
|
||||||
wxTreeItemData() { }
|
|
||||||
|
|
||||||
// default copy ctor/assignment operator are ok
|
// dtor is virtual and all the items are deleted by the tree control when
|
||||||
// dtor is virtual and all the items are deleted by the tree control
|
// it's deleted, so you normally don't have to care about freeing memory
|
||||||
// when it's deleted, so you normally don't have to care about freeing
|
// allocated in your wxTreeItemData-derived class
|
||||||
// memory allocated in your wxTreeItemData-derived class
|
virtual ~wxTreeItemData() { }
|
||||||
virtual ~wxTreeItemData() { }
|
|
||||||
|
|
||||||
// accessor: get the item associated with us
|
// accessors: set/get the item associated with this node
|
||||||
const wxTreeItemId& GetItemId() const { return m_itemId; }
|
void SetId(const wxTreeItemId& id) { m_itemId = id; }
|
||||||
|
const wxTreeItemId& GetId() const { return (wxTreeItemId&) m_itemId; }
|
||||||
protected:
|
|
||||||
wxTreeItemId m_itemId;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxTreeCtrl: public wxControl {
|
class WXDLLEXPORT wxTreeCtrl: public wxControl {
|
||||||
|
@@ -195,7 +195,7 @@ void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent,
|
|||||||
void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
||||||
size_t depth)
|
size_t depth)
|
||||||
{
|
{
|
||||||
long rootId = AddRoot("Root",
|
wxTreeItemId rootId = AddRoot("Root",
|
||||||
TreeCtrlIcon_Folder, TreeCtrlIcon_Folder,
|
TreeCtrlIcon_Folder, TreeCtrlIcon_Folder,
|
||||||
new MyTreeItemData("Root item"));
|
new MyTreeItemData("Root item"));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user