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:
Václav Slavík 2000-09-28 22:26:15 +00:00
parent b656febdf0
commit 0377efa2e9
2 changed files with 23 additions and 0 deletions

View File

@ -120,6 +120,8 @@ public:
void SetImageList(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
// 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
wxImageList *m_imageListNormal, // images for tree elements
*m_imageListState; // special images for app defined states
bool m_ownsImageListNormal, m_ownsImageListState;
private:
// the common part of all ctors

View File

@ -497,6 +497,7 @@ void wxTreeCtrl::Init()
{
m_imageListNormal = NULL;
m_imageListState = NULL;
m_ownsImageListNormal = m_ownsImageListState = FALSE;
m_textCtrl = NULL;
m_hasAnyAttr = FALSE;
m_dragImage = NULL;
@ -641,6 +642,9 @@ wxTreeCtrl::~wxTreeCtrl()
// delete user data to prevent memory leaks
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)
{
if (m_ownsImageListNormal) delete m_imageListNormal;
SetAnyImageList(m_imageListNormal = imageList, TVSIL_NORMAL);
m_ownsImageListNormal = FALSE;
}
void wxTreeCtrl::SetStateImageList(wxImageList *imageList)
{
if (m_ownsImageListState) delete m_imageListState;
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,