Deprecated SetItemImage with 2 image ids

Deprecated _GET_INFO, _SET_INFO list control events


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-09-30 19:12:23 +00:00
parent 7f9975410f
commit c3627a004d
10 changed files with 68 additions and 21 deletions

View File

@@ -808,12 +808,6 @@ The {\bf m\_mask} member contains a bitlist specifying which of the other fields
The {\bf m\_stateMask} and {\bf m\_state} members take flags from the following: 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} \twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{wxLIST\_STATE\_DONTCARE}{Don't care what the state is. Win32 only. } \twocolitem{wxLIST\_STATE\_DONTCARE}{Don't care what the state is. Win32 only. }
@@ -823,6 +817,12 @@ colour/font is used.
\twocolitem{wxLIST\_STATE\_CUT}{The item is in the cut state. Win32 only. } \twocolitem{wxLIST\_STATE\_CUT}{The item is in the cut state. Win32 only. }
\end{twocollist} \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}} \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. Sets a string field at a particular column.
@@ -867,17 +867,23 @@ Associates application-defined data with this item.
\membersection{wxListCtrl::SetItemImage}\label{wxlistctrlsetitemimage} \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}} \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 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} \membersection{wxListCtrl::SetItemPosition}\label{wxlistctrlsetitemposition}
\func{bool}{SetItemPosition}{\param{long }{item}, \param{const wxPoint\& }{pos}} \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} \membersection{wxListCtrl::SetItemState}\label{wxlistctrlsetitemstate}

View File

@@ -153,7 +153,7 @@ An item object, used by some events. See also \helpref{wxListCtrl::SetItem}{wxli
This method only makes sense for \texttt{EVT\_LIST\_END\_LABEL\_EDIT} message 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 and returns \true if it the label editing has been cancelled by the user
(\helpref{GetLabel}{wxlisteventgetlabel} returns an empty string in this case (\helpref{GetLabel}{wxlisteventgetlabel} returns an empty string in this case
but it doesn't allow to distinguish between really cancelling the edit and, but it doesn't allow the application to distinguish between really cancelling the edit and
admittedly rare, case when the user wants to rename it to an empty string0. the admittedly rare case when the user wants to rename it to an empty string).

View File

@@ -77,12 +77,12 @@ can be any combination of the following values:
\twocolwidtha{5cm} \twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{wxLIST\_MASK\_STATE}{The {\bf GetState} is valid.} \twocolitem{wxLIST\_MASK\_STATE}{{\bf GetState} is valid.}
\twocolitem{wxLIST\_MASK\_TEXT}{The {\bf GetText} is valid.} \twocolitem{wxLIST\_MASK\_TEXT}{{\bf GetText} is valid.}
\twocolitem{wxLIST\_MASK\_IMAGE}{The {\bf GetImage} is valid.} \twocolitem{wxLIST\_MASK\_IMAGE}{{\bf GetImage} is valid.}
\twocolitem{wxLIST\_MASK\_DATA}{The {\bf GetData} is valid.} \twocolitem{wxLIST\_MASK\_DATA}{{\bf GetData} is valid.}
\twocolitem{wxLIST\_MASK\_WIDTH}{The {\bf GetWidth} is valid.} \twocolitem{wxLIST\_MASK\_WIDTH}{{\bf GetWidth} is valid.}
\twocolitem{wxLIST\_MASK\_FORMAT}{The {\bf GetAlign} is valid.} \twocolitem{wxLIST\_MASK\_FORMAT}{{\bf GetFormat} is valid.}
\end{twocollist} \end{twocollist}
\membersection{wxListItem::GetState}\label{wxlistitemgetstate} \membersection{wxListItem::GetState}\label{wxlistitemgetstate}
@@ -162,7 +162,7 @@ Sets the zero-based item position.
\func{void}{SetImage}{\param{int }{image}} \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. into the image list.
\membersection{wxListItem::SetMask}\label{wxlistitemsetmask} \membersection{wxListItem::SetMask}\label{wxlistitemsetmask}

View File

@@ -98,7 +98,10 @@ public:
long SetItem( long index, int col, const wxString& label, int imageId = -1 ); long SetItem( long index, int col, const wxString& label, int imageId = -1 );
int GetItemState( long item, long stateMask ) const; int GetItemState( long item, long stateMask ) const;
bool SetItemState( long item, long state, long stateMask); 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; wxString GetItemText( long item ) const;
void SetItemText( long item, const wxString& str ); void SetItemText( long item, const wxString& str );
wxUIntPtr GetItemData( long item ) const; wxUIntPtr GetItemData( long item ) const;

View File

@@ -421,8 +421,10 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT, 703) 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_ITEM, 704)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 705) 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_GET_INFO, 706)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO, 707) 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_SELECTED, 708)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709) DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED, 709)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710) DECLARE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN, 710)
@@ -447,8 +449,10 @@ typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
#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_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_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 ), #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_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 ), #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_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 ), #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 ),

