From: Vadim Zeitlin Date: Thu, 10 May 2007 01:53:21 +0000 (+0000) Subject: added wxListCtrl::SetItemPtrData() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9fcd0bf7f313e637e8cd4b5d7f3cd5b294fec033?ds=inline added wxListCtrl::SetItemPtrData() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 80f192640e..2ba5b299c2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -163,6 +163,7 @@ All (GUI): - Allow status bar children in XRC (Edmunt Pienkowski) - Fix memory leak in wxWizard when not using sizers for the page layout +- Added wxListCtrl::SetItemPtrData() wxMSW: diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index a3ef301c66..8f031edd97 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -943,6 +943,9 @@ from $0$ to {\it count}. Associates application-defined data with this item. +Notice that this function cannot be used to associate pointers with the control +items, use \helpref{SetItemPtrData}{wxlistctrlsetitemptrdata} instead. + \membersection{wxListCtrl::SetItemFont}\label{wxlistctrlsetitemfont} @@ -981,6 +984,18 @@ The image is an index into the image list associated with the list control. Sets the position of the item, in icon or small icon view. Windows only. +\membersection{wxListCtrl::SetItemPtrData}\label{wxlistctrlsetitemptrdata} + +\func{bool}{SetItemPtrData}{\param{long }{item}, \param{wxUIntPtr }{data}} + +Associates application-defined data with this item. The \arg{data} parameter may +be either an integer or a pointer cast to the \texttt{wxUIntPtr} type which is +guaranteed to be large enough to be able to contain all integer types and +pointers. + +\newsince{2.8.4} + + \membersection{wxListCtrl::SetItemState}\label{wxlistctrlsetitemstate} \func{bool}{SetItemState}{\param{long }{item}, \param{long }{state}, \param{long }{stateMask}} diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 19e874c53e..24422ec81b 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -77,7 +77,8 @@ public: wxString GetItemText( long item ) const; void SetItemText( long item, const wxString& str ); wxUIntPtr GetItemData( long item ) const; - bool SetItemData( long item, long data ); + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const; bool GetItemPosition( long item, wxPoint& pos ) const; bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index 03376614ad..a3949e50d8 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -122,7 +122,8 @@ class WXDLLEXPORT wxListCtrl: public wxControl long GetItemData(long item) const ; // Sets the item data - bool SetItemData(long item, long data) ; + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } // Gets the item rectangle bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 97f61eb113..cf4bfdd64e 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -163,7 +163,8 @@ public: wxUIntPtr GetItemData(long item) const ; // Sets the item data - bool SetItemData(long item, long data) ; + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } // Gets the item rectangle bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; diff --git a/include/wx/os2/listctrl.h b/include/wx/os2/listctrl.h index 03db69cf89..ff50c28277 100644 --- a/include/wx/os2/listctrl.h +++ b/include/wx/os2/listctrl.h @@ -150,9 +150,8 @@ public: // Item data // long GetItemData(long lItem) const; - bool SetItemData( long lItem - ,long lData - ); + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } // // Gets the item rectangle diff --git a/include/wx/palmos/listctrl.h b/include/wx/palmos/listctrl.h index 1ad47caae0..43a0883441 100644 --- a/include/wx/palmos/listctrl.h +++ b/include/wx/palmos/listctrl.h @@ -166,7 +166,8 @@ public: long GetItemData(long item) const ; // Sets the item data - bool SetItemData(long item, long data) ; + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, data); } // Gets the item rectangle bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 97c78dfd42..27b1c3f0e9 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5177,7 +5177,7 @@ wxUIntPtr wxGenericListCtrl::GetItemData( long item ) const return info.m_data; } -bool wxGenericListCtrl::SetItemData( long item, long data ) +bool wxGenericListCtrl::SetItemPtrData( long item, wxUIntPtr data ) { wxListItem info; info.m_mask = wxLIST_MASK_DATA; diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index ddd717dbec..5a1a1f0bc8 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -1326,7 +1326,7 @@ long wxListCtrl::GetItemData(long item) const } // Sets the item data -bool wxListCtrl::SetItemData(long item, long data) +bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data) { if (m_genericImpl) return m_genericImpl->SetItemData(item, data); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 12870a32fa..db616b8940 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -948,7 +948,7 @@ wxUIntPtr wxListCtrl::GetItemData(long item) const } // Sets the item data -bool wxListCtrl::SetItemData(long item, long data) +bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data) { wxListItem info; diff --git a/src/os2/listctrl.cpp b/src/os2/listctrl.cpp index 648f43ed62..1c8a4a0d4d 100644 --- a/src/os2/listctrl.cpp +++ b/src/os2/listctrl.cpp @@ -1519,9 +1519,9 @@ long wxListCtrl::GetItemData ( } // end of wxListCtrl::GetItemData // Sets the item data -bool wxListCtrl::SetItemData ( +bool wxListCtrl::SetItemPtrData ( long lItem -, long lData +, wxUIntPtr lData ) { wxListItem vInfo; @@ -1530,7 +1530,7 @@ bool wxListCtrl::SetItemData ( vInfo.m_itemId = lItem; vInfo.m_data = lData; return SetItem(vInfo); -} // end of wxListCtrl::SetItemData +} // end of wxListCtrl::SetItemPtrData // Gets the item rectangle bool wxListCtrl::GetItemRect ( long lItem, diff --git a/src/palmos/listctrl.cpp b/src/palmos/listctrl.cpp index 5d7bdf5371..a2c4920eab 100644 --- a/src/palmos/listctrl.cpp +++ b/src/palmos/listctrl.cpp @@ -283,7 +283,7 @@ long wxListCtrl::GetItemData(long item) const } // Sets the item data -bool wxListCtrl::SetItemData(long item, long data) +bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data) { return false; }