Class SliceListModel

All Implemented Interfaces:
PointerInterface

public class SliceListModel extends Object
`GtkSliceListModel` is a list model that presents a slice of another model.

This is useful when implementing paging by setting the size to the number
of elements per page and updating the offset whenever a different page is
opened.

https://docs.gtk.org/gtk4/class.SliceListModel.html

  • Constructor Details

    • SliceListModel

      public SliceListModel(PointerContainer pointer)
    • SliceListModel

      public SliceListModel(@Nullable ListModel model, int offset, int size)
      Creates a new slice model.

      It presents the slice from @offset to offset + @size
      of the given @model.
      Parameters:
      model - The model to use
      offset - the offset of the slice
      size - maximum size of the slice
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getModel

      public ListModel getModel()
      Gets the model that is currently being used or %NULL if none.
      Returns:
      The model in use
    • getOffset

      public int getOffset()
      Gets the offset set via gtk_slice_list_model_set_offset().
      Returns:
      The offset
    • getSize

      public int getSize()
      Gets the size set via gtk_slice_list_model_set_size().
      Returns:
      The size
    • setModel

      public void setModel(@Nullable ListModel model)
      Sets the model to show a slice of.

      The model's item type must conform to @self's item type.
      Parameters:
      model - The model to be sliced
    • setOffset

      public void setOffset(int offset)
      Sets the offset into the original model for this slice.

      If the offset is too large for the sliced model,
      @self will end up empty.
      Parameters:
      offset - the new offset to use
    • setSize

      public void setSize(int size)
      Sets the maximum size. @self will never have more items
      than @size.

      It can however have fewer items if the offset is too large
      or the model sliced from doesn't have enough items.
      Parameters:
      size - the maximum size
    • asListModel

      public ListModel asListModel()
      Implements interface ListModel. Call this to get access to interface functions.
      Returns:
      ListModel
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()