gi-gtk4-4.0.12: Gtk 4.x bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Interfaces.SectionModel

Description

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 SectionModel::sectionsChanged signal by calling the sectionModelSectionsChanged function. All sections in the given range then need to be queried again. The ListModel::itemsChanged signal has the same effect, all sections in that range are invalidated, too.

Since: 4.12

Synopsis

Exported types

newtype SectionModel Source #

Memory-managed wrapper type.

Instances

Instances details
Eq SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

GObject SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

ManagedPtrNewtype SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

TypedObject SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

Methods

glibType :: IO GType #

HasParentTypes SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

IsGValue (Maybe SectionModel) Source #

Convert SectionModel to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Interfaces.SectionModel

type ParentTypes SectionModel Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

type ParentTypes SectionModel = '[ListModel, Object]

class (GObject o, IsDescendantOf SectionModel o) => IsSectionModel o Source #

Type class for types which can be safely cast to SectionModel, for instance with toSectionModel.

Instances

Instances details
(GObject o, IsDescendantOf SectionModel o) => IsSectionModel o Source # 
Instance details

Defined in GI.Gtk.Interfaces.SectionModel

toSectionModel :: (MonadIO m, IsSectionModel o) => o -> m SectionModel Source #

Cast to SectionModel, for types for which this is known to be safe. For general casts, use castTo.

Methods

getSection

sectionModelGetSection Source #

Arguments

:: (HasCallStack, MonadIO m, IsSectionModel a) 
=> a

self: a GtkSectionModel

-> Word32

position: the position of the item to query

-> m (Word32, Word32) 

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: 4.12

sectionsChanged

sectionModelSectionsChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSectionModel a) 
=> a

self: a GtkSectionModel

-> Word32

position: the first changed item

-> Word32

nItems: the number of changed items

-> m () 

This function emits the SectionModel::sectionsChanged 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 ListModel::itemsChanged implies the effect of the SectionModel::sectionsChanged 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 ListModel::itemsChanged instead of emitting two signals.

Since: 4.12

Signals

sectionsChanged

type SectionModelSectionsChangedCallback Source #

Arguments

 = Word32

position: The first item that may have changed

-> Word32

nItems: number of items with changes

-> IO () 

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 ListModel::itemsChanged implies the effect of the SectionModel::sectionsChanged signal for all the items it covers.

Since: 4.12

afterSectionModelSectionsChanged :: (IsSectionModel a, MonadIO m) => a -> ((?self :: a) => SectionModelSectionsChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the sectionsChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after sectionModel #sectionsChanged callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onSectionModelSectionsChanged :: (IsSectionModel a, MonadIO m) => a -> ((?self :: a) => SectionModelSectionsChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the sectionsChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on sectionModel #sectionsChanged callback