<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkFilterListModel">
<refmeta>
<refentrytitle role="top_of_page" id="GtkFilterListModel.top_of_page">GtkFilterListModel</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkFilterListModel</refname>
<refpurpose>A list model that filters its items</refpurpose>
</refnamediv>

<refsect1 id="GtkFilterListModel.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GtkFilterListModelFilterFunc">*GtkFilterListModelFilterFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkFilterListModel"><returnvalue>GtkFilterListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-new">gtk_filter_list_model_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkFilterListModel"><returnvalue>GtkFilterListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-new-for-type">gtk_filter_list_model_new_for_type</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-set-model">gtk_filter_list_model_set_model</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GListModel"><returnvalue>GListModel</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-get-model">gtk_filter_list_model_get_model</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-set-filter-func">gtk_filter_list_model_set_filter_func</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-has-filter">gtk_filter_list_model_has_filter</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-filter-list-model-refilter">gtk_filter_list_model_refilter</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFilterListModel.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkFilterListModel--has-filter">has-filter</link></entry><entry role="property_flags">Read</entry></row>
<row><entry role="property_type"><link linkend="GType"><type>GType</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkFilterListModel--item-type">item-type</link></entry><entry role="property_flags">Read / Write / Construct&#160;Only</entry></row>
<row><entry role="property_type"><link linkend="GListModel"><type>GListModel</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkFilterListModel--model">model</link></entry><entry role="property_flags">Read / Write / Construct&#160;Only</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFilterListModel.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkFilterListModel-struct">GtkFilterListModel</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFilterListModel.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkFilterListModel
</screen>
</refsect1>
<refsect1 id="GtkFilterListModel.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkFilterListModel implements
 <link linkend="GListModel">GListModel</link>.</para>

</refsect1>

<refsect1 id="GtkFilterListModel.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkFilterListModel.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> is a list model that filters a given other
listmodel.
It hides some elements from the other model according to
criteria given by a <link linkend="GtkFilterListModelFilterFunc"><type>GtkFilterListModelFilterFunc</type></link>.</para>

</refsect1>
<refsect1 id="GtkFilterListModel.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="GtkFilterListModelFilterFunc" role="function">
<title>GtkFilterListModelFilterFunc&#160;()</title>
<indexterm zone="GtkFilterListModelFilterFunc"><primary>GtkFilterListModelFilterFunc</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GtkFilterListModelFilterFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="gpointer"><type>gpointer</type></link> item</parameter>,
                                 <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>User function that is called to determine if the <parameter>item</parameter>
 of the original model should be visible.
If it should be visible, this function must return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. If the model should filter out the
<parameter>item</parameter>
, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> must be returned.</para>
<refsect3 id="GtkFilterListModelFilterFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>item</para></entry>
<entry role="parameter_description"><para>The item that may be filtered. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GObject]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkFilterListModelFilterFunc.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to keep the item around</para>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-new" role="function">
<title>gtk_filter_list_model_new&#160;()</title>
<indexterm zone="gtk-filter-list-model-new"><primary>gtk_filter_list_model_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkFilterListModel"><returnvalue>GtkFilterListModel</returnvalue></link>&#160;*
gtk_filter_list_model_new (<parameter><link linkend="GListModel"><type>GListModel</type></link> *model</parameter>,
                           <parameter><link linkend="GtkFilterListModelFilterFunc"><type>GtkFilterListModelFilterFunc</type></link> filter_func</parameter>,
                           <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                           <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> user_destroy</parameter>);</programlisting>
<para>Creates a new <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> that will filter <parameter>model</parameter>
 using the given
<parameter>filter_func</parameter>
.</para>
<refsect3 id="gtk-filter-list-model-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>model</para></entry>
<entry role="parameter_description"><para>the model to sort</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>filter_func</para></entry>
<entry role="parameter_description"><para>filter function or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to not filter items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data passed to <parameter>filter_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notifier for <parameter>user_data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-filter-list-model-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-new-for-type" role="function">
<title>gtk_filter_list_model_new_for_type&#160;()</title>
<indexterm zone="gtk-filter-list-model-new-for-type"><primary>gtk_filter_list_model_new_for_type</primary></indexterm>
<programlisting language="C"><link linkend="GtkFilterListModel"><returnvalue>GtkFilterListModel</returnvalue></link>&#160;*
gtk_filter_list_model_new_for_type (<parameter><link linkend="GType"><type>GType</type></link> item_type</parameter>);</programlisting>
<para>Creates a new empty filter list model set up to return items of type <parameter>item_type</parameter>
.
It is up to the application to set a proper filter function and model to ensure
the item type is matched.</para>
<refsect3 id="gtk-filter-list-model-new-for-type.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>item_type</para></entry>
<entry role="parameter_description"><para>the type of the items that will be returned</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-filter-list-model-new-for-type.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-set-model" role="function">
<title>gtk_filter_list_model_set_model&#160;()</title>
<indexterm zone="gtk-filter-list-model-set-model"><primary>gtk_filter_list_model_set_model</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_filter_list_model_set_model (<parameter><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> *self</parameter>,
                                 <parameter><link linkend="GListModel"><type>GListModel</type></link> *model</parameter>);</programlisting>
