From: Julian Smart Date: Thu, 30 Sep 2004 19:12:23 +0000 (+0000) Subject: Deprecated SetItemImage with 2 image ids X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c3627a004d0333ec7bfc88e2a397d7d7f9752ea9 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 --- diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index 6994b8e449..434c995694 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -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 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. } @@ -823,6 +817,12 @@ colour/font is used. \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. @@ -867,17 +867,23 @@ Associates application-defined data with this item. \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} diff --git a/docs/latex/wx/listevt.tex b/docs/latex/wx/listevt.tex index 9f881f3855..c38f9322a3 100644 --- a/docs/latex/wx/listevt.tex +++ b/docs/latex/wx/listevt.tex @@ -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 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). diff --git a/docs/latex/wx/listitem.tex b/docs/latex/wx/listitem.tex index 6ff8dc618d..fdefb22b54 100644 --- a/docs/latex/wx/listitem.tex +++ b/docs/latex/wx/listitem.tex @@ -77,12 +77,12 @@ can be any combination of the following values: \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} @@ -162,7 +162,7 @@ Sets the zero-based item position. \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} diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index dbc93a9a85..5fd6206fdc 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -98,7 +98,10 @@ public: 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; diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 91ae3af7b5..9f05a72997 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -421,8 +421,10 @@ BEGIN_DECLARE_EVENT_TYPES() 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) @@ -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_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 ), diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 2c5ca5e04b..8d8fd8a7a8 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -160,7 +160,10 @@ public: 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 ; diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index d50dfad560..64480c1d6a 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -476,7 +476,7 @@ void wxFileCtrl::UpdateItem(const wxListItem &item) fd->ReadData(); SetItemText(item, fd->GetFileName()); - SetItemImage(item, fd->GetImageId(), fd->GetImageId()); + SetItemImage(item, fd->GetImageId()); if (GetWindowStyleFlag() & wxLC_REPORT) { diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 313205d051..e3a8391282 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -322,7 +322,7 @@ int wxListbook::GetPageImage(size_t WXUNUSED(n)) const bool wxListbook::SetPageImage(size_t n, int imageId) { - return m_list->SetItemImage(n, imageId, imageId); + return m_list->SetItemImage(n, imageId); } // ---------------------------------------------------------------------------- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 675685a7b5..1d6af59568 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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_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) @@ -4822,6 +4824,7 @@ bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask ) return true; } +#if WXWIN_COMPATIBILITY_2_4 bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) ) { wxListItem info; @@ -4831,6 +4834,17 @@ bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImag 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 { diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 03215598d1..85c5fef7f4 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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_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) @@ -901,6 +903,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) } // Sets the item image +#if WXWIN_COMPATIBILITY_2_4 bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) { wxListItem info; @@ -911,6 +914,18 @@ bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) 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 @@ -1917,6 +1932,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxDeleteInternalData(this, iItem); break; +#if WXWIN_COMPATIBILITY_2_4 case LVN_SETDISPINFO: { 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); } break; +#endif case LVN_INSERTITEM: eventType = wxEVT_COMMAND_LIST_INSERT_ITEM;