Top | ![]() |
![]() |
![]() |
![]() |
GtkSortListModel * | gtk_sort_list_model_new () |
GtkSortListModel * | gtk_sort_list_model_new_for_type () |
void | gtk_sort_list_model_set_sort_func () |
gboolean | gtk_sort_list_model_has_sort () |
void | gtk_sort_list_model_set_model () |
GListModel * | gtk_sort_list_model_get_model () |
void | gtk_sort_list_model_resort () |
GtkSortListModel is a list model that takes a list model and sorts its elements according to a compare function.
GtkSortListModel is a generic model and because of that it cannot take advantage of any external knowledge when sorting. If you run into performance issues with GtkSortListModel, it is strongly recommended that you write your own sorting list model.
GtkSortListModel * gtk_sort_list_model_new (GListModel *model
,GCompareDataFunc sort_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Creates a new sort list model that uses the sort_func
to sort model
.
GtkSortListModel *
gtk_sort_list_model_new_for_type (GType item_type
);
Creates a new empty sort list model set up to return items of type item_type
.
It is up to the application to set a proper sort function and model to ensure
the item type is matched.
void gtk_sort_list_model_set_sort_func (GtkSortListModel *self
,GCompareDataFunc sort_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Sets the function used to sort items. The function will be called for every item and must return an integer less than, equal to, or greater than zero if for two items from the model if the first item is considered to be respectively less than, equal to, or greater than the second.
gboolean
gtk_sort_list_model_has_sort (GtkSortListModel *self
);
Checks if a sort function is currently set on self
void gtk_sort_list_model_set_model (GtkSortListModel *self
,GListModel *model
);
Sets the model to be sorted. The model
's item type must conform to
the item type of self
.
GListModel *
gtk_sort_list_model_get_model (GtkSortListModel *self
);
Gets the model currently sorted or NULL
if none.
void
gtk_sort_list_model_resort (GtkSortListModel *self
);
Causes self
to resort all items in the model.
Calling this function is necessary when data used by the sort function has changed.