added wxTreeCtrl::AssignImageList
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -120,6 +120,8 @@ public:
|
|||||||
|
|
||||||
void SetImageList(wxImageList *imageList);
|
void SetImageList(wxImageList *imageList);
|
||||||
void SetStateImageList(wxImageList *imageList);
|
void SetStateImageList(wxImageList *imageList);
|
||||||
|
void AssignImageList(wxImageList *imageList);
|
||||||
|
void AssignStateImageList(wxImageList *imageList);
|
||||||
|
|
||||||
// Functions to work with tree ctrl items. Unfortunately, they can _not_ be
|
// Functions to work with tree ctrl items. Unfortunately, they can _not_ be
|
||||||
// member functions of wxTreeItem because they must know the tree the item
|
// member functions of wxTreeItem because they must know the tree the item
|
||||||
@@ -399,6 +401,7 @@ protected:
|
|||||||
wxTextCtrl *m_textCtrl; // used while editing the item label
|
wxTextCtrl *m_textCtrl; // used while editing the item label
|
||||||
wxImageList *m_imageListNormal, // images for tree elements
|
wxImageList *m_imageListNormal, // images for tree elements
|
||||||
*m_imageListState; // special images for app defined states
|
*m_imageListState; // special images for app defined states
|
||||||
|
bool m_ownsImageListNormal, m_ownsImageListState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the common part of all ctors
|
// the common part of all ctors
|
||||||
|
@@ -497,6 +497,7 @@ void wxTreeCtrl::Init()
|
|||||||
{
|
{
|
||||||
m_imageListNormal = NULL;
|
m_imageListNormal = NULL;
|
||||||
m_imageListState = NULL;
|
m_imageListState = NULL;
|
||||||
|
m_ownsImageListNormal = m_ownsImageListState = FALSE;
|
||||||
m_textCtrl = NULL;
|
m_textCtrl = NULL;
|
||||||
m_hasAnyAttr = FALSE;
|
m_hasAnyAttr = FALSE;
|
||||||
m_dragImage = NULL;
|
m_dragImage = NULL;
|
||||||
@@ -641,6 +642,9 @@ wxTreeCtrl::~wxTreeCtrl()
|
|||||||
|
|
||||||
// delete user data to prevent memory leaks
|
// delete user data to prevent memory leaks
|
||||||
DeleteAllItems();
|
DeleteAllItems();
|
||||||
|
|
||||||
|
if (m_ownsImageListNormal) delete m_imageListNormal;
|
||||||
|
if (m_ownsImageListState) delete m_imageListState;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -704,12 +708,28 @@ void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which)
|
|||||||
|
|
||||||
void wxTreeCtrl::SetImageList(wxImageList *imageList)
|
void wxTreeCtrl::SetImageList(wxImageList *imageList)
|
||||||
{
|
{
|
||||||
|
if (m_ownsImageListNormal) delete m_imageListNormal;
|
||||||
SetAnyImageList(m_imageListNormal = imageList, TVSIL_NORMAL);
|
SetAnyImageList(m_imageListNormal = imageList, TVSIL_NORMAL);
|
||||||
|
m_ownsImageListNormal = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTreeCtrl::SetStateImageList(wxImageList *imageList)
|
void wxTreeCtrl::SetStateImageList(wxImageList *imageList)
|
||||||
{
|
{
|
||||||
|
if (m_ownsImageListState) delete m_imageListState;
|
||||||
SetAnyImageList(m_imageListState = imageList, TVSIL_STATE);
|
SetAnyImageList(m_imageListState = imageList, TVSIL_STATE);
|
||||||
|
m_ownsImageListState = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxTreeCtrl::AssignImageList(wxImageList *imageList)
|
||||||
|
{
|
||||||
|
SetImageList(imageList);
|
||||||
|
m_ownsImageListNormal = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxTreeCtrl::AssignStateImageList(wxImageList *imageList)
|
||||||
|
{
|
||||||
|
SetStateImageList(imageList);
|
||||||
|
m_ownsImageListState = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item,
|
size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item,
|
||||||
|
Reference in New Issue
Block a user