<?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="GtkSearchEntry">
<refmeta>
<refentrytitle role="top_of_page" id="GtkSearchEntry.top_of_page">GtkSearchEntry</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkSearchEntry</refname>
<refpurpose>An entry which shows a search icon</refpurpose>
</refnamediv>

<refsect1 id="GtkSearchEntry.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="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-search-entry-new">gtk_search_entry_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-search-entry-set-key-capture-widget">gtk_search_entry_set_key_capture_widget</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-search-entry-get-key-capture-widget">gtk_search_entry_get_key_capture_widget</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSearchEntry.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="GtkSearchEntry--activates-default">activates-default</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkSearchEntry--placeholder-text">placeholder-text</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSearchEntry.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-activate">activate</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-ACTION:CAPS">Action</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-next-match">next-match</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-ACTION:CAPS">Action</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-previous-match">previous-match</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-ACTION:CAPS">Action</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-search-changed">search-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-search-started">search-started</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkSearchEntry-stop-search">stop-search</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-ACTION:CAPS">Action</link></entry></row>

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

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkSearchEntry.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="GInitiallyUnowned">GInitiallyUnowned</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GtkWidget">GtkWidget</link>
            <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkSearchEntry
</screen>
</refsect1>
<refsect1 id="GtkSearchEntry.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkSearchEntry implements
 <link linkend="AtkImplementorIface">AtkImplementorIface</link>,  <link linkend="GtkBuildable">GtkBuildable</link>,  <link linkend="GtkConstraintTarget">GtkConstraintTarget</link> and  <link linkend="GtkEditable">GtkEditable</link>.</para>

</refsect1>

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

<refsect1 id="GtkSearchEntry.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> is a subclass of <link linkend="GtkEntry"><type>GtkEntry</type></link> that has been
tailored for use as a search entry.</para>
<para>It will show an inactive symbolic “find” icon when the search
entry is empty, and a symbolic “clear” icon when there is text.
Clicking on the “clear” icon will empty the search entry.</para>
<para>Note that the search/clear icon is shown using a secondary
icon, and thus does not work if you are using the secondary
icon position for some other purpose.</para>
<para>To make filtering appear more reactive, it is a good idea to
not react to every change in the entry text immediately, but
only after a short delay. To support this, <link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link>
emits the <link linkend="GtkSearchEntry-search-changed"><type>“search-changed”</type></link> signal which can
be used instead of the <link linkend="GtkEditable-changed"><type>“changed”</type></link> signal.</para>
<para>The <link linkend="GtkSearchEntry-previous-match"><type>“previous-match”</type></link>, <link linkend="GtkSearchEntry-next-match"><type>“next-match”</type></link>
and <link linkend="GtkSearchEntry-stop-search"><type>“stop-search”</type></link> signals can be used to implement
moving between search results and ending the search.</para>
<para>Often, GtkSearchEntry will be fed events by means of being
placed inside a <link linkend="GtkSearchBar"><type>GtkSearchBar</type></link>. If that is not the case,
you can use <link linkend="gtk-search-entry-set-key-capture-widget"><function>gtk_search_entry_set_key_capture_widget()</function></link> to let it
capture key input from another widget.</para>

</refsect1>
<refsect1 id="GtkSearchEntry.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-search-entry-new" role="function">
<title>gtk_search_entry_new&#160;()</title>
<indexterm zone="gtk-search-entry-new"><primary>gtk_search_entry_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
gtk_search_entry_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a <link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link>, with a find icon when the search field is
empty, and a clear icon when it isn't.</para>
<refsect3 id="gtk-search-entry-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-search-entry-set-key-capture-widget" role="function">
<title>gtk_search_entry_set_key_capture_widget&#160;()</title>
<indexterm zone="gtk-search-entry-set-key-capture-widget"><primary>gtk_search_entry_set_key_capture_widget</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_search_entry_set_key_capture_widget
                               (<parameter><link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry</parameter>,
                                <parameter><link linkend="GtkWidget"><type>GtkWidget</type></link> *widget</parameter>);</programlisting>
<para>Sets <parameter>widget</parameter>
 as the widget that <parameter>entry</parameter>
 will capture key events from.</para>
<para>Key events are consumed by the search entry to start or
continue a search.</para>
<para>If the entry is part of a <link linkend="GtkSearchBar"><type>GtkSearchBar</type></link>, it is preferable
to call <link linkend="gtk-search-bar-set-key-capture-widget"><function>gtk_search_bar_set_key_capture_widget()</function></link> instead, which
will reveal the entry in addition to triggering the search entry.</para>
<refsect3 id="gtk-search-entry-set-key-capture-widget.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>entry</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>widget</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkWidget"><type>GtkWidget</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-search-entry-get-key-capture-widget" role="function">
<title>gtk_search_entry_get_key_capture_widget&#160;()</title>
<indexterm zone="gtk-search-entry-get-key-capture-widget"><primary>gtk_search_entry_get_key_capture_widget</primary></indexterm>
<programlisting language="C"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
gtk_search_entry_get_key_capture_widget
                               (<parameter><link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry</parameter>);</programlisting>
