Class: Gtk::MapListModel

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize(model, map_func, user_data, user_destroy) ⇒ Gtk::MapListModel

Creates a new GtkMapListModel for the given arguments.

Parameters:

  • model (Gio::ListModel)

    The model to map

  • map_func (Gtk::MapListModelMapFunc)

    map function

  • user_data (GObject)

    user data passed to map_func

  • user_destroy (GLib::DestroyNotify)

    destroy notifier for user_data

Instance Method Details

#has_mapBoolean

Checks if a map function is currently set on self.

Returns:

  • (Boolean)

    true if a map function is set

#has_map=(has_map) ⇒ Boolean

If a map is set for this model

Parameters:

  • has_map (Boolean)

Returns:

  • (Boolean)

    has-map

  • (Boolean)

    has-map

#has_map?Boolean

If a map is set for this model

Returns:

  • (Boolean)

    has-map

#item_typeGLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Returns:

  • (GLib::Type)

    item-type

#item_type=(item_type) ⇒ GLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Parameters:

  • item_type (GLib::Type)

Returns:

  • (GLib::Type)

    item-type

  • (GLib::Type)

    item-type

#modelGio::ListModel

The model being mapped.

Returns:

  • (Gio::ListModel)

    model

#model=(model) ⇒ Gio::ListModel

The model being mapped.

Parameters:

  • model (Gio::ListModel)

Returns:

  • (Gio::ListModel)

    model

  • (Gio::ListModel)

    model

#n_itemsInteger

The number of items. See [methodGio.ListModel.get_n_items].

Returns:

  • (Integer)

    n-items

#n_items=(n_items) ⇒ Integer

The number of items. See [methodGio.ListModel.get_n_items].

Parameters:

  • n_items (Integer)

Returns:

  • (Integer)

    n-items

  • (Integer)

    n-items

#set_map_func(map_func, user_data, user_destroy) ⇒ nil

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.

Parameters:

  • map_func (Gtk::MapListModelMapFunc)

    map function

  • user_data (GObject)

    user data passed to map_func

  • user_destroy (GLib::DestroyNotify)

    destroy notifier for user_data

Returns:

  • (nil)