+extern "C" {
+static gint gtk_listbox_sort_callback(GtkTreeModel * WXUNUSED(model),
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ wxListBox *listbox)
+{
+ wxGtkObject<GtkTreeEntry> entry1(GetEntry(listbox->m_liststore, a, listbox));
+ wxCHECK_MSG(entry1, 0, wxT("Could not get first entry"));
+
+ wxGtkObject<GtkTreeEntry> 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 reccommend this)
+ return strcmp(gtk_tree_entry_get_collate_key(entry1),
+ gtk_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)
+{
+ wxGtkObject<GtkTreeEntry>
+ 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, gtk_tree_entry_get_collate_key(entry)) != 0;
+}