📄 gtktreemodelfilter.html
字号:
<a class="indexterm" name="id3810043"></a><pre class="programlisting">void (*GtkTreeModelFilterModifyFunc) (<a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a> *model, <a class="link" href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> *iter, <ahref="/usr/share/gtk-doc/html/gobject/gobject-Generic-values.html#GValue">GValue</a> *value, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> column, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>A function which calculates display values from raw values in the model.It must fill <em class="parameter"><code>value</code></em> with the display value for the column <em class="parameter"><code>column</code></em> in the row indicated by <em class="parameter"><code>iter</code></em>. </p><p>Since this function is called for each data access, it's not aparticularly efficient operation.</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="GtkTreeModelFilter.html" title="GtkTreeModelFilter"><span class="type">GtkTreeModelFilter</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>iter</code></em> :</span></p></td><td>a <a class="link" href="GtkTreeModel.html#GtkTreeIter"><span class="type">GtkTreeIter</span></a> pointing to the row whose display values are determined</td></tr><tr><td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td><td>A <ahref="/usr/share/gtk-doc/html/gobject/gobject-Generic-values.html#GValue"><span class="type">GValue</span></a> which is already initialized for with the correct type for the column <em class="parameter"><code>column</code></em>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>column</code></em> :</span></p></td><td>the column whose display value is determined</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>user data given to <a class="link" href="GtkTreeModelFilter.html#gtk-tree-model-filter-set-modify-func"><code class="function">gtk_tree_model_filter_set_modify_func()</code></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3810245"></a><h3><a name="gtk-tree-model-filter-new"></a>gtk_tree_model_filter_new ()</h3><a class="indexterm" name="id3810262"></a><pre class="programlisting"><a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a>* gtk_tree_model_filter_new (<a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a> *child_model, <a class="link" href="GtkTreeModel.html#GtkTreePath">GtkTreePath</a> *root);</pre><p>Creates a new <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>, with <em class="parameter"><code>child_model</code></em> as the child_modeland <em class="parameter"><code>root</code></em> as the virtual root.</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>child_model</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>root</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> A new <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3810405"></a><h3><a name="gtk-tree-model-filter-set-visible-func"></a>gtk_tree_model_filter_set_visible_func ()</h3><a class="indexterm" name="id3810422"></a><pre class="programlisting">void gtk_tree_model_filter_set_visible_func (<a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter">GtkTreeModelFilter</a> *filter, <a class="link" href="GtkTreeModelFilter.html#GtkTreeModelFilterVisibleFunc">GtkTreeModelFilterVisibleFunc</a> func, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre><p>Sets the visible function used when filtering the <em class="parameter"><code>filter</code></em> to be <em class="parameter"><code>func</code></em>. Thefunction should return <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the given row should be visible and<ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p><p>If the condition calculated by the function changes over time (e.g. becauseit depends on some global parameters), you must call <a class="link" href="GtkTreeModelFilter.html#gtk-tree-model-filter-refilter"><code class="function">gtk_tree_model_filter_refilter()</code></a> to keep the visibility information of the model uptodate.</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>filter</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter"><span class="type">GtkTreeModelFilter</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModelFilter.html#GtkTreeModelFilterVisibleFunc"><span class="type">GtkTreeModelFilterVisibleFunc</span></a>, the visible function.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> User data to pass to the visible function, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td><td> Destroy notifier of <em class="parameter"><code>data</code></em>, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3810642"></a><h3><a name="gtk-tree-model-filter-set-modify-func"></a>gtk_tree_model_filter_set_modify_func ()</h3><a class="indexterm" name="id3810659"></a><pre class="programlisting">void gtk_tree_model_filter_set_modify_func (<a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter">GtkTreeModelFilter</a> *filter, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> n_columns, <ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> *types, <a class="link" href="GtkTreeModelFilter.html#GtkTreeModelFilterModifyFunc">GtkTreeModelFilterModifyFunc</a> func, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="gtk-Types.html#GtkDestroyNotify">GtkDestroyNotify</a> destroy);</pre><p>With the <em class="parameter"><code>n_columns</code></em> and <em class="parameter"><code>types</code></em> parameters, you give an array of columntypes for this model (which will be exposed to the parent model/view).The <em class="parameter"><code>func</code></em>, <em class="parameter"><code>data</code></em> and <em class="parameter"><code>destroy</code></em> parameters are for specifying the modifyfunction. The modify function will get called for <span class="emphasis"><em>each</em></span>data access, the goal of the modify function is to return the data which should be displayed at the location specified using the parameters of the modify function.</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>filter</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter"><span class="type">GtkTreeModelFilter</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>n_columns</code></em> :</span></p></td><td> The number of columns in the filter model.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>types</code></em> :</span></p></td><td> The <ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a>s of the columns.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModelFilter.html#GtkTreeModelFilterModifyFunc"><span class="type">GtkTreeModelFilterModifyFunc</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td> User data to pass to the modify function, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td><td> Destroy notifier of <em class="parameter"><code>data</code></em>, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3810920"></a><h3><a name="gtk-tree-model-filter-set-visible-column"></a>gtk_tree_model_filter_set_visible_column ()</h3><a class="indexterm" name="id3810936"></a><pre class="programlisting">void gtk_tree_model_filter_set_visible_column (<a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter">GtkTreeModelFilter</a> *filter, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> column);</pre><p>Sets <em class="parameter"><code>column</code></em> of the child_model to be the column where <em class="parameter"><code>filter</code></em> shouldlook for visibility information. <em class="parameter"><code>columns</code></em> should be a column of type<ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#G-TYPE-BOOLEAN:CAPS"><code class="literal">G_TYPE_BOOLEAN</code></a>, where <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> means that a row is visible, and <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>if not.</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>filter</code></em> :</span></p></td><td> A <a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter"><span class="type">GtkTreeModelFilter</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>column</code></em> :</span></p></td><td> A <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> which is the column containing the visible information.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3811085"></a><h3><a name="gtk-tree-model-filter-get-model"></a>gtk_tree_model_filter_get_model ()</h3><a class="indexterm" name="id3811101"></a><pre class="programlisting"><a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a>* gtk_tree_model_filter_get_model (<a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter">GtkTreeModelFilter</a> *filter);</pre><p>Returns a pointer to the child model of <em class="parameter"><code>filter</code></em>.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -