2.15 <GtkSectionModel>

Interface: <GtkSectionModel>

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 section-model:sections-changed signal by calling the section-model:sections-changed function. All sections in the given range then need to be queried again. The list-model:items-changed signal has the same effect, all sections in that range are invalidated, too.

Procedures

Method: section-model:get-section self position ⇒ out-start out-end
Method: get-section self position ⇒ out-start out-end

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.

self

Passed: a <GtkSectionModel>.

a <GtkSectionModel>

position

Passed: an unsigned 32-bit integer.

the position of the item to query

out-start

Returned: an unsigned 32-bit integer.

the position of the first item in the section

out-end

Returned: an unsigned 32-bit integer.

the position of the first item not part of the section anymore.

Method: section-model:sections-changed self position n-items
Method: sections-changed self position n-items

This function emits the section-model: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 list-model:items-changed implies the effect of the section-model: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 list-model:items-changed instead of emitting two signals.

self

Passed: a <GtkSectionModel>.

a <GtkSectionModel>

position

Passed: an unsigned 32-bit integer.

the first changed item

n-items

Passed: an unsigned 32-bit integer.

the number of changed items

Signals

Signal: section-model:sections-changed

Connect a handler with (connect object section-model:sections-changed handler). It is called as (handler self position n-items).

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 list-model:items-changed implies the effect of the section-model:sections-changed signal for all the items it covers.

self

Passed: a <GtkSectionModel>.

position

Passed: an unsigned 32-bit integer.

The first item that may have changed

n-items

Passed: an unsigned 32-bit integer.

number of items with changes

Virtual methods

Virtual method: section-model:do-get-section implementor self position ⇒ out-start out-end

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.

To override it in a new class, give register-type #:vfuncs `((get-section . ,procedure)). The procedure is called as (procedure self position) ⇒ out-start out-end.

implementor

Passed: the class whose implementation to call: a class that implements <GtkSectionModel>, or its GType number.

self

Passed: a <GtkSectionModel>.

a <GtkSectionModel>

position

Passed: an unsigned 32-bit integer.

the position of the item to query

out-start

Returned: an unsigned 32-bit integer.

the position of the first item in the section

out-end

Returned: an unsigned 32-bit integer.

the position of the first item not part of the section anymore.