Module: Gtk::SectionModel

Defined in:
(unknown)

Overview

GtkSectionModel is 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.

Instance Method Summary collapse

Instance Method Details

#get_section(position, out_start, out_end) ⇒ nil

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.

Parameters:

  • position (Integer)

    the position of the item to query

  • out_start (Integer)

    the position of the first item in the section

  • out_end (Integer)

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

Returns:

  • (nil)

#sections_changed(position, n_items) ⇒ nil

Parameters:

  • position (Integer)
  • n_items (Integer)

Returns:

  • (nil)