📄 gtktreesortable.html
字号:
<div class="refsect2" lang="en"><a name="id3801998"></a><h3><a name="GtkTreeSortableIface"></a>GtkTreeSortableIface</h3><a class="indexterm" name="id3802011"></a><pre class="programlisting">typedef struct { 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);} GtkTreeSortableIface;</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id3802043"></a><h3><a name="GtkTreeIterCompareFunc"></a>GtkTreeIterCompareFunc ()</h3><a class="indexterm" name="id3802055"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> (*GtkTreeIterCompareFunc) (<a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a> *model, <a class="link" href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> *a, <a class="link" href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> *b, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>A GtkTreeIterCompareFunc should return a negative integer, zero, or a positiveinteger if <em class="parameter"><code>a</code></em> sorts before <em class="parameter"><code>b</code></em>, <em class="parameter"><code>a</code></em> sorts with <em class="parameter"><code>b</code></em>, or <em class="parameter"><code>a</code></em> sorts after <em class="parameter"><code>b</code></em>respectively. If two iters compare as equal, their order in the sorted model is undefined. In order to ensure that the <a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable"><span class="type">GtkTreeSortable</span></a> behaves as expected, the GtkTreeIterCompareFunc must define a partial order on the model, i.e. it must be reflexive, antisymmetric and transitive.</p><p>For example, if <em class="parameter"><code>model</code></em> is a product catalogue, then a compare functionfor the "price" column could be one which returns <code class="literal">price_of(<em class="parameter"><code>a</code></em>) - price_of(<em class="parameter"><code>b</code></em>)</code>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>model</code></em> :</span></p></td><td>The <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a> the comparison is within</td></tr><tr><td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td><td>A <a class="link" href="GtkTreeModel.html#GtkTreeIter"><span class="type">GtkTreeIter</span></a> in <em class="parameter"><code>model</code></em></td></tr><tr><td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td><td>Another <a class="link" href="GtkTreeModel.html#GtkTreeIter"><span class="type">GtkTreeIter</span></a> in <em class="parameter"><code>model</code></em></td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td><td>Data passed when the compare func is assigned e.g. by<a class="link" href="GtkTreeSortable.html#gtk-tree-sortable-set-sort-func"><code class="function">gtk_tree_sortable_set_sort_func()</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3802302"></a><h3><a name="gtk-tree-sortable-sort-column-changed"></a>gtk_tree_sortable_sort_column_changed ()</h3><a class="indexterm" name="id3802315"></a><pre class="programlisting">void gtk_tree_sortable_sort_column_changed (<a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable">GtkTreeSortable</a> *sortable);</pre><p>Emits a GtkTreeSortable::sort_column_changed signal on</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>sortable</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable"><span class="type">GtkTreeSortable</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3802376"></a><h3><a name="gtk-tree-sortable-get-sort-column-id"></a>gtk_tree_sortable_get_sort_column_id ()</h3><a class="indexterm" name="id3802390"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> gtk_tree_sortable_get_sort_column_id (<a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable">GtkTreeSortable</a> *sortable, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> *sort_column_id, <a class="link" href="gtk-Standard-Enumerations.html#GtkSortType">GtkSortType</a> *order);</pre><p>Fills in <em class="parameter"><code>sort_column_id</code></em> and <em class="parameter"><code>order</code></em> with the current sort column and theorder. It returns <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> unless the <em class="parameter"><code>sort_column_id</code></em> is <code class="literal">GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</code> or <code class="literal">GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</code>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>sortable</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable"><span class="type">GtkTreeSortable</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>sort_column_id</code></em> :</span></p></td><td> The sort column id to be filled in</td></tr><tr><td><p><span class="term"><em class="parameter"><code>order</code></em> :</span></p></td><td> The <a class="link" href="gtk-Standard-Enumerations.html#GtkSortType"><span class="type">GtkSortType</span></a> to be filled in</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the sort column is not one of the special sort column ids.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3802579"></a><h3><a name="gtk-tree-sortable-set-sort-column-id"></a>gtk_tree_sortable_set_sort_column_id ()</h3><a class="indexterm" name="id3802592"></a><pre class="programlisting">void gtk_tree_sortable_set_sort_column_id (<a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable">GtkTreeSortable</a> *sortable, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> sort_column_id, <a class="link" href="gtk-Standard-Enumerations.html#GtkSortType">GtkSortType</a> order);</pre><p>Sets the current sort column to be <em class="parameter"><code>sort_column_id</code></em>. The <em class="parameter"><code>sortable</code></em> willresort itself to reflect this change, after emitting aGtkTreeSortable::sort_column_changed signal. If <em class="parameter"><code>sort_column_id</code></em> is<code class="literal">GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</code>, then the default sort functionwill be used, if it is set.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>sortable</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeSortable.html" title="GtkTreeSortable"><span class="type">GtkTreeSortable</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>sort_column_id</code></em> :</span></p></td><td> the sort column id to set</td></tr><tr><td><p><span class="term"><em class="parameter"><code>order</code></em> :</span></p></td><td> The sort order of the column</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -