Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GtkMapListModel

[22:7] extends: object

A list model that maps the items in another model to different items. GtkMapListModel uses a [callback@Gtk.MapListModelMapFunc]. Example: Create a list of GtkEventControllers c 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.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GtkMapListModel (model = null, map_func = null, user_data = null, user_destroy = null)

    Creates a new GtkMapListModel for the given arguments.

    • @p model is The model to map.
    • @p map_func is map function.
    • @p user_data is user data passed to @map_func.
    • @p user_destroy is destroy notifier for @user_data.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as GObject.

    • @r A GObject object.
  • asListModel ()

    Wraps this handle as GListModel.

    • @r A GListModel object.
  • asSectionModel ()

    Wraps this handle as GtkSectionModel.

    • @r A GtkSectionModel object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setModel (object Value)

    The model being mapped.

    • @p Value is the new property value.
    • @r None.
  • get_model ()

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

    • @r The model that gets mapped.
  • has_map ()

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

    • @r %TRUE if a map function is set.
  • set_map_func (object user_destroy)

    Sets the function used to map items. The function will be called whenever an item needs to be mapped and must return the item to use for the given input item. Note that GtkMapListModel may call this function multiple times on the same item, because it may delete items it doesn't need anymore. GTK makes no effort to ensure that @map_func conforms to the item type of @self. It assumes that the caller knows what they are doing and the map function returns items of the appropriate type.

    • @p map_func is map function.
    • @p user_data is user data passed to @map_func.
    • @p user_destroy is destroy notifier for @user_data.
    • @r None.
  • set_model (object model)

    Sets the model to be mapped. GTK makes no effort to ensure that @model conforms to the item type expected by the map function. It assumes that the caller knows what they are doing and have set up an appropriate map function.

    • @p model is The model to be mapped.
    • @r None.
  • model ()

    Returns get_model as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use get_model() when lazy or change-notify access is required.

    • @r An Aussom list of elements.

class: GtkMapListModelMeta

[241:14] static extends: object

Generated metadata helpers for MapListModel class surfaces.

Methods

  • properties ()

    Returns property metadata for MapListModel.

    • @r A list.