View File

@@ -160,7 +160,10 @@ public:
bool SetItemState(long item, long state, long stateMask) ; bool SetItemState(long item, long state, long stateMask) ;
// Sets the item image // 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 // Gets the item text
wxString GetItemText(long item) const ; wxString GetItemText(long item) const ;

View File

@@ -476,7 +476,7 @@ void wxFileCtrl::UpdateItem(const wxListItem &item)
fd->ReadData(); fd->ReadData();
SetItemText(item, fd->GetFileName()); SetItemText(item, fd->GetFileName());
SetItemImage(item, fd->GetImageId(), fd->GetImageId()); SetItemImage(item, fd->GetImageId());
if (GetWindowStyleFlag() & wxLC_REPORT) if (GetWindowStyleFlag() & wxLC_REPORT)
{ {

View File

@@ -322,7 +322,7 @@ int wxListbook::GetPageImage(size_t WXUNUSED(n)) const
bool wxListbook::SetPageImage(size_t n, int imageId) bool wxListbook::SetPageImage(size_t n, int imageId)
{ {
return m_list->SetItemImage(n, imageId, imageId); return m_list->SetItemImage(n, imageId);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -94,8 +94,10 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS) 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_GET_INFO)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_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_SELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
@@ -4822,6 +4824,7 @@ bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask )
return true; return true;
} }
#if WXWIN_COMPATIBILITY_2_4
bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) ) bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
{ {
wxListItem info; wxListItem info;
@@ -4831,6 +4834,17 @@ bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImag
m_mainWin->SetItem( info ); m_mainWin->SetItem( info );
return true; 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 wxString wxGenericListCtrl::GetItemText( long item ) const
{ {

View File

@@ -221,8 +221,10 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS) 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_GET_INFO)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_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_SELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
@@ -901,6 +903,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask)
} }
// Sets the item image // Sets the item image
#if WXWIN_COMPATIBILITY_2_4
bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
{ {
wxListItem info; wxListItem info;
@@ -911,6 +914,18 @@ bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
return SetItem(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 // Gets the item text
wxString wxListCtrl::GetItemText(long item) const wxString wxListCtrl::GetItemText(long item) const
@@ -1917,6 +1932,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
wxDeleteInternalData(this, iItem); wxDeleteInternalData(this, iItem);
break; break;
#if WXWIN_COMPATIBILITY_2_4
case LVN_SETDISPINFO: case LVN_SETDISPINFO:
{ {
eventType = wxEVT_COMMAND_LIST_SET_INFO; eventType = wxEVT_COMMAND_LIST_SET_INFO;
@@ -1924,6 +1940,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
wxConvertFromMSWListItem(GetHwnd(), event.m_item, info->item); wxConvertFromMSWListItem(GetHwnd(), event.m_item, info->item);
} }
break; break;
#endif
case LVN_INSERTITEM: case LVN_INSERTITEM:
eventType = wxEVT_COMMAND_LIST_INSERT_ITEM; eventType = wxEVT_COMMAND_LIST_INSERT_ITEM;