![]() |
![]() |
![]() |
![]() |
GtkFilterListModel is a list model that filters a given other listmodel. It hides some elements from the other model according to criteria given by a GtkFilterListModelFilterFunc.
GtkFilterListModel * gtk_filter_list_model_new (GListModel *model
,GtkFilterListModelFilterFunc filter_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Creates a new GtkFilterListModel that will filter model
using the given
filter_func
.
model |
the model to sort |
|
filter_func |
filter function or |
[allow-none] |
user_data |
user data passed to |
|
user_destroy |
destroy notifier for |
GtkFilterListModel *
gtk_filter_list_model_new_for_type (GType item_type
);
Creates a new empty filter list model set up to return items of type item_type
.
It is up to the application to set a proper filter function and model to ensure
the item type is matched.
void gtk_filter_list_model_set_model (GtkFilterListModel *self
,GListModel *model
);
Sets the model to be filtered.
Note that GTK makes no effort to ensure that model
conforms to
the item type of self
. It assumes that the caller knows what they
are doing and have set up an appropriate filter function to ensure
that item types match.
GListModel *
gtk_filter_list_model_get_model (GtkFilterListModel *self
);
Gets the model currently filtered or NULL
if none.
void gtk_filter_list_model_set_filter_func (GtkFilterListModel *self
,GtkFilterListModelFilterFunc filter_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Sets the function used to filter items. The function will be called for every
item and if it returns TRUE
the item is considered visible.
self |
||
filter_func |
filter function or |
[allow-none] |
user_data |
user data passed to |
|
user_destroy |
destroy notifier for |
gboolean
gtk_filter_list_model_has_filter (GtkFilterListModel *self
);
Checks if a filter function is currently set on self
void
gtk_filter_list_model_refilter (GtkFilterListModel *self
);
Causes self
to refilter all items in the model.
Calling this function is necessary when data used by the filter function has changed.