gtk.map_list_model
Module for [MapListModel] class
Types 3
classMapListModel : gobject.object.ObjectWrap, gio.list_model.ListModel, gtk.section_model.SectionModel
A [gtk.map_list_model.MapListModel] maps the items in a list model to different items.
[gtk.map_list_model.MapListModel] uses a [gtk.types.MapListModelMapFunc].
Example: Create a list of GtkEventControllers
static gpointer
map_to_controllers (gpointer widget,
gpointer data)
{
gpointer result = gtk_widget_observe_controllers (widget);
g_object_unref (widget);
return result;
}
widgets = gtk_widget_observe_children (widget);
controllers = gtk_map_list_model_new (widgets,
map_to_controllers,
NULL, NULL);
model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
controllers);[gtk.map_list_model.MapListModel] will attempt to discard the mapped objects as soon as they are no longer needed and recreate them if necessary.
[gtk.map_list_model.MapListModel] passes through sections from the underlying model.
Methods
MapListModel self()Returns `this`, for use in `with` statements.MapListModelGidBuilder builder()Get builder for [gtk.maplistmodel.MapListModel] Returns: New builder objectgobject.types.GType itemType() @propertyGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].uint nItems() @propertyGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].gio.list_model.ListModel getModel()Gets the model that is currently being mapped or null if none. Returns: The model that gets mappedbool hasMap()Checks if a map function is currently set on self. Returns: true if a map function is setvoid setMapFunc(gtk.types.MapListModelMapFunc mapFunc = null)Sets the function used to map items.void setModel(gio.list_model.ListModel model = null)Sets the model to be mapped.Constructors
this(gio.list_model.ListModel model = null, gtk.types.MapListModelMapFunc mapFunc = null)Creates a new [gtk.maplistmodel.MapListModel] for the given arguments.classMapListModelGidBuilderImpl(T) : gobject.object.ObjectWrapGidBuilderImpl!T, gio.list_model.ListModelGidBuilderImpl!T, gtk.section_model.SectionModelGidBuilderImpl!T
Methods
T model(gio.list_model.ListModel propval)Set `model` property. Params: propval = The model being mapped. Returns: Builder instance for fluent chainingFluent builder for [gtk.map_list_model.MapListModel]
Methods