pass wxIntPtr, not wxUIntPtr, to wxListCtrl::SortItems() callback as it's more compatible with the existing code assuming that this parameter is signed (as our own wxFileCtrl did)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -227,7 +227,7 @@ Changes in behaviour which may result in compilation errors
|
|||||||
be vetoed any more, use the new wxEVT_GRID_CELL_CHANGING event to do it.
|
be vetoed any more, use the new wxEVT_GRID_CELL_CHANGING event to do it.
|
||||||
|
|
||||||
- wxListCtrlCompare function used with wxListCtrl::SortItems() must now declare
|
- wxListCtrlCompare function used with wxListCtrl::SortItems() must now declare
|
||||||
its third parameter as wxUIntPtr and not long (this allows passing pointers
|
its third parameter as wxIntPtr and not long (this allows passing pointers
|
||||||
to it under 64 bit platforms too).
|
to it under 64 bit platforms too).
|
||||||
|
|
||||||
- Global wxPendingEvents and wxPendingEventsLocker objects were removed.
|
- Global wxPendingEvents and wxPendingEventsLocker objects were removed.
|
||||||
|
@@ -138,7 +138,7 @@ public:
|
|||||||
long InsertColumn( long col, const wxString& heading,
|
long InsertColumn( long col, const wxString& heading,
|
||||||
int format = wxLIST_FORMAT_LEFT, int width = -1 );
|
int format = wxLIST_FORMAT_LEFT, int width = -1 );
|
||||||
bool ScrollList( int dx, int dy );
|
bool ScrollList( int dx, int dy );
|
||||||
bool SortItems( wxListCtrlCompare fn, wxUIntPtr data );
|
bool SortItems( wxListCtrlCompare fn, wxIntPtr data );
|
||||||
bool Update( long item );
|
bool Update( long item );
|
||||||
// Must provide overload to avoid hiding it (and warnings about it)
|
// Must provide overload to avoid hiding it (and warnings about it)
|
||||||
virtual void Update() { wxControl::Update(); }
|
virtual void Update() { wxControl::Update(); }
|
||||||
|
@@ -610,7 +610,7 @@ public:
|
|||||||
void InsertItem( wxListItem &item );
|
void InsertItem( wxListItem &item );
|
||||||
void InsertColumn( long col, wxListItem &item );
|
void InsertColumn( long col, wxListItem &item );
|
||||||
int GetItemWidthWithImage(wxListItem * item);
|
int GetItemWidthWithImage(wxListItem * item);
|
||||||
void SortItems( wxListCtrlCompare fn, wxUIntPtr data );
|
void SortItems( wxListCtrlCompare fn, wxIntPtr data );
|
||||||
|
|
||||||
size_t GetItemCount() const;
|
size_t GetItemCount() const;
|
||||||
bool IsEmpty() const { return GetItemCount() == 0; }
|
bool IsEmpty() const { return GetItemCount() == 0; }
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// type of compare function for wxListCtrl sort operation
|
// type of compare function for wxListCtrl sort operation
|
||||||
typedef
|
typedef
|
||||||
int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, wxUIntPtr sortData);
|
int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, wxIntPtr sortData);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxListCtrl constants
|
// wxListCtrl constants
|
||||||
|
@@ -353,7 +353,7 @@ public:
|
|||||||
// or zero if the two items are equivalent.
|
// or zero if the two items are equivalent.
|
||||||
|
|
||||||
// data is arbitrary data to be passed to the sort function.
|
// data is arbitrary data to be passed to the sort function.
|
||||||
bool SortItems(wxListCtrlCompare fn, wxUIntPtr data);
|
bool SortItems(wxListCtrlCompare fn, wxIntPtr data);
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
|
@@ -281,7 +281,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
|
|||||||
// or zero if the two items are equivalent.
|
// or zero if the two items are equivalent.
|
||||||
|
|
||||||
// data is arbitrary data to be passed to the sort function.
|
// data is arbitrary data to be passed to the sort function.
|
||||||
bool SortItems(wxListCtrlCompare fn, wxUIntPtr data);
|
bool SortItems(wxListCtrlCompare fn, wxIntPtr data);
|
||||||
|
|
||||||
wxMacDataBrowserListCtrlControl* GetListPeer() const;
|
wxMacDataBrowserListCtrlControl* GetListPeer() const;
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
|
|||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
|
|
||||||
wxListCtrlCompare GetCompareFunc() { return m_compareFunc; };
|
wxListCtrlCompare GetCompareFunc() { return m_compareFunc; };
|
||||||
wxUIntPtr GetCompareFuncData() { return m_compareFuncData; };
|
wxIntPtr GetCompareFuncData() { return m_compareFuncData; };
|
||||||
|
|
||||||
|
|
||||||
// public overrides needed for pimpl approach
|
// public overrides needed for pimpl approach
|
||||||
@@ -391,7 +391,7 @@ protected:
|
|||||||
void* m_macListCtrlEventHandler;
|
void* m_macListCtrlEventHandler;
|
||||||
void* m_cgContext;
|
void* m_cgContext;
|
||||||
wxListCtrlCompare m_compareFunc;
|
wxListCtrlCompare m_compareFunc;
|
||||||
wxUIntPtr m_compareFuncData;
|
wxIntPtr m_compareFuncData;
|
||||||
|
|
||||||
wxTextCtrl* m_textCtrl; // The control used for editing a label
|
wxTextCtrl* m_textCtrl; // The control used for editing a label
|
||||||
wxImageList * m_imageListNormal; // The image list for normal icons
|
wxImageList * m_imageListNormal; // The image list for normal icons
|
||||||
|
@@ -842,7 +842,7 @@ public:
|
|||||||
using the specified @a fnSortCallBack function. This function must have the
|
using the specified @a fnSortCallBack function. This function must have the
|
||||||
following prototype:
|
following prototype:
|
||||||
@code
|
@code
|
||||||
int wxCALLBACK wxListCompareFunction(long item1, long item2, wxUIntPtr sortData)
|
int wxCALLBACK wxListCompareFunction(long item1, long item2, wxIntPtr sortData)
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
It is called each time when the two items must be compared and should return 0
|
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.
|
Please see the @ref page_samples_listctrl for an example of using this function.
|
||||||
*/
|
*/
|
||||||
bool SortItems(wxListCtrlCompare fnSortCallBack, wxUIntPtr data);
|
bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ static const int NUM_ITEMS = 10;
|
|||||||
static const int NUM_ICONS = 9;
|
static const int NUM_ICONS = 9;
|
||||||
|
|
||||||
int wxCALLBACK
|
int wxCALLBACK
|
||||||
MyCompareFunction(long item1, long item2, wxUIntPtr WXUNUSED(sortData))
|
MyCompareFunction(long item1, long item2, wxIntPtr WXUNUSED(sortData))
|
||||||
{
|
{
|
||||||
// inverse the order
|
// inverse the order
|
||||||
if (item1 < item2)
|
if (item1 < item2)
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxUIntPtr sortOrder)
|
int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -70,7 +70,7 @@ int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxUIntPtr sortOrde
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxUIntPtr sortOrder)
|
int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -92,7 +92,7 @@ int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxUIntPtr sortOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxUIntPtr sortOrder)
|
int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
@@ -114,7 +114,7 @@ int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxUIntPtr sortOrder
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxUIntPtr sortOrder)
|
int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxIntPtr sortOrder)
|
||||||
{
|
{
|
||||||
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
|
||||||
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
|
||||||
|
@@ -4152,7 +4152,7 @@ int wxListMainWindow::GetItemWidthWithImage(wxListItem * item)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static wxListCtrlCompare list_ctrl_compare_func_2;
|
static wxListCtrlCompare list_ctrl_compare_func_2;
|
||||||
static wxUIntPtr list_ctrl_compare_data;
|
static wxIntPtr list_ctrl_compare_data;
|
||||||
|
|
||||||
int LINKAGEMODE list_ctrl_compare_func_1( wxListLineData **arg1, wxListLineData **arg2 )
|
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 );
|
return list_ctrl_compare_func_2( data1, data2, list_ctrl_compare_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::SortItems( wxListCtrlCompare fn, wxUIntPtr data )
|
void wxListMainWindow::SortItems( wxListCtrlCompare fn, wxIntPtr data )
|
||||||
{
|
{
|
||||||
// selections won't make sense any more after sorting the items so reset
|
// selections won't make sense any more after sorting the items so reset
|
||||||
// them
|
// them
|
||||||
@@ -4918,7 +4918,7 @@ bool wxGenericListCtrl::ScrollList( int dx, int dy )
|
|||||||
// or zero if the two items are equivalent.
|
// or zero if the two items are equivalent.
|
||||||
// data is arbitrary data to be passed to the sort function.
|
// data is arbitrary data to be passed to the sort function.
|
||||||
|
|
||||||
bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, wxUIntPtr data )
|
bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, wxIntPtr data )
|
||||||
{
|
{
|
||||||
m_mainWin->SortItems( fn, data );
|
m_mainWin->SortItems( fn, data );
|
||||||
return true;
|
return true;
|
||||||
|
@@ -1865,7 +1865,7 @@ bool wxListCtrl::ScrollList(int dx, int dy)
|
|||||||
struct wxInternalDataSort
|
struct wxInternalDataSort
|
||||||
{
|
{
|
||||||
wxListCtrlCompare user_fn;
|
wxListCtrlCompare user_fn;
|
||||||
wxUIntPtr data;
|
wxIntPtr data;
|
||||||
};
|
};
|
||||||
|
|
||||||
int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
@@ -1882,7 +1882,7 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxUIntPtr data)
|
bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxIntPtr data)
|
||||||
{
|
{
|
||||||
wxInternalDataSort internalData;
|
wxInternalDataSort internalData;
|
||||||
internalData.user_fn = fn;
|
internalData.user_fn = fn;
|
||||||
|
@@ -2205,7 +2205,7 @@ bool wxListCtrl::ScrollList(int dx, int dy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxUIntPtr data)
|
bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxIntPtr data)
|
||||||
{
|
{
|
||||||
if (m_genericImpl)
|
if (m_genericImpl)
|
||||||
return m_genericImpl->SortItems(fn, data);
|
return m_genericImpl->SortItems(fn, data);
|
||||||
|
Reference in New Issue
Block a user