MapListModel

open class MapListModel(pointer: <Error class: unknown class><<Error class: unknown class>>) : SectionModel

A GtkMapListModel maps the items in a list model to different items.

GtkMapListModel uses a callback@Gtk.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);

GtkMapListModel will attempt to discard the mapped objects as soon as they are no longer needed and recreate them if necessary.

GtkMapListModel passes through sections from the underlying model.

Skipped during bindings generation

  • method has-map: Property has no getter nor setter

  • method item-type: Property has no getter nor setter

  • method n-items: Property has no getter nor setter

Constructors

Link copied to clipboard
constructor(model: <Error class: unknown class>? = null, mapFunc: MapListModelMapFunc)

Creates a new GtkMapListModel for the given arguments.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val gioListModelPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtkMapListModelPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val gtkSectionModelPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val model: <Error class: unknown class>?

The model being mapped.

Functions

Link copied to clipboard
open fun connectSectionsChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, <Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted when the start-of-section state of some of the items in @model changes.

Link copied to clipboard
open fun getModel(): <Error class: unknown class>?

Gets the model that is currently being mapped or null if none.

Link copied to clipboard
open fun hasMap(): Boolean

Checks if a map function is currently set on @self.

Link copied to clipboard
open fun sectionsChanged(position: <Error class: unknown class>, nItems: <Error class: unknown class>)

This function emits the signal@Gtk.SectionModel::sections-changed signal to notify about changes to sections.

Link copied to clipboard
open fun setMapFunc(mapFunc: MapListModelMapFunc)

Sets the function used to map items.

Link copied to clipboard
open fun setModel(model: <Error class: unknown class>? = null)

Sets the model to be mapped.