From 1efdf9cd65b4f1e201bf1f5e96a318e84a4d4586 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 7 Oct 2013 09:58:41 +0000 Subject: [PATCH] Handle comparisons of boolean and icon-text items in wxDataViewModel. For some reasons these types were not handled in wxDataViewModel::Compare(), unlike all the other standard ones. Closes #15407. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/datavcmn.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 2cad362531..f20f8da3d2 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -352,6 +352,26 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem if (dt2.IsEarlierThan(dt1)) return -1; } + else if (value1.GetType() == wxT("bool")) + { + bool b1 = value1.GetBool(); + bool b2 = value2.GetBool(); + + if (b1 != b2) + return b1 ? 1 : -1; + } + else if (value1.GetType() == wxT("wxDataViewIconText")) + { + wxDataViewIconText iconText1, iconText2; + + iconText1 << value1; + iconText2 << value2; + + int res = iconText1.GetText().Cmp(iconText2.GetText()); + if (res != 0) + return res; + } + // items must be different wxUIntPtr id1 = wxPtrToUInt(item1.GetID()),