]> git.saurik.com Git - wxWidgets.git/commitdiff
use wxUIntPtr instead of long for 3rd parameter of wxListCtrl::SortItems() to allow...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Apr 2009 21:23:50 +0000 (21:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Apr 2009 21:23:50 +0000 (21:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60182 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
docs/changes.txt
include/wx/generic/listctrl.h
include/wx/generic/private/listctrl.h
include/wx/listbase.h
include/wx/msw/listctrl.h
include/wx/osx/listctrl.h
interface/wx/listctrl.h
samples/listctrl/listtest.cpp
src/generic/filectrlg.cpp
src/generic/listctrl.cpp
src/msw/listctrl.cpp
src/osx/carbon/listctrl_mac.cpp

index 72872f58b0ac648d7f4ed7add91378aff4c989af..c25f3149a5ba3aa784fe01168d0d55fb1ac3a99d 100644 (file)
@@ -226,6 +226,10 @@ Changes in behaviour which may result in compilation errors
 - wxEVT_GRID_CELL_CHANGE event renamed to wxEVT_GRID_CELL_CHANGED and shouldn't
   be vetoed any more, use the new wxEVT_GRID_CELL_CHANGING event to do it.
 
+- wxListCtrlCompare function used with wxListCtrl::SortItems() must now declare
+  its third parameter as wxUIntPtr and not long (this allows passing pointers
+  to it under 64 bit platforms too).
+
 - Global wxPendingEvents and wxPendingEventsLocker objects were removed.
   You may use wxEventLoopBase::SuspendProcessingOfPendingEvents instead of
   locking wxPendingEventsLocker now.
index 1ecb908b3365654b61cf99af39a237698da5116c..3f0c175cb5d47d95b65782641fb7afbaf835c758 100644 (file)
@@ -138,7 +138,7 @@ public:
     long InsertColumn( long col, const wxString& heading,
                        int format = wxLIST_FORMAT_LEFT, int width = -1 );
     bool ScrollList( int dx, int dy );
-    bool SortItems( wxListCtrlCompare fn, long data );
+    bool SortItems( wxListCtrlCompare fn, wxUIntPtr data );
     bool Update( long item );
     // Must provide overload to avoid hiding it (and warnings about it)
     virtual void Update() { wxControl::Update(); }
index b204bb1f307a92dc5d272bdf6c3c377eae358078..5ec6272b828abb945ea1b0e76cc85a1df4dc803d 100644 (file)
@@ -610,7 +610,7 @@ public:
     void InsertItem( wxListItem &item );
     void InsertColumn( long col, wxListItem &item );
     int GetItemWidthWithImage(wxListItem * item);
-    void SortItems( wxListCtrlCompare fn, long data );
+    void SortItems( wxListCtrlCompare fn, wxUIntPtr data );
 
     size_t GetItemCount() const;
     bool IsEmpty() const { return GetItemCount() == 0; }
index ebbe9469654790a3170bc1029a57003a644b9f21..15221d940a1ca90e347094fa9879746d51f020fe 100644 (file)
@@ -22,7 +22,8 @@
 // ----------------------------------------------------------------------------
 
 // type of compare function for wxListCtrl sort operation
-typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData);
+typedef
+int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, wxUIntPtr sortData);
 
 // ----------------------------------------------------------------------------
 // wxListCtrl constants
index eb5f7bbcdb3948eb07e4234c27e87a7a1a0e61ff..fa74009fc9e47626873a28d60949833a64cbfb29 100644 (file)
@@ -353,7 +353,7 @@ public:
     // or zero if the two items are equivalent.
 
     // data is arbitrary data to be passed to the sort function.
-    bool SortItems(wxListCtrlCompare fn, long data);
+    bool SortItems(wxListCtrlCompare fn, wxUIntPtr data);
 
     // IMPLEMENTATION
     virtual bool MSWCommand(WXUINT param, WXWORD id);
index 98ea42e277d9f709f931eeb66fc70acd552b5c79..7c3b67cbdf0bfe1259f0b237fe3869d062ec32a0 100644 (file)
@@ -281,7 +281,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
   // or zero if the two items are equivalent.
 
   // data is arbitrary data to be passed to the sort function.
-  bool SortItems(wxListCtrlCompare fn, long data);
+  bool SortItems(wxListCtrlCompare fn, wxUIntPtr data);
 
   wxMacDataBrowserListCtrlControl* GetListPeer() const;
 
@@ -317,7 +317,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
   void Command(wxCommandEvent& event) { ProcessCommand(event); };
 
   wxListCtrlCompare GetCompareFunc() { return m_compareFunc; };
-  long GetCompareFuncData() { return m_compareFuncData; };
+  wxUIntPtr GetCompareFuncData() { return m_compareFuncData; };
 
 
   // public overrides needed for pimpl approach
@@ -391,7 +391,7 @@ protected:
   void*  m_macListCtrlEventHandler;
   void*  m_cgContext;
   wxListCtrlCompare m_compareFunc;
-  long m_compareFuncData;
+  wxUIntPtr m_compareFuncData;
 
   wxTextCtrl*       m_textCtrl;        // The control used for editing a label
   wxImageList *     m_imageListNormal; // The image list for normal icons
