<?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="gtk4-GtkBuilderScope">
<refmeta>
<refentrytitle role="top_of_page" id="gtk4-GtkBuilderScope.top_of_page">GtkBuilderScope</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkBuilderScope</refname>
<refpurpose>Bindings for GtkBuilder</refpurpose>
</refnamediv>

<refsect1 id="gtk4-GtkBuilderScope.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="GtkBuilderScope"><returnvalue>GtkBuilderScope</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-builder-cscope-new">gtk_builder_cscope_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-builder-cscope-add-callback-symbol">gtk_builder_cscope_add_callback_symbol</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-builder-cscope-add-callback-symbols">gtk_builder_cscope_add_callback_symbols</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GCallback"><returnvalue>GCallback</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-builder-cscope-lookup-callback-symbol">gtk_builder_cscope_lookup_callback_symbol</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

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

<refsect1 id="gtk4-GtkBuilderScope.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkBuilderScope"><type>GtkBuilderScope</type></link> is an interface to provide support to <link linkend="GtkBuilder"><type>GtkBuilder</type></link>, primarily
for looking up programming-language-specific values for strings that are
given in a <link linkend="GtkBuilder"><type>GtkBuilder</type></link> UI file.</para>
<para>The primary intended audience is bindings that want to provide deeper integration
of <link linkend="GtkBuilder"><type>GtkBuilder</type></link> into the language.</para>
<para>A <link linkend="GtkBuilderScope"><type>GtkBuilderScope</type></link> instance may be used with multiple <link linkend="GtkBuilder"><type>GtkBuilder</type></link> objects, even
at once.</para>
<para>By default, GTK will use its own implementation of <link linkend="GtkBuilderScope"><type>GtkBuilderScope</type></link> for the C
language which can be created via <link linkend="gtk-builder-cscope-new"><function>gtk_builder_cscope_new()</function></link>.</para>
<para><link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link> instances use symbols explicitly added to <parameter>builder</parameter>

with prior calls to <link linkend="gtk-builder-cscope-add-callback-symbol"><function>gtk_builder_cscope_add_callback_symbol()</function></link>. If developers want
to do that, they are encouraged to create their own scopes for that purpose.</para>
<para>In the case that symbols are not explicitly added; GTK will uses <link linkend="GModule"><type>GModule</type></link>’s
introspective features (by opening the module <link linkend="NULL:CAPS"><literal>NULL</literal></link>) to look at the application’s
symbol table. From here it tries to match the signal function names given in the
interface description with symbols in the application.</para>
<para>Note that unless <link linkend="gtk-builder-cscope-add-callback-symbol"><function>gtk_builder_cscope_add_callback_symbol()</function></link> is called for
all signal callbacks which are referenced by the loaded XML, this
functionality will require that <link linkend="GModule"><type>GModule</type></link> be supported on the platform.</para>

</refsect1>
<refsect1 id="gtk4-GtkBuilderScope.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-builder-cscope-new" role="function">
<title>gtk_builder_cscope_new&#160;()</title>
<indexterm zone="gtk-builder-cscope-new"><primary>gtk_builder_cscope_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkBuilderScope"><returnvalue>GtkBuilderScope</returnvalue></link>&#160;*
gtk_builder_cscope_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link> object to use with future <link linkend="GtkBuilder"><type>GtkBuilder</type></link>
instances.</para>
<para>Calling this function is only necessary if you want to add custom
callbacks via <link linkend="gtk-builder-cscope-add-callback-symbol"><function>gtk_builder_cscope_add_callback_symbol()</function></link>.</para>
<refsect3 id="gtk-builder-cscope-new.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-builder-cscope-add-callback-symbol" role="function">
<title>gtk_builder_cscope_add_callback_symbol&#160;()</title>
<indexterm zone="gtk-builder-cscope-add-callback-symbol"><primary>gtk_builder_cscope_add_callback_symbol</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_builder_cscope_add_callback_symbol
                               (<parameter><link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link> *self</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *callback_name</parameter>,
                                <parameter><link linkend="GCallback"><type>GCallback</type></link> callback_symbol</parameter>);</programlisting>
<para>Adds the <parameter>callback_symbol</parameter>
 to the scope of <parameter>builder</parameter>
 under the given <parameter>callback_name</parameter>
.</para>
<para>Using this function overrides the behavior of <link linkend="gtk-builder-create-closure"><function>gtk_builder_create_closure()</function></link>
for any callback symbols that are added. Using this method allows for better
encapsulation as it does not require that callback symbols be declared in
the global namespace.</para>
<refsect3 id="gtk-builder-cscope-add-callback-symbol.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="GtkBuilderCScope"><type>GtkBuilderCScope</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>callback_name</para></entry>
<entry role="parameter_description"><para>The name of the callback, as expected in the XML</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>callback_symbol</para></entry>
<entry role="parameter_description"><para>The callback pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope async</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-builder-cscope-add-callback-symbols" role="function">
<title>gtk_builder_cscope_add_callback_symbols&#160;()</title>
<indexterm zone="gtk-builder-cscope-add-callback-symbols"><primary>gtk_builder_cscope_add_callback_symbols</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_builder_cscope_add_callback_symbols
                               (<parameter><link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link> *self</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *first_callback_name</parameter>,
                                <parameter><link linkend="GCallback"><type>GCallback</type></link> first_callback_symbol</parameter>,
                                <parameter>...</parameter>);</programlisting>
<para>A convenience function to add many callbacks instead of calling
<link linkend="gtk-builder-cscope-add-callback-symbol"><function>gtk_builder_cscope_add_callback_symbol()</function></link> for each symbol.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="gtk-builder-cscope-add-callback-symbols.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="GtkBuilderCScope"><type>GtkBuilderCScope</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_callback_name</para></entry>
<entry role="parameter_description"><para>The name of the callback, as expected in the XML</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>first_callback_symbol</para></entry>
<entry role="parameter_description"><para>The callback pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope async</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>...</para></entry>
<entry role="parameter_description"><para>A list of callback name and callback symbol pairs terminated with <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-builder-cscope-lookup-callback-symbol" role="function">
<title>gtk_builder_cscope_lookup_callback_symbol&#160;()</title>
<indexterm zone="gtk-builder-cscope-lookup-callback-symbol"><primary>gtk_builder_cscope_lookup_callback_symbol</primary></indexterm>
<programlisting language="C"><link linkend="GCallback"><returnvalue>GCallback</returnvalue></link>
gtk_builder_cscope_lookup_callback_symbol
                               (<parameter><link linkend="GtkBuilderCScope"><type>GtkBuilderCScope</type></link> *self</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *callback_name</parameter>);</programlisting>
<para>Fetches a symbol previously added to <parameter>self</parameter>

with <link linkend="gtk-builder-cscope-add-callback-symbol"><function>gtk_builder_cscope_add_callback_symbol()</function></link>.</para>

<para><emphasis role="annotation">[<acronym>skip</acronym>]</emphasis></para><refsect3 id="gtk-builder-cscope-lookup-callback-symbol.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="GtkBuilderCScope"><type>GtkBuilderCScope</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>callback_name</para></entry>
<entry role="parameter_description"><para>The name of the callback</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-builder-cscope-lookup-callback-symbol.returns" role="returns">
<title>Returns</title>
<para>The callback symbol in <parameter>builder</parameter>
for <parameter>callback_name</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gtk4-GtkBuilderScope.see-also">
<title>See Also</title>
<para><link linkend="GtkBuilder"><type>GtkBuilder</type></link>, <link linkend="GClosure"><type>GClosure</type></link></para>

</refsect1>

</refentry>
