<refentry id="GtkTreeModelSort">
<refmeta>
<refentrytitle>GtkTreeModelSort</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkTreeModelSort</refname><refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

#include &lt;gtk/gtk.h&gt;


struct      <link linkend="GtkTreeModelSort-struct">GtkTreeModelSort</link>;
<link linkend="GtkTreeModel">GtkTreeModel</link>* <link linkend="gtk-tree-model-sort-new-with-model">gtk_tree_model_sort_new_with_model</link>
                                            (<link linkend="GtkTreeModel">GtkTreeModel</link> *child_model);
<link linkend="GtkTreeModel">GtkTreeModel</link>* <link linkend="gtk-tree-model-sort-get-model">gtk_tree_model_sort_get_model</link> (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model);
<link linkend="GtkTreePath">GtkTreePath</link>* <link linkend="gtk-tree-model-sort-convert-child-path-to-path">gtk_tree_model_sort_convert_child_path_to_path</link>
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreePath">GtkTreePath</link> *child_path);
void        <link linkend="gtk-tree-model-sort-convert-child-iter-to-iter">gtk_tree_model_sort_convert_child_iter_to_iter</link>
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *sort_iter,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *child_iter);
<link linkend="GtkTreePath">GtkTreePath</link>* <link linkend="gtk-tree-model-sort-convert-path-to-child-path">gtk_tree_model_sort_convert_path_to_child_path</link>
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreePath">GtkTreePath</link> *sorted_path);
void        <link linkend="gtk-tree-model-sort-convert-iter-to-child-iter">gtk_tree_model_sort_convert_iter_to_child_iter</link>
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *child_iter,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *sorted_iter);
void        <link linkend="gtk-tree-model-sort-reset-default-sort-func">gtk_tree_model_sort_reset_default_sort_func</link>
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort);
void        <link linkend="gtk-tree-model-sort-clear-cache">gtk_tree_model_sort_clear_cache</link> (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort);


</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----GtkTreeModelSort
</synopsis>

</refsect1>

<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GtkTreeModelSort--model">model</link>&quot;                <link linkend="GtkTreeModel">GtkTreeModel</link>         : Read / Write / Construct Only
</synopsis>
</refsect1>



<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GtkTreeModelSort-struct">struct GtkTreeModelSort</title>
<programlisting>struct GtkTreeModelSort;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-new-with-model">gtk_tree_model_sort_new_with_model ()</title>
<programlisting><link linkend="GtkTreeModel">GtkTreeModel</link>* gtk_tree_model_sort_new_with_model
                                            (<link linkend="GtkTreeModel">GtkTreeModel</link> *child_model);</programlisting>
