wxTreeCtrl::Sort() changed, adapted the sample to show it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-12-18 15:37:19 +00:00
parent 5fbc0fa65a
commit e1ee62bd79
4 changed files with 143 additions and 48 deletions

View File

@@ -46,7 +46,6 @@ class wxImageList;
class wxGenericTreeItem;
class wxTreeItemData;
typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2);
// -----------------------------------------------------------------------------
// wxTreeItemId - unique identifier of a tree element
@@ -415,13 +414,17 @@ public:
// end editing and accept or discard the changes to item label
void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE);
// sort the children of this item using the specified callback function
// (it should return -1, 0 or +1 as usual), if it's not specified
// alphabetical comparaison is performed.
// sorting
// this function is called to compare 2 items and should return -1, 0
// or +1 if the first item is less than, equal to or greater than the
// second one. The base class version performs alphabetic comparaison
// of item labels (GetText)
virtual int OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2);
// sort the children of this item using OnCompareItems
//
// NB: this function is not reentrant!
void SortChildren(const wxTreeItemId& item,
wxTreeItemCmpFunc *cmpFunction = NULL);
// NB: this function is not reentrant and not MT-safe (FIXME)!
void SortChildren(const wxTreeItemId& item);
// callbacks
void OnPaint( wxPaintEvent &event );