<refentry id="gtk-GtkTreeSortable">
<refmeta>
<refentrytitle>GtkTreeSortable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkTreeSortable</refname><refpurpose></refpurpose>
</refnamediv>

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

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


struct      <link linkend="GtkTreeSortable">GtkTreeSortable</link>;
struct      <link linkend="GtkTreeSortableIface">GtkTreeSortableIface</link>;
<link linkend="gint">gint</link>        (<link linkend="GtkTreeIterCompareFunc">*GtkTreeIterCompareFunc</link>)       (<link linkend="GtkTreeModel">GtkTreeModel</link> *model,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *a,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *b,
                                             <link linkend="gpointer">gpointer</link> user_data);
void        <link linkend="gtk-tree-sortable-sort-column-changed">gtk_tree_sortable_sort_column_changed</link>
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable);
<link linkend="gboolean">gboolean</link>    <link linkend="gtk-tree-sortable-get-sort-column-id">gtk_tree_sortable_get_sort_column_id</link>
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> *sort_column_id,
                                             <link linkend="GtkSortType">GtkSortType</link> *order);
void        <link linkend="gtk-tree-sortable-set-sort-column-id">gtk_tree_sortable_set_sort_column_id</link>
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> sort_column_id,
                                             <link linkend="GtkSortType">GtkSortType</link> order);
void        <link linkend="gtk-tree-sortable-set-sort-func">gtk_tree_sortable_set_sort_func</link> (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> sort_column_id,
                                             <link linkend="GtkTreeIterCompareFunc">GtkTreeIterCompareFunc</link> sort_func,
                                             <link linkend="gpointer">gpointer</link> user_data,
                                             <link linkend="GtkDestroyNotify">GtkDestroyNotify</link> destroy);
void        <link linkend="gtk-tree-sortable-set-default-sort-func">gtk_tree_sortable_set_default_sort_func</link>
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="GtkTreeIterCompareFunc">GtkTreeIterCompareFunc</link> sort_func,
                                             <link linkend="gpointer">gpointer</link> user_data,
                                             <link linkend="GtkDestroyNotify">GtkDestroyNotify</link> destroy);
<link linkend="gboolean">gboolean</link>    <link linkend="gtk-tree-sortable-has-default-sort-func">gtk_tree_sortable_has_default_sort_func</link>
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable);


</synopsis>
</refsynopsisdiv>





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

</para>
</refsect1>

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

</para></refsect2>
<refsect2>
<title><anchor id="GtkTreeSortableIface">struct GtkTreeSortableIface</title>
<programlisting>struct GtkTreeSortableIface
{
  GTypeInterface g_iface;

  /* signals */
  void     (* sort_column_changed)   (GtkTreeSortable        *sortable);

  /* virtual table */
  gboolean (* get_sort_column_id)    (GtkTreeSortable        *sortable,
				      gint                   *sort_column_id,
				      GtkSortType            *order);
  void     (* set_sort_column_id)    (GtkTreeSortable        *sortable,
				      gint                    sort_column_id,
				      GtkSortType             order);
  void     (* set_sort_func)         (GtkTreeSortable        *sortable,
				      gint                    sort_column_id,
				      GtkTreeIterCompareFunc  func,
				      gpointer                data,
				      GtkDestroyNotify        destroy);
  void     (* set_default_sort_func) (GtkTreeSortable        *sortable,
				      GtkTreeIterCompareFunc  func,
				      gpointer                data,
				      GtkDestroyNotify        destroy);
  gboolean (* has_default_sort_func) (GtkTreeSortable        *sortable);
};
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GtkTreeIterCompareFunc">GtkTreeIterCompareFunc ()</title>
<programlisting><link linkend="gint">gint</link>        (*GtkTreeIterCompareFunc)       (<link linkend="GtkTreeModel">GtkTreeModel</link> *model,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *a,
                                             <link linkend="GtkTreeIter">GtkTreeIter</link> *b,
                                             <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>model</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>a</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>b</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry>
<entry>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>


</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-sort-column-changed">gtk_tree_sortable_sort_column_changed ()</title>
<programlisting>void        gtk_tree_sortable_sort_column_changed
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable);</programlisting>
<para>
Emits a GtkTreeSortable::sort_column_changed signal on</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-get-sort-column-id">gtk_tree_sortable_get_sort_column_id ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gtk_tree_sortable_get_sort_column_id
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> *sort_column_id,
                                             <link linkend="GtkSortType">GtkSortType</link> *order);</programlisting>