<para>Gets the widget that <parameter>entry</parameter>
 is capturing key events from.</para>
<refsect3 id="gtk-search-entry-get-key-capture-widget.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>entry</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-search-entry-get-key-capture-widget.returns" role="returns">
<title>Returns</title>
<para>The key capture widget. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>

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

</refsect1>
<refsect1 id="GtkSearchEntry.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkSearchEntry--activates-default" role="property"><title>The <literal>“activates-default”</literal> property</title>
<indexterm zone="GtkSearchEntry--activates-default"><primary>GtkSearchEntry:activates-default</primary></indexterm>
<programlisting>  “activates-default”        <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.</para><para>Owner: GtkSearchEntry</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkSearchEntry--placeholder-text" role="property"><title>The <literal>“placeholder-text”</literal> property</title>
<indexterm zone="GtkSearchEntry--placeholder-text"><primary>GtkSearchEntry:placeholder-text</primary></indexterm>
<programlisting>  “placeholder-text”         <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>Show text in the entry when it’s empty and unfocused.</para><para>Owner: GtkSearchEntry</para>
<para>Flags: Read / Write</para>
<para>Default value: NULL</para>
</refsect2>

</refsect1>
<refsect1 id="GtkSearchEntry.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkSearchEntry-activate" role="signal"><title>The <literal>“activate”</literal> signal</title>
<indexterm zone="GtkSearchEntry-activate"><primary>GtkSearchEntry::activate</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *searchentry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>Flags: <link linkend="G-SIGNAL-ACTION:CAPS">Action</link></para>
</refsect2><refsect2 id="GtkSearchEntry-next-match" role="signal"><title>The <literal>“next-match”</literal> signal</title>
<indexterm zone="GtkSearchEntry-next-match"><primary>GtkSearchEntry::next-match</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>The ::next-match signal is a <link linkend="GtkBindingSignal">keybinding signal</link>
which gets emitted when the user initiates a move to the next match
for the current search string.</para>
<para>Applications should connect to it, to implement moving between
matches.</para>
<para>The default bindings for this signal is Ctrl-g.</para>
<refsect3 id="GtkSearchEntry-next-match.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>entry</para></entry>
<entry role="parameter_description"><para>the entry on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-ACTION:CAPS">Action</link></para>
</refsect2><refsect2 id="GtkSearchEntry-previous-match" role="signal"><title>The <literal>“previous-match”</literal> signal</title>
<indexterm zone="GtkSearchEntry-previous-match"><primary>GtkSearchEntry::previous-match</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>The ::previous-match signal is a <link linkend="GtkBindingSignal">keybinding signal</link>
which gets emitted when the user initiates a move to the previous match
for the current search string.</para>
<para>Applications should connect to it, to implement moving between
matches.</para>
<para>The default bindings for this signal is Ctrl-Shift-g.</para>
<refsect3 id="GtkSearchEntry-previous-match.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>entry</para></entry>
<entry role="parameter_description"><para>the entry on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-ACTION:CAPS">Action</link></para>
</refsect2><refsect2 id="GtkSearchEntry-search-changed" role="signal"><title>The <literal>“search-changed”</literal> signal</title>
<indexterm zone="GtkSearchEntry-search-changed"><primary>GtkSearchEntry::search-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>The <link linkend="GtkSearchEntry-search-changed"><type>“search-changed”</type></link> signal is emitted with a short
delay of 150 milliseconds after the last change to the entry text.</para>
<refsect3 id="GtkSearchEntry-search-changed.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>entry</para></entry>
<entry role="parameter_description"><para>the entry on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkSearchEntry-search-started" role="signal"><title>The <literal>“search-started”</literal> signal</title>
<indexterm zone="GtkSearchEntry-search-started"><primary>GtkSearchEntry::search-started</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>The ::search-started signal gets emitted when the user initiated
a search on the entry.</para>
<refsect3 id="GtkSearchEntry-search-started.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>entry</para></entry>
<entry role="parameter_description"><para>the entry on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkSearchEntry-stop-search" role="signal"><title>The <literal>“stop-search”</literal> signal</title>
<indexterm zone="GtkSearchEntry-stop-search"><primary>GtkSearchEntry::stop-search</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkSearchEntry"><type>GtkSearchEntry</type></link> *entry,
               <link linkend="gpointer"><type>gpointer</type></link>        user_data)</programlisting>
<para>The ::stop-search signal is a <link linkend="GtkBindingSignal">keybinding signal</link>
which gets emitted when the user stops a search via keyboard input.</para>
<para>Applications should connect to it, to implement hiding the search
entry in this case.</para>
<para>The default bindings for this signal is Escape.</para>
<refsect3 id="GtkSearchEntry-stop-search.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>entry</para></entry>
<entry role="parameter_description"><para>the entry on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-ACTION:CAPS">Action</link></para>
</refsect2>
</refsect1>

</refentry>
