Add wxDataViewCtrlInternal::ShouldBeSorted() helper instead of testing for
both IsSorted() and wxDataViewModel::HasDefaultCompare() in several places.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71327
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool IsSorted() const { return m_sort_column >= 0; }
bool IsSorted() const { return m_sort_column >= 0; }
+ // Should we be sorted either because we have a configured sort column or
+ // because we have a default sort order?
+ bool ShouldBeSorted() const
+ {
+ return IsSorted() || GetDataViewModel()->HasDefaultCompare();
+ }
+
+
// accessors
wxDataViewModel* GetDataViewModel() { return m_wx_model; }
const wxDataViewModel* GetDataViewModel() const { return m_wx_model; }
// accessors
wxDataViewModel* GetDataViewModel() { return m_wx_model; }
const wxDataViewModel* GetDataViewModel() const { return m_wx_model; }
- if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare())
+ if (m_internal->ShouldBeSorted())
{
gs_internal = m_internal;
m_children.Sort( &wxGtkTreeModelChildCmp );
{
gs_internal = m_internal;
m_children.Sort( &wxGtkTreeModelChildCmp );
void InsertNode( wxGtkTreeModelNode* child, unsigned pos )
{
void InsertNode( wxGtkTreeModelNode* child, unsigned pos )
{
- if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare())
+ if (m_internal->ShouldBeSorted())
{
AddNode(child);
return;
{
AddNode(child);
return;
{
m_children.Insert( id, pos );
{
m_children.Insert( id, pos );
- if (m_internal->IsSorted() || m_internal->GetDataViewModel()->HasDefaultCompare())
+ if (m_internal->ShouldBeSorted())
{
gs_internal = m_internal;
m_children.Sort( &wxGtkTreeModelChildCmp );
{
gs_internal = m_internal;
m_children.Sort( &wxGtkTreeModelChildCmp );