#include "wx/textctrl.h"
#include "wx/imaglist.h"
-
#include "wx/listctrl.h"
+#include "wx/dcclient.h"
#include "wx/msw/private.h"
m_imageListNormal = NULL;
m_imageListSmall = NULL;
m_imageListState = NULL;
+ m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE;
m_baseStyle = 0;
m_colCount = 0;
m_textCtrl = NULL;
delete m_textCtrl;
m_textCtrl = NULL;
}
+
+ if (m_ownsImageListNormal) delete m_imageListNormal;
+ if (m_ownsImageListSmall) delete m_imageListSmall;
+ if (m_ownsImageListState) delete m_imageListState;
}
// ----------------------------------------------------------------------------
if (info.m_mask & wxLIST_MASK_DATA)
lvItem.mask |= LVIF_PARAM;
+ if (info.m_mask & wxLIST_MASK_IMAGE)
+ lvItem.mask |= LVIF_IMAGE;
+
if ( info.m_mask & wxLIST_MASK_STATE )
{
lvItem.mask |= LVIF_STATE;
if ( which == wxIMAGE_LIST_NORMAL )
{
flags = LVSIL_NORMAL;
+ if (m_ownsImageListNormal) delete m_imageListNormal;
m_imageListNormal = imageList;
+ m_ownsImageListNormal = FALSE;
}
else if ( which == wxIMAGE_LIST_SMALL )
{
flags = LVSIL_SMALL;
+ if (m_ownsImageListSmall) delete m_imageListSmall;
m_imageListSmall = imageList;
+ m_ownsImageListSmall = FALSE;
}
else if ( which == wxIMAGE_LIST_STATE )
{
flags = LVSIL_STATE;
+ if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
+ m_ownsImageListState = FALSE;
}
ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags);
}
+void wxListCtrl::AssignImageList(wxImageList *imageList, int which)
+{
+ SetImageList(imageList, which);
+ if ( which == wxIMAGE_LIST_NORMAL )
+ m_ownsImageListNormal = TRUE;
+ else if ( which == wxIMAGE_LIST_SMALL )
+ m_ownsImageListSmall = TRUE;
+ else if ( which == wxIMAGE_LIST_STATE )
+ m_ownsImageListState = TRUE;
+}
+
// ----------------------------------------------------------------------------
// Operations
// ----------------------------------------------------------------------------
wxRect itemRect;
int cy=0;
- int lastH = 0;
int itemCount = GetItemCount();
int i;
for (i = 0; i < itemCount; i++)