Interface SectionModel<T extends GObject>
- All Superinterfaces:
Collection<T>
,Iterable<T>
,List<T>
,ListModel<T>
,ListModelJavaList<T>
,Proxy
,SequencedCollection<T>
- All Known Implementing Classes:
FilterListModel
,FlattenListModel
,MapListModel
,MultiSelection
,NoSelection
,SectionModel.SectionModelImpl
,SingleSelection
,SliceListModel
,SortListModel
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
Gtk.SectionModel::sections-changed
signal by calling the
sectionsChanged(int, int)
function. All sections in the given range
then need to be queried again.
The Gio.ListModel::items-changed
signal has the same effect, all sections in
that range are invalidated, too.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The SectionModelImpl type represents a native instance of the SectionModel interface.static class
The list of virtual functions for theGtkSectionModel
interface.static interface
Functional interface declaration of theSectionsChangedCallback
callback.Nested classes/interfaces inherited from interface org.gnome.gio.ListModel
ListModel.ItemsChangedCallback, ListModel.ListModelImpl, ListModel.ListModelInterface
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
emitSectionsChanged
(int position, int nItems) Emits the "sections-changed" signal.default void
getSection
(int position, Out<Integer> outStart, Out<Integer> outEnd) Query the section that covers the given position.static Type
getType()
Get the GType of the SectionModel classEmitted when the start-of-section state of some of the items inmodel
changes.default void
sectionsChanged
(int position, int nItems) This function emits theGtk.SectionModel::sections-changed
signal to notify about changes to sections.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
Methods inherited from interface org.gnome.gio.ListModel
emitItemsChanged, getItem, getItemType, getNItems, itemsChanged, onItemsChanged
Methods inherited from interface io.github.jwharm.javagi.gio.ListModelJavaList
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
-
Method Details
-
getType
-
getSection
Query the section that covers the given position. The number of items in the section can be computed byout_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
- the position of the item to queryoutStart
- the position of the first item in the sectionoutEnd
- the position of the first item not part of the section anymore.
-
sectionsChanged
default void sectionsChanged(int position, int nItems) This function emits theGtk.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
Gio.ListModel::items-changed
implies the effect of theGtk.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
Gio.ListModel::items-changed
instead of emitting two signals.- Parameters:
position
- the first changed itemnItems
- the number of changed items
-
onSectionsChanged
default SignalConnection<SectionModel.SectionsChangedCallback> onSectionsChanged(SectionModel.SectionsChangedCallback handler) Emitted when the start-of-section state of some of the items inmodel
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
Gio.ListModel::items-changed
implies the effect of theGtk.SectionModel::sections-changed
signal for all the items it covers.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSectionsChanged
default void emitSectionsChanged(int position, int nItems) Emits the "sections-changed" signal. SeeonSectionsChanged(org.gnome.gtk.SectionModel.SectionsChangedCallback)
.
-