<?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="GtkCustomFilter">
<refmeta>
<refentrytitle role="top_of_page" id="GtkCustomFilter.top_of_page">GtkCustomFilter</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkCustomFilter</refname>
<refpurpose>Filtering with callbacks</refpurpose>
</refnamediv>

<refsect1 id="GtkCustomFilter.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="GtkCustomFilterFunc">*GtkCustomFilterFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkCustomFilter"><returnvalue>GtkCustomFilter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-custom-filter-new">gtk_custom_filter_new</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-custom-filter-set-filter-func">gtk_custom_filter_set_filter_func</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCustomFilter.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="GtkCustomFilter-struct">GtkCustomFilter</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCustomFilter.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> <link linkend="GtkFilter">GtkFilter</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkCustomFilter
</screen>
</refsect1>

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

<refsect1 id="GtkCustomFilter.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkCustomFilter"><type>GtkCustomFilter</type></link> is a <link linkend="GtkFilter"><type>GtkFilter</type></link> that uses a callback to determine
whether to include an item or not.</para>

</refsect1>
<refsect1 id="GtkCustomFilter.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="GtkCustomFilterFunc" role="function">
<title>GtkCustomFilterFunc&#160;()</title>
<indexterm zone="GtkCustomFilterFunc"><primary>GtkCustomFilterFunc</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GtkCustomFilterFunc<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>
 should be matched.
If the filter matches the item, this function must return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. If the
item should be filtered out, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> must be returned.</para>
<refsect3 id="GtkCustomFilterFunc.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 to be matched. </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="GtkCustomFilterFunc.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-custom-filter-new" role="function">
<title>gtk_custom_filter_new&#160;()</title>
<indexterm zone="gtk-custom-filter-new"><primary>gtk_custom_filter_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkCustomFilter"><returnvalue>GtkCustomFilter</returnvalue></link>&#160;*
gtk_custom_filter_new (<parameter><link linkend="GtkCustomFilterFunc"><type>GtkCustomFilterFunc</type></link> match_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 filter using the given <parameter>match_func</parameter>
 to filter
items.</para>
<para>If <parameter>match_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, the filter matches all items.</para>
<para>If the filter func changes its filtering behavior,
<link linkend="gtk-filter-changed"><function>gtk_filter_changed()</function></link> needs to be called.</para>
<refsect3 id="gtk-custom-filter-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>match_func</para></entry>
<entry role="parameter_description"><para>function to filter items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>match_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for <parameter>user_data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-custom-filter-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkCustomFilter"><type>GtkCustomFilter</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-custom-filter-set-filter-func" role="function">
<title>gtk_custom_filter_set_filter_func&#160;()</title>
<indexterm zone="gtk-custom-filter-set-filter-func"><primary>gtk_custom_filter_set_filter_func</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_custom_filter_set_filter_func (<parameter><link linkend="GtkCustomFilter"><type>GtkCustomFilter</type></link> *self</parameter>,
                                   <parameter><link linkend="GtkCustomFilterFunc"><type>GtkCustomFilterFunc</type></link> match_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 (or unsets) the function used for filtering items.</para>
<para>If <parameter>match_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, the filter matches all items.</para>
<para>If the filter func changes its filtering behavior,
<link linkend="gtk-filter-changed"><function>gtk_filter_changed()</function></link> needs to be called.</para>
<para>If a previous function was set, its <parameter>user_destroy</parameter>
 will be
called now.</para>
<refsect3 id="gtk-custom-filter-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="GtkCustomFilter"><type>GtkCustomFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>match_func</para></entry>
<entry role="parameter_description"><para>function to filter items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>match_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for <parameter>user_data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

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

</refsect1>

</refentry>
