Top | ![]() |
![]() |
![]() |
![]() |
GtkSliceListModel * | gtk_slice_list_model_new () |
GtkSliceListModel * | gtk_slice_list_model_new_for_type () |
void | gtk_slice_list_model_set_model () |
GListModel * | gtk_slice_list_model_get_model () |
void | gtk_slice_list_model_set_offset () |
guint | gtk_slice_list_model_get_offset () |
void | gtk_slice_list_model_set_size () |
guint | gtk_slice_list_model_get_size () |
GtkSliceListModel is a list model that takes a list model and presents a slice of that model.
This is useful when implementing paging by setting the size to the number of elements per page and updating the offset whenever a different page is opened.
GtkSliceListModel * gtk_slice_list_model_new (GListModel *model
,guint offset
,guint size
);
Creates a new slice model that presents the slice from offset
to
offset
+ size
our of the given model
.
GtkSliceListModel *
gtk_slice_list_model_new_for_type (GType item_type
);
Creates a new empty GtkSliceListModel for the given item_type
that
can be set up later.
void gtk_slice_list_model_set_model (GtkSliceListModel *self
,GListModel *model
);
Sets the model to show a slice of. The model's item type must conform
to self
's item type.
GListModel *
gtk_slice_list_model_get_model (GtkSliceListModel *self
);
Gets the model that is curently being used or NULL
if none.
void gtk_slice_list_model_set_offset (GtkSliceListModel *self
,guint offset
);
Sets the offset into the original model for this slice.
If the offset is too large for the sliced model,
self
will end up empty.
guint
gtk_slice_list_model_get_offset (GtkSliceListModel *self
);
Gets the offset set via gtk_slice_list_model_set_offset()
void gtk_slice_list_model_set_size (GtkSliceListModel *self
,guint size
);
Sets the maximum size. self
will never have more items
than size
.
It can however have fewer items if the offset is too large or the model sliced from doesn't have enough items.
guint
gtk_slice_list_model_get_size (GtkSliceListModel *self
);
Gets the size set via gtk_slice_list_model_set_size()
.