added wxListCtrl::AssignImageList
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -129,6 +129,19 @@ Arranges the items in icon or small icon view. This only has effect on Win32. {\
|
||||
\twocolitem{wxLIST\_ALIGN\_SNAP\_TO\_GRID}{Snap to grid.}
|
||||
\end{twocollist}
|
||||
|
||||
\membersection{wxListCtrl::AssignImageList}\label{wxlistctrlassignimagelist}
|
||||
|
||||
\func{void}{AssignImageList}{\param{wxImageList*}{ imageList}, \param{int }{which}}
|
||||
|
||||
Sets the image list associated with the control and
|
||||
takes ownership of it (i.e. the control will, unlike when using
|
||||
SetImageList, delete the list when destroyed). {\it which} is one of
|
||||
wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL, wxIMAGE\_LIST\_STATE (the last is unimplemented).
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxListCtrl::SetImageList}{wxlistctrlsetimagelist}
|
||||
|
||||
\membersection{wxListCtrl::Create}\label{wxlistctrlcreate}
|
||||
|
||||
\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
|
||||
@@ -523,6 +536,14 @@ In small or normal icon view, {\it col} must be -1, and the column width is set
|
||||
Sets the image list associated with the control. {\it which} is one of
|
||||
wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL, wxIMAGE\_LIST\_STATE (the last is unimplemented).
|
||||
|
||||
This method does not take ownership of the image list, you have to
|
||||
delete it yourself.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxListCtrl::AssignImageList}{wxlistctrlassignimagelist}
|
||||
|
||||
|
||||
\membersection{wxListCtrl::SetItem}\label{wxlistctrlsetitem}
|
||||
|
||||
\func{bool}{SetItem}{\param{wxListItem\& }{info}}
|
||||
|
@@ -113,6 +113,7 @@ public:
|
||||
long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
|
||||
wxImageList *GetImageList( int which ) const;
|
||||
void SetImageList( wxImageList *imageList, int which );
|
||||
void AssignImageList( wxImageList *imageList, int which );
|
||||
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
|
||||
|
||||
void ClearAll();
|
||||
@@ -166,6 +167,9 @@ public:
|
||||
wxImageList *m_imageListNormal;
|
||||
wxImageList *m_imageListSmall;
|
||||
wxImageList *m_imageListState; // what's that ?
|
||||
bool m_ownsImageListNormal,
|
||||
m_ownsImageListSmall,
|
||||
m_ownsImageListState;
|
||||
wxListHeaderWindow *m_headerWin;
|
||||
wxListMainWindow *m_mainWin;
|
||||
|
||||
|
@@ -230,6 +230,7 @@ public:
|
||||
// So you have to set a NULL small-icon image list to be sure that
|
||||
// the wxLC_LIST mode works without icons. Of course, you may want icons...
|
||||
void SetImageList(wxImageList *imageList, int which) ;
|
||||
void AssignImageList(wxImageList *imageList, int which) ;
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -345,6 +346,9 @@ protected:
|
||||
wxImageList * m_imageListNormal; // The image list for normal icons
|
||||
wxImageList * m_imageListSmall; // The image list for small icons
|
||||
wxImageList * m_imageListState; // The image list state icons (not implemented yet)
|
||||
bool m_ownsImageListNormal,
|
||||
m_ownsImageListSmall,
|
||||
m_ownsImageListState;
|
||||
|
||||
long m_baseStyle; // Basic Windows style flags, for recreation purposes
|
||||
wxStringList m_stringPool; // Pool of 3 strings to satisfy Windows callback requirements
|
||||
|
@@ -3192,12 +3192,16 @@ wxListCtrl::wxListCtrl()
|
||||
m_imageListNormal = (wxImageList *) NULL;
|
||||
m_imageListSmall = (wxImageList *) NULL;
|
||||
m_imageListState = (wxImageList *) NULL;
|
||||
m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE;
|
||||
m_mainWin = (wxListMainWindow*) NULL;
|
||||
m_headerWin = (wxListHeaderWindow*) NULL;
|
||||
}
|
||||
|
||||
wxListCtrl::~wxListCtrl()
|
||||
{
|
||||
if (m_ownsImageListNormal) delete m_imageListNormal;
|
||||
if (m_ownsImageListSmall) delete m_imageListSmall;
|
||||
if (m_ownsImageListState) delete m_imageListState;
|
||||
}
|
||||
|
||||
bool wxListCtrl::Create(wxWindow *parent,
|
||||
@@ -3211,6 +3215,7 @@ bool wxListCtrl::Create(wxWindow *parent,
|
||||
m_imageListNormal = (wxImageList *) NULL;
|
||||
m_imageListSmall = (wxImageList *) NULL;
|
||||
m_imageListState = (wxImageList *) NULL;
|
||||
m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE;
|
||||
m_mainWin = (wxListMainWindow*) NULL;
|
||||
m_headerWin = (wxListHeaderWindow*) NULL;
|
||||
|
||||
@@ -3508,9 +3513,39 @@ wxImageList *wxListCtrl::GetImageList(int which) const
|
||||
|
||||
void wxListCtrl::SetImageList( wxImageList *imageList, int which )
|
||||
{
|
||||
if ( which == wxIMAGE_LIST_NORMAL )
|
||||
{
|
||||
if (m_ownsImageListNormal) delete m_imageListNormal;
|
||||
m_imageListNormal = imageList;
|
||||
m_ownsImageListNormal = FALSE;
|
||||
}
|
||||
else if ( which == wxIMAGE_LIST_SMALL )
|
||||
{
|
||||
if (m_ownsImageListSmall) delete m_imageListSmall;
|
||||
m_imageListSmall = imageList;
|
||||
m_ownsImageListSmall = FALSE;
|
||||
}
|
||||
else if ( which == wxIMAGE_LIST_STATE )
|
||||
{
|
||||
if (m_ownsImageListState) delete m_imageListState;
|
||||
m_imageListState = imageList;
|
||||
m_ownsImageListState = FALSE;
|
||||
}
|
||||
|
||||
m_mainWin->SetImageList( imageList, which );
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool wxListCtrl::Arrange( int WXUNUSED(flag) )
|
||||
{
|
||||
return 0;
|
||||
|
@@ -130,6 +130,7 @@ void wxListCtrl::Init()
|
||||
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;
|
||||
@@ -284,6 +285,10 @@ wxListCtrl::~wxListCtrl()
|
||||
delete m_textCtrl;
|
||||
m_textCtrl = NULL;
|
||||
}
|
||||
|
||||
if (m_ownsImageListNormal) delete m_imageListNormal;
|
||||
if (m_ownsImageListSmall) delete m_imageListSmall;
|
||||
if (m_ownsImageListState) delete m_imageListState;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -912,21 +917,38 @@ void wxListCtrl::SetImageList(wxImageList *imageList, int which)
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user