<para>
Creates a new <link linkend="GtkTreeModel">GtkTreeModel</link>, with <parameter>child_model</parameter> as the child_model.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>child_model</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModel">GtkTreeModel</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A new <link linkend="GtkTreeModel">GtkTreeModel</link>.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-get-model">gtk_tree_model_sort_get_model ()</title>
<programlisting><link linkend="GtkTreeModel">GtkTreeModel</link>* gtk_tree_model_sort_get_model (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model);</programlisting>
<para>
Returns the model the <link linkend="GtkTreeModelSort">GtkTreeModelSort</link> is sorting.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the "child model" being sorted
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-convert-child-path-to-path">gtk_tree_model_sort_convert_child_path_to_path ()</title>
<programlisting><link linkend="GtkTreePath">GtkTreePath</link>* gtk_tree_model_sort_convert_child_path_to_path
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreePath">GtkTreePath</link> *child_path);</programlisting>
<para>
Converts <parameter>child_path</parameter> to a path relative to <parameter>tree_model_sort</parameter>.  That is,
<parameter>child_path</parameter> points to a path in the child model.  The returned path will
point to the same row in the sorted model.  If <parameter>child_path</parameter> isn't a valid path
on the child model, then <literal>NULL</literal> is returned.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
<row><entry align="right"><parameter>child_path</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreePath">GtkTreePath</link> to convert
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A newly allocated <link linkend="GtkTreePath">GtkTreePath</link>, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-convert-child-iter-to-iter">gtk_tree_model_sort_convert_child_iter_to_iter ()</title>
<programlisting>void        gtk_tree_model_sort_convert_child_iter_to_iter
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *sort_iter,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *child_iter);</programlisting>
<para>
Sets <parameter>sort_iter</parameter> to point to the row in <parameter>tree_model_sort</parameter> that corresponds to
the row pointed at by <parameter>child_iter</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
<row><entry align="right"><parameter>sort_iter</parameter>&nbsp;:</entry>
<entry> An uninitialized <link linkend="GtkTreeIter">GtkTreeIter</link>.
</entry></row>
<row><entry align="right"><parameter>child_iter</parameter>&nbsp;:</entry>
<entry> A valid <link linkend="GtkTreeIter">GtkTreeIter</link> pointing to a row on the child model
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-convert-path-to-child-path">gtk_tree_model_sort_convert_path_to_child_path ()</title>
<programlisting><link linkend="GtkTreePath">GtkTreePath</link>* gtk_tree_model_sort_convert_path_to_child_path
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreePath">GtkTreePath</link> *sorted_path);</programlisting>
<para>
Converts <parameter>sorted_path</parameter> to a path on the child model of <parameter>tree_model_sort</parameter>.  That
is, <parameter>sorted_path</parameter> points to a location in <parameter>tree_model_sort</parameter>.  The returned path
will point to the same location in the model not being sorted.  If <parameter>sorted_path</parameter> 
does not point to a location in the child model, <literal>NULL</literal> is returned.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
<row><entry align="right"><parameter>sorted_path</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreePath">GtkTreePath</link> to convert
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A newly allocated <link linkend="GtkTreePath">GtkTreePath</link>, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-convert-iter-to-child-iter">gtk_tree_model_sort_convert_iter_to_child_iter ()</title>
<programlisting>void        gtk_tree_model_sort_convert_iter_to_child_iter
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *child_iter,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *sorted_iter);</programlisting>
<para>
Sets <parameter>child_iter</parameter> to point to the row pointed to by <parameter>sorted_iter</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
<row><entry align="right"><parameter>child_iter</parameter>&nbsp;:</entry>
<entry> An uninitialized <link linkend="GtkTreeIter">GtkTreeIter</link>
</entry></row>
<row><entry align="right"><parameter>sorted_iter</parameter>&nbsp;:</entry>
<entry> A valid <link linkend="GtkTreeIter">GtkTreeIter</link> pointing to a row on <parameter>tree_model_sort</parameter>.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-reset-default-sort-func">gtk_tree_model_sort_reset_default_sort_func ()</title>
<programlisting>void        gtk_tree_model_sort_reset_default_sort_func
                                            (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort);</programlisting>
<para>
This resets the default sort function to be in the 'unsorted' state.  That
is, it is in the same order as the child model. It will re-sort the model
to be in the same order as the child model only if the <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
is in 'unsorted' state.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-model-sort-clear-cache">gtk_tree_model_sort_clear_cache ()</title>
<programlisting>void        gtk_tree_model_sort_clear_cache (<link linkend="GtkTreeModelSort">GtkTreeModelSort</link> *tree_model_sort);</programlisting>
<para>
This function should almost never be called.  It clears the <parameter>tree_model_sort</parameter>
of any cached iterators that haven't been reffed with
<link linkend="gtk-tree-model-ref-node">gtk_tree_model_ref_node</link>().  This might be useful if the child model being
sorted is static (and doesn't change often) and there has been a lot of
unreffed access to nodes.  As a side effect of this function, all unreffed
iters will be invalid.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>tree_model_sort</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeModelSort">GtkTreeModelSort</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GtkTreeModelSort--model">&quot;<literal>model</literal>&quot; (<link linkend="GtkTreeModel">GtkTreeModel</link> : Read / Write / Construct Only)</term>
<listitem>
<para>

</para></listitem></varlistentry>

</variablelist>
</refsect1>




</refentry>
