Class ListStore

All Implemented Interfaces:
PointerInterface

public class ListStore extends Object
#GListStore is a simple implementation of #GListModel that stores all
items in memory.

It provides insertions, deletions, and lookups in logarithmic time
with a fast path for the common case of iterating the list linearly.

https://docs.gtk.org/gio/class.ListStore.html

  • Constructor Details

    • ListStore

      public ListStore(PointerContainer pointer)
    • ListStore

      public ListStore(long item_type)
      Creates a new #GListStore with items of type @item_type. @item_type
      must be a subclass of #GObject.
      Parameters:
      item_type - the #GType of items in the list
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • append

      public void append(@Nonnull Pointer item)
      Appends @item to @store. @item must be of type #GListStore:item-type.

      This function takes a ref on @item.

      Use g_list_store_splice() to append multiple items at the same time
      efficiently.
      Parameters:
      item - the new item
    • insert

      public void insert(int position, @Nonnull Pointer item)
      Inserts @item into @store at @position. @item must be of type
      #GListStore:item-type or derived from it. @position must be smaller
      than the length of the list, or equal to it to append.

      This function takes a ref on @item.

      Use g_list_store_splice() to insert multiple items at the same time
      efficiently.
      Parameters:
      position - the position at which to insert the new item
      item - the new item
    • insertSorted

      public int insertSorted(@Nonnull Pointer item, ListStore.OnCompareDataFunc compare_func, @Nullable Pointer user_data)
      Inserts @item into @store at a position to be determined by the
      @compare_func.

      The list must already be sorted before calling this function or the
      result is undefined. Usually you would approach this by only ever
      inserting items by way of this function.

      This function takes a ref on @item.
      Parameters:
      item - the new item
      compare_func - pairwise comparison function for sorting
      user_data - user data for @compare_func
      Returns:
      the position at which @item was inserted
    • remove

      public void remove(int position)
      Removes the item from @store that is at @position. @position must be
      smaller than the current length of the list.

      Use g_list_store_splice() to remove multiple items at the same time
      efficiently.
      Parameters:
      position - the position of the item that is to be removed
    • removeAll

      public void removeAll()
      Removes all items from @store.
    • sort

      public void sort(ListStore.OnCompareDataFunc compare_func, @Nullable Pointer user_data)
      Sort the items in @store according to @compare_func.
      Parameters:
      compare_func - pairwise comparison function for sorting
      user_data - user data for @compare_func
    • 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()