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

# GtkTreeModelSort

## Name

GtkTreeModelSort --

## Synopsis

    #include <gtk/gtk.h>

    struct      GtkTreeModelSort;
    GtkTreeModel* gtk_tree_model_sort_new       (void);
    GtkTreeModel* gtk_tree_model_sort_new_with_model
                                                (GtkTreeModel *child_model);
    void        gtk_tree_model_sort_set_model   (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreeModel *child_model);
    GtkTreePath* gtk_tree_model_sort_convert_path
                                                (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreePath *child_path);
    void        gtk_tree_model_sort_convert_iter
                                                (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreeIter *sort_iter,
                                                 GtkTreeIter *child_iter);

## Description

## Details

### struct GtkTreeModelSort

    struct GtkTreeModelSort
    {
      GObject parent;

      /* < private > */
      gpointer root;
      gint stamp;
      guint flags;
      GtkTreeModel *child_model;
      gboolean cache_child_iters;

      /* sort information */
      GList *sort_list;
      gint sort_column_id;
      GtkSortType order;

      /* signal ids */
      guint changed_id;
      guint inserted_id;
      guint has_child_toggled_id;
      guint deleted_id;
      guint reordered_id;
    };

### gtk_tree_model_sort_new ()

    GtkTreeModel* gtk_tree_model_sort_new       (void);

Creates a new GtkTreeModel without child_model.

Returns : | A new GtkTreeModel.

### gtk_tree_model_sort_new_with_model ()

    GtkTreeModel* gtk_tree_model_sort_new_with_model
                                                (GtkTreeModel *child_model);

Creates a new GtkTreeModel, with `child_model` as the child_model.

`child_model` : | A GtkTreeModel
Returns : | A new GtkTreeModel.

### gtk_tree_model_sort_set_model ()

    void        gtk_tree_model_sort_set_model   (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreeModel *child_model);

Sets the model of `tree_model_sort` to be `model`. If `model` is NULL, then the * old model is unset.

`tree_model_sort` : | The GtkTreeModelSort.
`child_model` : | A GtkTreeModel, or NULL.

### gtk_tree_model_sort_convert_path ()

    GtkTreePath* gtk_tree_model_sort_convert_path
                                                (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreePath *child_path);

Converts the `child_path` to a new path, relative to the sorted position. In other words, the value found in the `tree_model_sort` ->child_model at the `child_path`, is identical to that found in the `tree_model_sort` and the return value.

`tree_model_sort` : | The GtkTreeModelSort.
`child_path` : | A GtkTreePath, relative to the child model.
Returns : | A new path, or NULL if `child_path` does not exist in `tree_model_sort` ->child_model.

### gtk_tree_model_sort_convert_iter ()

    void        gtk_tree_model_sort_convert_iter
                                                (GtkTreeModelSort *tree_model_sort,
                                                 GtkTreeIter *sort_iter,
                                                 GtkTreeIter *child_iter);

Converts the `child_iter` to a new iter, relative to the sorted position. In other words, the value found in the `tree_model_sort` ->child_model at the `child_iter`, is identical to that found in `tree_model_sort` at the `sort_iter`. The `sort_iter` will be set.

`tree_model_sort` : | The GtkTreeModelSort
`sort_iter` : | A pointer to a GtkTreeIter
`child_iter` : | A GtkTreeIter, relative to the child model

<<< Previous Page | Home | Up | Next Page >>>
GtkTreeView drag-and-drop | GtkCellRenderer