The {\bf m\_stateMask} and {\bf m\_state} members take flags from the following:
-The wxListItem object can also contain item-specific colour and font
-information: for this you need to call one of SetTextColour(),
-SetBackgroundColour() or SetFont() functions on it passing it the colour/font
-to use. If the colour/font is not specified, the default list control
-colour/font is used.
-
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{wxLIST\_STATE\_DONTCARE}{Don't care what the state is. Win32 only. }
\twocolitem{wxLIST\_STATE\_CUT}{The item is in the cut state. Win32 only. }
\end{twocollist}
+The wxListItem object can also contain item-specific colour and font
+information: for this you need to call one of SetTextColour(),
+SetBackgroundColour() or SetFont() functions on it passing it the colour/font
+to use. If the colour/font is not specified, the default list control
+colour/font is used.
+
\func{long}{SetItem}{\param{long }{index}, \param{int }{col}, \param{const wxString\& }{label}, \param{int }{imageId = -1}}
Sets a string field at a particular column.
\membersection{wxListCtrl::SetItemImage}\label{wxlistctrlsetitemimage}
+\func{bool}{SetItemImage}{\param{long }{item}, \param{int }{image}}
+
+Sets the image associated with the item. The image is an index into the
+image list associated with the list control.
+
\func{bool}{SetItemImage}{\param{long }{item}, \param{int }{image}, \param{int }{selImage}}
Sets the unselected and selected images associated with the item. The images are indices into the
-image list associated with the list control.
+image list associated with the list control. This form is deprecated: {\it selImage} is not
+used.
\membersection{wxListCtrl::SetItemPosition}\label{wxlistctrlsetitemposition}
\func{bool}{SetItemPosition}{\param{long }{item}, \param{const wxPoint\& }{pos}}
-Sets the position of the item, in icon or small icon view.
+Sets the position of the item, in icon or small icon view. Windows only.
\membersection{wxListCtrl::SetItemState}\label{wxlistctrlsetitemstate}
This method only makes sense for \texttt{EVT\_LIST\_END\_LABEL\_EDIT} message
and returns \true if it the label editing has been cancelled by the user
(\helpref{GetLabel}{wxlisteventgetlabel} returns an empty string in this case
-but it doesn't allow to distinguish between really cancelling the edit and,
-admittedly rare, case when the user wants to rename it to an empty string0.
+but it doesn't allow the application to distinguish between really cancelling the edit and
+the admittedly rare case when the user wants to rename it to an empty string).
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
-\twocolitem{wxLIST\_MASK\_STATE}{The {\bf GetState} is valid.}
-\twocolitem{wxLIST\_MASK\_TEXT}{The {\bf GetText} is valid.}
-\twocolitem{wxLIST\_MASK\_IMAGE}{The {\bf GetImage} is valid.}
-\twocolitem{wxLIST\_MASK\_DATA}{The {\bf GetData} is valid.}
-\twocolitem{wxLIST\_MASK\_WIDTH}{The {\bf GetWidth} is valid.}
-\twocolitem{wxLIST\_MASK\_FORMAT}{The {\bf GetAlign} is valid.}
+\twocolitem{wxLIST\_MASK\_STATE}{{\bf GetState} is valid.}
+\twocolitem{wxLIST\_MASK\_TEXT}{{\bf GetText} is valid.}
+\twocolitem{wxLIST\_MASK\_IMAGE}{{\bf GetImage} is valid.}
+\twocolitem{wxLIST\_MASK\_DATA}{{\bf GetData} is valid.}
+\twocolitem{wxLIST\_MASK\_WIDTH}{{\bf GetWidth} is valid.}
+\twocolitem{wxLIST\_MASK\_FORMAT}{{\bf GetFormat} is valid.}
\end{twocollist}
\membersection{wxListItem::GetState}\label{wxlistitemgetstate}
\func{void}{SetImage}{\param{int }{image}}
-Returns the zero-based index of the image associated with the item
+Sets the zero-based index of the image associated with the item
into the image list.
\membersection{wxListItem::SetMask}\label{wxlistitemsetmask}
long SetItem( long index, int col, const wxString& label, int imageId = -1 );
int GetItemState( long item, long stateMask ) const;
bool SetItemState( long item, long state, long stateMask);
- bool SetItemImage( long item, int image, int selImage);
+#if WXWIN_COMPATIBILITY_2_4
+ wxDEPRECATED(bool SetItemImage( long item, int image, int selImage ));
+#endif
+ bool SetItemImage( long item, int image );
wxString GetItemText( long item ) const;
void SetItemText( long item, const wxString& str );
wxUIntPtr GetItemData( long item ) const;
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM, 704)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705)
+#if WXWIN_COMPATIBILITY_2_4
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO, 706)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707)
+#endif
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED, 708)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710)
#define EVT_LIST_END_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
#define EVT_LIST_DELETE_ITEM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_DELETE_ITEM, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
+#if WXWIN_COMPATIBILITY_2_4
#define EVT_LIST_GET_INFO(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_GET_INFO, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
#define EVT_LIST_SET_INFO(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_SET_INFO, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
+#endif
#define EVT_LIST_KEY_DOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_KEY_DOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
#define EVT_LIST_INSERT_ITEM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_LIST_INSERT_ITEM, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxListEventFunction, & fn ), NULL ),
bool SetItemState(long item, long state, long stateMask) ;
// Sets the item image
- bool SetItemImage(long item, int image, int selImage) ;
+#if WXWIN_COMPATIBILITY_2_4
+ wxDEPRECATED(bool SetItemImage(long item, int image, int selImage)) ;
+#endif
+ bool SetItemImage(long item, int image) ;
// Gets the item text
wxString GetItemText(long item) const ;
fd->ReadData();
SetItemText(item, fd->GetFileName());
- SetItemImage(item, fd->GetImageId(), fd->GetImageId());
+ SetItemImage(item, fd->GetImageId());
if (GetWindowStyleFlag() & wxLC_REPORT)
{
bool wxListbook::SetPageImage(size_t n, int imageId)
{
- return m_list->SetItemImage(n, imageId, imageId);
+ return m_list->SetItemImage(n, imageId);
}
// ----------------------------------------------------------------------------
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
+#if WXWIN_COMPATIBILITY_2_4
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO)
+#endif
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
return true;
}
+#if WXWIN_COMPATIBILITY_2_4
bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
{
wxListItem info;
m_mainWin->SetItem( info );
return true;
}
+#endif
+
+bool wxGenericListCtrl::SetItemImage( long item, int image )
+{
+ wxListItem info;
+ info.m_image = image;
+ info.m_mask = wxLIST_MASK_IMAGE;
+ info.m_itemId = item;
+ m_mainWin->SetItem( info );
+ return true;
+}
wxString wxGenericListCtrl::GetItemText( long item ) const
{
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
+#if WXWIN_COMPATIBILITY_2_4
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO)
+#endif
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
}
// Sets the item image
+#if WXWIN_COMPATIBILITY_2_4
bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
{
wxListItem info;
return SetItem(info);
}
+#endif
+
+bool wxListCtrl::SetItemImage(long item, int image)
+{
+ wxListItem info;
+
+ info.m_mask = wxLIST_MASK_IMAGE;
+ info.m_image = image;
+ info.m_itemId = item;
+
+ return SetItem(info);
+}
// Gets the item text
wxString wxListCtrl::GetItemText(long item) const
wxDeleteInternalData(this, iItem);
break;
+#if WXWIN_COMPATIBILITY_2_4
case LVN_SETDISPINFO:
{
eventType = wxEVT_COMMAND_LIST_SET_INFO;
wxConvertFromMSWListItem(GetHwnd(), event.m_item, info->item);
}
break;
+#endif
case LVN_INSERTITEM:
eventType = wxEVT_COMMAND_LIST_INSERT_ITEM;