index 064313ce9b43b5545e6fe52eab06c47fc191c6f2..2ba301aeec77bca3ac8ca053a54754329dab1a51 100644 (file)
@@ -842,7 +842,7 @@ public:
         using the specified @a fnSortCallBack function. This function must have the
         following prototype:
         @code
-        int wxCALLBACK wxListCompareFunction(long item1, long item2, long sortData)
+        int wxCALLBACK wxListCompareFunction(long item1, long item2, wxUIntPtr sortData)
         @endcode
 
         It is called each time when the two items must be compared and should return 0
@@ -860,7 +860,7 @@ public:
 
         Please see the @ref page_samples_listctrl for an example of using this function.
     */
-    bool SortItems(wxListCtrlCompare fnSortCallBack, long data);
+    bool SortItems(wxListCtrlCompare fnSortCallBack, wxUIntPtr data);
 
 protected:
 
index 2f51db5f538bec185cdf90d2f4ddb3cb6e1ce9da..45d84e0596215794f05b8ac2cda1fa2e301ea687 100644 (file)
@@ -71,7 +71,8 @@ static const int NUM_ITEMS = 10;
 // number of items in icon/small icon view
 static const int NUM_ICONS = 9;
 
-int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData))
+int wxCALLBACK
+MyCompareFunction(long item1, long item2, wxUIntPtr WXUNUSED(sortData))
 {
     // inverse the order
     if (item1 < item2)
index f8b612952b901a0d012761cc2627515b8c4b7921..1de3b1ad83a8eeb6fed0410e5eafb525e1bca4d3 100644 (file)
@@ -52,7 +52,7 @@
 // ----------------------------------------------------------------------------
 
 static
-int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long sortOrder)
+int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxUIntPtr sortOrder)
 {
      wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
      wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
@@ -70,7 +70,7 @@ int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long sortOrder)
 }
 
 static
-int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, long sortOrder)
+int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxUIntPtr sortOrder)
 {
      wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
      wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
@@ -92,7 +92,7 @@ int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, long sortOrder)
 }
 
 static
-int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, long sortOrder)
+int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxUIntPtr sortOrder)
 {
      wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
      wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
@@ -114,7 +114,7 @@ int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, long sortOrder)
 }
 
 static
-int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, long sortOrder)
+int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxUIntPtr sortOrder)
 {
      wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
      wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
index dbc1eeec4d1155576d46eb8aa91e28704151f303..5ca7580a98311c8b6b9164457d1eed2733e8a7d0 100644 (file)
@@ -4152,7 +4152,7 @@ int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
 // ----------------------------------------------------------------------------
 
 static wxListCtrlCompare list_ctrl_compare_func_2;
-static long              list_ctrl_compare_data;
+static wxUIntPtr         list_ctrl_compare_data;
 
 int LINKAGEMODE list_ctrl_compare_func_1( wxListLineData **arg1, wxListLineData **arg2 )
 {
@@ -4166,7 +4166,7 @@ int LINKAGEMODE list_ctrl_compare_func_1( wxListLineData **arg1, wxListLineData
     return list_ctrl_compare_func_2( data1, data2, list_ctrl_compare_data );
 }
 
-void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
+void wxListMainWindow::SortItems( wxListCtrlCompare fn, wxUIntPtr data )
 {
     // selections won't make sense any more after sorting the items so reset
     // them
@@ -4918,7 +4918,7 @@ bool wxGenericListCtrl::ScrollList( int dx, int dy )
 // or zero if the two items are equivalent.
 // data is arbitrary data to be passed to the sort function.
 
-bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, long data )
+bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, wxUIntPtr data )
 {
     m_mainWin->SortItems( fn, data );
     return true;
index b5bbc4a4be1d8ea08cd5345d058cebe428ea68b3..31b1ef7054049f558f5cf6e9ba17a67dd9f0136d 100644 (file)
@@ -1865,12 +1865,12 @@ bool wxListCtrl::ScrollList(int dx, int dy)
 struct wxInternalDataSort
 {
     wxListCtrlCompare user_fn;
-    long data;
+    wxUIntPtr data;
 };
 
 int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2,  LPARAM lParamSort)
 {
-    struct wxInternalDataSort *internalData = (struct wxInternalDataSort *) lParamSort;
+    wxInternalDataSort * const internalData = (wxInternalDataSort *) lParamSort;
 
     wxListItemInternalData *data1 = (wxListItemInternalData *) lParam1;
     wxListItemInternalData *data2 = (wxListItemInternalData *) lParam2;
@@ -1882,9 +1882,9 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2,  LPARAM l
 
 }
 
-bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
+bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxUIntPtr data)
 {
-    struct wxInternalDataSort internalData;
+    wxInternalDataSort internalData;
     internalData.user_fn = fn;
     internalData.data = data;
 
index 82a99344fcf82f37755d889265819febebf7c29e..7002c7abaebaa2575c9e0d8e446540e28d37ca80 100644 (file)
@@ -2205,7 +2205,7 @@ bool wxListCtrl::ScrollList(int dx, int dy)
 }
 
 
-bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
+bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxUIntPtr data)
 {
     if (m_genericImpl)
         return m_genericImpl->SortItems(fn, data);