static int sort_callback(GtkTreeModel*, GtkTreeIter* a, GtkTreeIter* b, void* data) { wxListBox* listbox = static_cast<wxListBox*>(data); 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; }
static gboolean search_callback(GtkTreeModel*, int, const char* key, GtkTreeIter* iter, void* data) { wxListBox* listbox = static_cast<wxListBox*>(data); wxTreeEntry* entry = GetEntry(listbox->m_liststore, iter, listbox); wxCHECK_MSG(entry, true, "could not get entry"); wxGtkString keyc(g_utf8_collate_key(key, -1)); return strncmp(keyc, wx_tree_entry_get_collate_key(entry), strlen(keyc)); }
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; }