GTK+ Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkListStore

## Name

GtkListStore --

## Synopsis

    #include <gtk/gtk.h>

    struct      GtkListStore;
    GtkListStore* gtk_list_store_new            (gint n_columns,
                                                 ...);
    void        gtk_list_store_remove           (GtkListStore *list_store,
                                                 GtkTreeIter *iter);
    void        gtk_list_store_insert           (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 gint position);
    void        gtk_list_store_insert_before    (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 GtkTreeIter *sibling);
    void        gtk_list_store_insert_after     (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 GtkTreeIter *sibling);
    void        gtk_list_store_prepend          (GtkListStore *list_store,
                                                 GtkTreeIter *iter);
    void        gtk_list_store_append           (GtkListStore *list_store,
                                                 GtkTreeIter *iter);

## Description

## Details

### struct GtkListStore

    struct GtkListStore
    {
      GObject parent;

      /*< private >*/
      gint stamp;
      gpointer root;
      gpointer tail;
      GList *sort_list;
      gint n_columns;
      gint sort_column_id;
      GtkSortType order;
      GType *column_headers;
      gint length;
      GtkTreeIterCompareFunc default_sort_func;
      gpointer default_sort_data;
      GtkDestroyNotify default_sort_destroy;
    };

### gtk_list_store_new ()

    GtkListStore* gtk_list_store_new            (gint n_columns,
                                                 ...);

Creates a new list store as with `n_columns` columns each of the types passed in. As an example, gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_PIXBUF); will create a new GtkListStore with three columns, of type int, string and GDkPixbuf respectively.

`n_columns` : | number of columns in the list store
`...` : | all GType types for the columns, from first to last
Returns : | a new GtkListStore

### gtk_list_store_remove ()

    void        gtk_list_store_remove           (GtkListStore *list_store,
                                                 GtkTreeIter *iter);

Removes the given row from the list store. After being removed, `iter` is set to be the next valid row, or invalidated if it pointed to the last row inn `list_store`

`list_store` : | A GtkListStore
`iter` : | A valid GtkTreeIter

### gtk_list_store_insert ()

    void        gtk_list_store_insert           (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 gint position);

Creates a new row at `position`. `iter` will be changed to point to this new row. If `position` is larger than the number of rows on the list, then the new row will be appended to the list. The row will be empty before this function is called. To fill in values, you need to call `gtk_list_store_set` or `gtk_list_store_set_value`.

`list_store` : | A GtkListStore
`iter` : | An unset GtkTreeIter to set to the new row
`position` : | position to insert the new row

### gtk_list_store_insert_before ()

    void        gtk_list_store_insert_before    (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 GtkTreeIter *sibling);

Inserts a new row before `sibling`. If `sibling` is `NULL`, then the row will be appended to the beginning of the list. `iter` will be changed to point to this new row. The row will be empty before this function is called. To fill in values, you need to call `gtk_list_store_set` or `gtk_list_store_set_value`.

`list_store` : | A GtkListStore
`iter` : | An unset GtkTreeIter to set to the new row
`sibling` : | A valid GtkTreeIter, or `NULL`

### gtk_list_store_insert_after ()

    void        gtk_list_store_insert_after     (GtkListStore *list_store,
                                                 GtkTreeIter *iter,
                                                 GtkTreeIter *sibling);

Inserts a new row after `sibling`. If `sibling` is `NULL`, then the row will be prepended to the beginning of the list. `iter` will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call `gtk_list_store_set` or `gtk_list_store_set_value`.

`list_store` : | A GtkListStore
`iter` : | An unset GtkTreeIter to set to the new row
`sibling` : | A valid GtkTreeIter, or `NULL`

### gtk_list_store_prepend ()

    void        gtk_list_store_prepend          (GtkListStore *list_store,
                                                 GtkTreeIter *iter);

Prepend a new row to `list_store`. `iter` will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call `gtk_list_store_set` or `gtk_list_store_set_value`.

`list_store` : | A GtkListStore
`iter` : | An unset GtkTreeIter to set to the prepend row

### gtk_list_store_append ()

    void        gtk_list_store_append           (GtkListStore *list_store,
                                                 GtkTreeIter *iter);

Appends a new row to `list_store`. `iter` will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call `gtk_list_store_set` or `gtk_list_store_set_value`.

`list_store` : | A GtkListStore
`iter` : | An unset GtkTreeIter to set to the appended row

<<< Previous Page | Home | Up | Next Page >>>
GtkCellRendererToggle | Menus, Combo Box, Toolbar