An interface that adds support for sections to list models.
A GtkSectionModel groups successive items into so-called sections. List widgets like GtkListView and GtkGridView then allow displaying section headers for these sections by installing a header factory.
Many GTK list models support sections inherently, or they pass through the sections of a model they are wrapping.
When the section groupings of a model change, the model will emit the [signalGtk.SectionModel::sections-changed] signal by calling the [methodGtk.SectionModel.sections_changed] function. All sections in the given range then need to be queried again. The [signalGio.ListModel::items-changed] signal has the same effect, all sections in that range are invalidated, too.
function "+" (W : Gtk_Section_Model) return Gtk_Section_Model
type Cb_GObject_Guint_Guint_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Position : Guint;
N_Items : Guint);
type Cb_Gtk_Section_Model_Guint_Guint_Void is not null access procedure
(Self : Gtk_Section_Model;
Position : Guint;
N_Items : Guint);
procedure Get_Section
(Self : Gtk_Section_Model;
Position : Guint;
Out_Start : out Guint;
Out_End : out Guint)
Query the section that covers the given position. The number of items in the section can be computed by out_end - out_start. If the position is larger than the number of items, a single range from n_items to G_MAXUINT will be returned. Since: gtk+ 4.12
the position of the item to query
the position of the first item in the section
the position of the first item not part of the section anymore.
function Get_Type return Glib.GType
type Gtk_Section_Model is new Glib.Types.GType_Interface;
Null_Gtk_Section_Model : constant Gtk_Section_Model;
procedure On_Sections_Changed
(Self : Gtk_Section_Model;
Call : Cb_GObject_Guint_Guint_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the start-of-section state of some of the items in Model changes.
Note that this signal does not specify the new section state of the items, they need to be queried manually. It is also not necessary for a model to change the section state of any of the items in the section model, though it would be rather useless to emit such a signal.
The [signalGio.ListModel::items-changed] implies the effect of the [signalGtk.SectionModel::sections-changed] signal for all the items it covers.
Callback parameters: -- @param Position The first item that may have changed -- @param N_Items number of items with changes
procedure On_Sections_Changed
(Self : Gtk_Section_Model;
Call : Cb_Gtk_Section_Model_Guint_Guint_Void;
After : Boolean := False)
Emitted when the start-of-section state of some of the items in Model changes.
Note that this signal does not specify the new section state of the items, they need to be queried manually. It is also not necessary for a model to change the section state of any of the items in the section model, though it would be rather useless to emit such a signal.
The [signalGio.ListModel::items-changed] implies the effect of the [signalGtk.SectionModel::sections-changed] signal for all the items it covers.
Callback parameters: -- @param Position The first item that may have changed -- @param N_Items number of items with changes
subtype Section_Model_Interface_Descr is Glib.Object.Interface_Description;
procedure Sections_Changed
(Self : Gtk_Section_Model;
Position : Guint;
N_Items : Guint)
This function emits the [signalGtk.SectionModel::sections-changed] signal to notify about changes to sections. It must cover all positions that used to be a section start or that are now a section start. It does not have to cover all positions for which the section has changed. The [signalGio.ListModel::items-changed] implies the effect of the [signalGtk.SectionModel::sections-changed] signal for all the items it covers. It is recommended that when changes to the items cause section changes in a larger range, that the larger range is included in the emission of the [signalGio.ListModel::items-changed] instead of emitting two signals. Since: gtk+ 4.12
the first changed item
the number of changed items
procedure Set_Get_Section
(Self : Section_Model_Interface_Descr;
Handler : Virtual_Get_Section)
See Glib.Object.Add_Interface
Signal_Sections_Changed : constant Glib.Signal_Name := "sections-changed";
Emitted when the start-of-section state of some of the items in Model changes.
Note that this signal does not specify the new section state of the items, they need to be queried manually. It is also not necessary for a model to change the section state of any of the items in the section model, though it would be rather useless to emit such a signal.
The [signalGio.ListModel::items-changed] implies the effect of the [signalGtk.SectionModel::sections-changed] signal for all the items it covers.
Callback parameters: -- @param Position The first item that may have changed -- @param N_Items number of items with changes
type Virtual_Get_Section is access procedure
(Self : Gtk_Section_Model;
Position : Guint;
Out_Start : out Guint;
Out_End : out Guint);
Query the section that covers the given position. The number of items in the section can be computed by out_end - out_start. If the position is larger than the number of items, a single range from n_items to G_MAXUINT will be returned. Since: gtk+ 4.12
the position of the item to query
the position of the first item in the section
the position of the first item not part of the section anymore.