| Version: 3.2.5

Public Member Functions | List of all members
wxTreeListItemComparator Class Referenceabstract
Class List by Category » Controls

`#include <wx/treelist.h>`

## Detailed Description

Class defining sort order for the items in wxTreeListCtrl.

See also
  wxTreeListCtrl

##

Library: wxCore
Category: Controls

Since
  2.9.3

## Public Member Functions

| wxTreeListItemComparator ()
| Default constructor. More...
virtual int | Compare (wxTreeListCtrl *treelist, unsigned column, wxTreeListItem first, wxTreeListItem second)=0
| Pure virtual function which must be overridden to define sort order. More...
virtual | ~wxTreeListItemComparator ()
| Trivial but virtual destructor. More...

## Constructor & Destructor Documentation

## ◆ wxTreeListItemComparator()

wxTreeListItemComparator::wxTreeListItemComparator | ( |  | ) |

Default constructor.

Notice that this class is not copiable, comparators are not passed by value.

## ◆ ~wxTreeListItemComparator()

virtual wxTreeListItemComparator::~wxTreeListItemComparator | ( |  | ) |

virtual

Trivial but virtual destructor.

Although this class is not used polymorphically by wxWidgets itself, provide virtual dtor in case it's used like this in the user code.

## Member Function Documentation

## ◆ Compare()

virtual int wxTreeListItemComparator::Compare | ( | wxTreeListCtrl * | treelist,
|  | unsigned | column,
|  | wxTreeListItem | first,
|  | wxTreeListItem | second
| ) |  |

pure virtual

Pure virtual function which must be overridden to define sort order.

The comparison function should return negative, null or positive value depending on whether the first item is less than, equal to or greater than the second one. The items should be compared using their values for the given column.

Parameters

  treelist | The control whose contents is being sorted.
  column | The column of this control used for sorting.
  first | First item to compare.
  second | Second item to compare.

Returns
  A negative value if the first item is less than (i.e. should appear above) the second one, zero if the two items are equal or a positive value if the first item is greater than (i.e. should appear below) the second one.