+extern "C" {
+static gint gtk_listbox_sort_callback(GtkTreeModel * WXUNUSED(model),
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ wxListBox *listbox)
+{
+ wxTreeEntry* entry1 = GetEntry(listbox->m_liststore, a, listbox);
+ wxCHECK_MSG(entry1, 0, wxT("Could not get first entry"));
+
+ wxTreeEntry* entry2 = GetEntry(listbox->m_liststore, b, listbox);
+ wxCHECK_MSG(entry2, 0, wxT("Could not get second entry"));
+
+ //We compare collate keys here instead of calling g_utf8_collate
+ //as it is rather slow (and even the docs recommend this)
+ return strcmp(wx_tree_entry_get_collate_key(entry1),
+ wx_tree_entry_get_collate_key(entry2)) >= 0;
+}
+}
+
+//-----------------------------------------------------------------------------
+// Searching callback (TRUE == not equal, FALSE == equal)
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean gtk_listbox_searchequal_callback(GtkTreeModel * WXUNUSED(model),
+ gint WXUNUSED(column),
+ const gchar* key,
+ GtkTreeIter* iter,
+ wxListBox* listbox)
+{
+ wxTreeEntry* entry = GetEntry(listbox->m_liststore, iter, listbox);
+ wxCHECK_MSG(entry, 0, wxT("Could not get entry"));
+
+ wxGtkString keycollatekey(g_utf8_collate_key(key, -1));
+
+ return strcmp(keycollatekey, wx_tree_entry_get_collate_key(entry)) != 0;
+}