-static int CALLBACK TreeView_CompareCallback(wxTreeItemData *pItem1,
- wxTreeItemData *pItem2,
- wxTreeCtrl *tree)
+// this is just a tiny namespace which is friend to wxTreeCtrl and so can use
+// functions such as IsDataIndirect()
+class wxTreeSortHelper
+{
+public:
+ static int CALLBACK Compare(LPARAM data1, LPARAM data2, LPARAM tree);
+
+private:
+ static wxTreeItemId GetIdFromData(wxTreeCtrl *tree, LPARAM item)
+ {
+ wxTreeItemData *data = (wxTreeItemData *)item;
+ if ( tree->IsDataIndirect(data) )
+ {
+ data = ((wxTreeItemIndirectData *)data)->GetData();
+ }
+
+ return data->GetId();
+ }
+};
+
+int CALLBACK wxTreeSortHelper::Compare(LPARAM pItem1,
+ LPARAM pItem2,
+ LPARAM htree)