<para>Sets the model to be filtered.</para>
<para>Note that GTK makes no effort to ensure that <parameter>model</parameter>
 conforms to
the item type of <parameter>self</parameter>
. It assumes that the caller knows what they
are doing and have set up an appropriate filter function to ensure
that item types match.</para>
<refsect3 id="gtk-filter-list-model-set-model.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>model</para></entry>
<entry role="parameter_description"><para>The model to be filtered. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-get-model" role="function">
<title>gtk_filter_list_model_get_model&#160;()</title>
<indexterm zone="gtk-filter-list-model-get-model"><primary>gtk_filter_list_model_get_model</primary></indexterm>
<programlisting language="C"><link linkend="GListModel"><returnvalue>GListModel</returnvalue></link>&#160;*
gtk_filter_list_model_get_model (<parameter><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> *self</parameter>);</programlisting>
<para>Gets the model currently filtered or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if none.</para>
<refsect3 id="gtk-filter-list-model-get-model.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-filter-list-model-get-model.returns" role="returns">
<title>Returns</title>
<para>The model that gets filtered. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-set-filter-func" role="function">
<title>gtk_filter_list_model_set_filter_func&#160;()</title>
<indexterm zone="gtk-filter-list-model-set-filter-func"><primary>gtk_filter_list_model_set_filter_func</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_filter_list_model_set_filter_func (<parameter><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> *self</parameter>,
                                       <parameter><link linkend="GtkFilterListModelFilterFunc"><type>GtkFilterListModelFilterFunc</type></link> filter_func</parameter>,
                                       <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                                       <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> user_destroy</parameter>);</programlisting>
<para>Sets the function used to filter items. The function will be called for every
item and if it returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> the item is considered visible.</para>
<refsect3 id="gtk-filter-list-model-set-filter-func.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>filter_func</para></entry>
<entry role="parameter_description"><para>filter function or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to not filter items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data passed to <parameter>filter_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notifier for <parameter>user_data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-has-filter" role="function">
<title>gtk_filter_list_model_has_filter&#160;()</title>
<indexterm zone="gtk-filter-list-model-has-filter"><primary>gtk_filter_list_model_has_filter</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_filter_list_model_has_filter (<parameter><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> *self</parameter>);</programlisting>
<para>Checks if a filter function is currently set on <parameter>self</parameter>
</para>
<refsect3 id="gtk-filter-list-model-has-filter.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-filter-list-model-has-filter.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if a filter function is set</para>
</refsect3></refsect2>
<refsect2 id="gtk-filter-list-model-refilter" role="function">
<title>gtk_filter_list_model_refilter&#160;()</title>
<indexterm zone="gtk-filter-list-model-refilter"><primary>gtk_filter_list_model_refilter</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_filter_list_model_refilter (<parameter><link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link> *self</parameter>);</programlisting>
<para>Causes <parameter>self</parameter>
 to refilter all items in the model.</para>
<para>Calling this function is necessary when data used by the filter
function has changed.</para>
<refsect3 id="gtk-filter-list-model-refilter.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFilterListModel"><type>GtkFilterListModel</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkFilterListModel.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkFilterListModel-struct" role="struct">
<title>GtkFilterListModel</title>
<indexterm zone="GtkFilterListModel-struct"><primary>GtkFilterListModel</primary></indexterm>
<programlisting language="C">typedef struct _GtkFilterListModel GtkFilterListModel;</programlisting>
</refsect2>

</refsect1>
<refsect1 id="GtkFilterListModel.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkFilterListModel--has-filter" role="property"><title>The <literal>“has-filter”</literal> property</title>
<indexterm zone="GtkFilterListModel--has-filter"><primary>GtkFilterListModel:has-filter</primary></indexterm>
<programlisting>  “has-filter”               <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>If a filter is set for this model</para>
<para>Owner: GtkFilterListModel</para>
<para>Flags: Read</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkFilterListModel--item-type" role="property"><title>The <literal>“item-type”</literal> property</title>
<indexterm zone="GtkFilterListModel--item-type"><primary>GtkFilterListModel:item-type</primary></indexterm>
<programlisting>  “item-type”                <link linkend="GType"><type>GType</type></link>&#160;*</programlisting>
<para>The <link linkend="GType"><type>GType</type></link> for elements of this object</para>
<para>Owner: GtkFilterListModel</para>
<para>Flags: Read / Write / Construct&#160;Only</para>
<para>Allowed values: GObject</para>
</refsect2>
<refsect2 id="GtkFilterListModel--model" role="property"><title>The <literal>“model”</literal> property</title>
<indexterm zone="GtkFilterListModel--model"><primary>GtkFilterListModel:model</primary></indexterm>
<programlisting>  “model”                    <link linkend="GListModel"><type>GListModel</type></link>&#160;*</programlisting>
<para>The model being filtered</para>
<para>Owner: GtkFilterListModel</para>
<para>Flags: Read / Write / Construct&#160;Only</para>
</refsect2>

</refsect1>
<refsect1 id="GtkFilterListModel.see-also">
<title>See Also</title>
<para><link linkend="GListModel"><type>GListModel</type></link></para>

</refsect1>

</refentry>
