Gtk.List_Box.Bind_Model_User_Data

Entities

Generic formal parameters

Access Types

Subprograms

Description

Bind_Model

procedure Bind_Model
   (Self                : not null access Gtk.List_Box.Gtk_List_Box_Record'Class;
    Model               : Glib.List_Model.Glist_Model;
    Create_Widget_Func  : Gtk_List_Box_Create_Widget_Func;
    User_Data           : User_Data_Type;
    User_Data_Free_Func : Glib.G_Destroy_Notify_Address)

Binds Model to Box. If Box was already bound to a model, that previous binding is destroyed. The contents of Box are cleared and then filled with widgets that represent items from Model. Box is updated whenever Model changes. If Model is null, Box is left empty. It is undefined to add or remove widgets directly (for example, with Gtk.List_Box.Insert or Gtk.Container.Add) while Box is bound to a model. Note that using a model is incompatible with the filtering and sorting functionality in GtkListBox. When using a model, filtering and sorting should be implemented by the model. Since: gtk+ 3.16

Parameters
Self
Model

the Glib.List_Model.Glist_Model to be bound to Box

Create_Widget_Func

a function that creates widgets for items or null in case you also passed null as Model

User_Data

user data passed to Create_Widget_Func

User_Data_Free_Func

function for freeing User_Data

Destroy

procedure Destroy (Data : in out User_Data_Type)
Parameters
Data

Gtk_List_Box_Create_Widget_Func

type Gtk_List_Box_Create_Widget_Func is access function
  (Item      : System.Address;
   User_Data : User_Data_Type) return Gtk.Widget.Gtk_Widget;

Called for list boxes that are bound to a Glib.List_Model.Glist_Model with Gtk.List_Box.Bind_Model for each item that gets added to the model. Versions of GTK+ prior to 3.18 called gtk_widget_show_all on the rows created by the GtkListBoxCreateWidgetFunc, but this forced all widgets inside the row to be shown, and is no longer the case. Applications should be updated to show the desired row widgets. Since: gtk+ 3.16

Parameters
Item

the item from the model for which to create a widget for

User_Data

user data

Return Value

a Gtk.Widget.Gtk_Widget that represents Item

User_Data_Type

type User_Data_Type (<>) is private;