diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index f3af98ac3e..1e05eaa5b9 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -1938,7 +1938,11 @@ protected: void RemoveChild(unsigned int index); // Sorts children using specified comparison function. +#if WXWIN_COMPATIBILITY_3_2 + wxDEPRECATED_MSG("Don't use SortChildren function with argument of 'int (*)(wxPGProperty**, wxPGProperty**)' type. Use 'bool (*)(wxPGProperty*, wxPGProperty*)' argument instead") void SortChildren(int (*fCmp)(wxPGProperty**, wxPGProperty**)); +#endif // WXWIN_COMPATIBILITY_3_2 + void SortChildren(bool (*fCmp)(wxPGProperty*, wxPGProperty*)); void DoEnable( bool enable ); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 27af91c853..5e6c0c8977 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -2393,11 +2393,18 @@ void wxPGProperty::RemoveChild(unsigned int index) m_children.erase(m_children.begin()+index); } +#if WXWIN_COMPATIBILITY_3_2 void wxPGProperty::SortChildren(int (*fCmp)(wxPGProperty**, wxPGProperty**)) { wxArray_SortFunction sf(fCmp); std::sort(m_children.begin(), m_children.end(), sf); } +#endif // WXWIN_COMPATIBILITY_3_2 + +void wxPGProperty::SortChildren(bool (*fCmp)(wxPGProperty*, wxPGProperty*)) +{ + std::sort(m_children.begin(), m_children.end(), fCmp); +} void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const { diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index f57998adef..9794dee1a9 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -587,42 +587,17 @@ bool wxPropertyGridPageState::EnableCategories( bool enable ) } // ----------------------------------------------------------------------- - -static int wxPG_SortFunc_ByFunction(wxPGProperty **pp1, wxPGProperty **pp2) -{ - wxPGProperty *p1 = *pp1; - wxPGProperty *p2 = *pp2; - wxPropertyGrid* pg = p1->GetGrid(); - wxPGSortCallback sortFunction = pg->GetSortFunction(); - return sortFunction(pg, p1, p2); -} - -static int wxPG_SortFunc_ByLabel(wxPGProperty **pp1, wxPGProperty **pp2) -{ - wxPGProperty *p1 = *pp1; - wxPGProperty *p2 = *pp2; - return p1->GetLabel().CmpNoCase( p2->GetLabel() ); -} - -#if 0 -// -// For wxVector w/ wxUSE_STL=1, you would use code like this instead: -// - -#include - -static bool wxPG_SortFunc_ByFunction(wxPGProperty *p1, wxPGProperty *p2) +static bool wxPG_SortFunc_ByFunction(wxPGProperty* p1, wxPGProperty* p2) { wxPropertyGrid* pg = p1->GetGrid(); wxPGSortCallback sortFunction = pg->GetSortFunction(); return sortFunction(pg, p1, p2) < 0; } -static bool wxPG_SortFunc_ByLabel(wxPGProperty *p1, wxPGProperty *p2) +static bool wxPG_SortFunc_ByLabel(wxPGProperty* p1, wxPGProperty* p2) { return p1->GetLabel().CmpNoCase( p2->GetLabel() ) < 0; } -#endif void wxPropertyGridPageState::DoSortChildren( wxPGProperty* p, int flags )