<para>
Fills in <parameter>sort_column_id</parameter> and <parameter>order</parameter> with the current sort column and the
order, if applicable.  If the sort column is not set, then FALSE is returned,
and the values in <parameter>sort_column_id</parameter> and <parameter>order</parameter> are unchanged.</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
<row><entry align="right"><parameter>sort_column_id</parameter>&nbsp;:</entry>
<entry> The sort column id to be filled in
</entry></row>
<row><entry align="right"><parameter>order</parameter>&nbsp;:</entry>
<entry> The <link linkend="GtkSortType">GtkSortType</link> to be filled in
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal>, if the sort column has been set
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-set-sort-column-id">gtk_tree_sortable_set_sort_column_id ()</title>
<programlisting>void        gtk_tree_sortable_set_sort_column_id
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> sort_column_id,
                                             <link linkend="GtkSortType">GtkSortType</link> order);</programlisting>
<para>
Sets the current sort column to be <parameter>sort_column_id</parameter>.  The <parameter>sortable</parameter> will
resort itself to reflect this change, after emitting a
GtkTreeSortable::sort_column_changed signal.  If <parameter>sort_column_id</parameter> is
<literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal>, then the default sort function
will be used, if it is set.</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
<row><entry align="right"><parameter>sort_column_id</parameter>&nbsp;:</entry>
<entry> the sort column id to set
</entry></row>
<row><entry align="right"><parameter>order</parameter>&nbsp;:</entry>
<entry> The sort order of the column
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-set-sort-func">gtk_tree_sortable_set_sort_func ()</title>
<programlisting>void        gtk_tree_sortable_set_sort_func (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="gint">gint</link> sort_column_id,
                                             <link linkend="GtkTreeIterCompareFunc">GtkTreeIterCompareFunc</link> sort_func,
                                             <link linkend="gpointer">gpointer</link> user_data,
                                             <link linkend="GtkDestroyNotify">GtkDestroyNotify</link> destroy);</programlisting>
<para>
Sets the comparison function used when sorting to be <parameter>sort_func</parameter>.  If the
current sort column id of <parameter>sortable</parameter> is the same as <parameter>sort_column_id</parameter>, then the
model will sort.</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
<row><entry align="right"><parameter>sort_column_id</parameter>&nbsp;:</entry>
<entry> the sort column id to set the function for
</entry></row>
<row><entry align="right"><parameter>sort_func</parameter>&nbsp;:</entry>
<entry> The sorting function
</entry></row>
<row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry>
<entry> User data to pass to the sort func, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>destroy</parameter>&nbsp;:</entry>
<entry> Destroy notifier of <parameter>user_data</parameter>, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-set-default-sort-func">gtk_tree_sortable_set_default_sort_func ()</title>
<programlisting>void        gtk_tree_sortable_set_default_sort_func
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable,
                                             <link linkend="GtkTreeIterCompareFunc">GtkTreeIterCompareFunc</link> sort_func,
                                             <link linkend="gpointer">gpointer</link> user_data,
                                             <link linkend="GtkDestroyNotify">GtkDestroyNotify</link> destroy);</programlisting>
<para>
Sets the default comparison function used when sorting to be <parameter>sort_func</parameter>.  If
the current sort column id of <parameter>sortable</parameter> is
<literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal>, then the model will sort.  If
<parameter>sort_func</parameter> is <literal>NULL</literal>, then the default sort_func, and there will be no default
sort_func.  In this case, the model is unsorted.</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
<row><entry align="right"><parameter>sort_func</parameter>&nbsp;:</entry>
<entry> The sorting function
</entry></row>
<row><entry align="right"><parameter>user_data</parameter>&nbsp;:</entry>
<entry> User data to pass to the sort func, or <literal>NULL</literal>
</entry></row>
<row><entry align="right"><parameter>destroy</parameter>&nbsp;:</entry>
<entry> Destroy notifier of <parameter>user_data</parameter>, or <literal>NULL</literal>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-tree-sortable-has-default-sort-func">gtk_tree_sortable_has_default_sort_func ()</title>
<programlisting><link linkend="gboolean">gboolean</link>    gtk_tree_sortable_has_default_sort_func
                                            (<link linkend="GtkTreeSortable">GtkTreeSortable</link> *sortable);</programlisting>
<para>
Returns <literal>TRUE</literal> if the model has a default sort function.  This is used
primarily by GtkTreeViewColumns in order to determine if a model can go back
to the default state, or not.</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>sortable</parameter>&nbsp;:</entry>
<entry> A <link linkend="GtkTreeSortable">GtkTreeSortable</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> <literal>TRUE</literal>, if the model has a default sort function
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
