<?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="GtkViewport">
<refmeta>
<refentrytitle role="top_of_page" id="GtkViewport.top_of_page">GtkViewport</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkViewport</refname>
<refpurpose>An adapter which makes widgets scrollable</refpurpose>
</refnamediv>

<refsect1 id="GtkViewport.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-viewport-new">gtk_viewport_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-viewport-set-scroll-to-focus">gtk_viewport_set_scroll_to_focus</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-viewport-get-scroll-to-focus">gtk_viewport_get_scroll_to_focus</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-viewport-set-child">gtk_viewport_set_child</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-viewport-get-child">gtk_viewport_get_child</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkViewport.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="GtkWidget"><type>GtkWidget</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkViewport--child">child</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkViewport--scroll-to-focus">scroll-to-focus</link></entry><entry role="property_flags">Read / Write</entry></row>

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

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkViewport.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> GtkViewport
</screen>
</refsect1>
<refsect1 id="GtkViewport.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkViewport implements
 <link linkend="AtkImplementorIface">AtkImplementorIface</link>,  <link linkend="GtkBuildable">GtkBuildable</link>,  <link linkend="GtkConstraintTarget">GtkConstraintTarget</link> and  <link linkend="GtkScrollable">GtkScrollable</link>.</para>

</refsect1>

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

<refsect1 id="GtkViewport.description" role="desc">
<title role="desc.title">Description</title>
<para>The <link linkend="GtkViewport"><type>GtkViewport</type></link> widget acts as an adaptor class, implementing
scrollability for child widgets that lack their own scrolling
capabilities. Use GtkViewport to scroll child widgets such as
<link linkend="GtkGrid"><type>GtkGrid</type></link>, <link linkend="GtkBox"><type>GtkBox</type></link>, and so on.</para>
<para>If a widget has native scrolling abilities, such as <link linkend="GtkTextView"><type>GtkTextView</type></link>,
<link linkend="GtkTreeView"><type>GtkTreeView</type></link> or <link linkend="GtkIconView"><type>GtkIconView</type></link>, it can be added to a <link linkend="GtkScrolledWindow"><type>GtkScrolledWindow</type></link>
with <link linkend="gtk-container-add"><function>gtk_container_add()</function></link>. If a widget does not, you must first add the
widget to a <link linkend="GtkViewport"><type>GtkViewport</type></link>, then add the viewport to the scrolled window.
<link linkend="gtk-container-add"><function>gtk_container_add()</function></link> does this automatically if a child that does not
implement <link linkend="GtkScrollable"><type>GtkScrollable</type></link> is added to a <link linkend="GtkScrolledWindow"><type>GtkScrolledWindow</type></link>, so you can
ignore the presence of the viewport.</para>
<para>The GtkViewport will start scrolling content only if allocated less
than the child widget’s minimum size in a given orientation.</para>
<refsect2><title>CSS nodes</title><para>GtkViewport has a single CSS node with name viewport.</para>
</refsect2>

</refsect1>
<refsect1 id="GtkViewport.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-viewport-new" role="function">
<title>gtk_viewport_new&#160;()</title>
<indexterm zone="gtk-viewport-new"><primary>gtk_viewport_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
gtk_viewport_new (<parameter><link linkend="GtkAdjustment"><type>GtkAdjustment</type></link> *hadjustment</parameter>,
                  <parameter><link linkend="GtkAdjustment"><type>GtkAdjustment</type></link> *vadjustment</parameter>);</programlisting>
<para>Creates a new <link linkend="GtkViewport"><type>GtkViewport</type></link> with the given adjustments, or with default
adjustments if none are given.</para>
<refsect3 id="gtk-viewport-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>hadjustment</para></entry>
<entry role="parameter_description"><para>horizontal adjustment. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>vadjustment</para></entry>
<entry role="parameter_description"><para>vertical adjustment. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-viewport-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkViewport"><type>GtkViewport</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-viewport-set-scroll-to-focus" role="function">
<title>gtk_viewport_set_scroll_to_focus&#160;()</title>
<indexterm zone="gtk-viewport-set-scroll-to-focus"><primary>gtk_viewport_set_scroll_to_focus</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_viewport_set_scroll_to_focus (<parameter><link linkend="GtkViewport"><type>GtkViewport</type></link> *viewport</parameter>,
                                  <parameter><link linkend="gboolean"><type>gboolean</type></link> scroll_to_focus</parameter>);</programlisting>
<para>Sets whether the viewport should automatically scroll
to keep the focused child in view.</para>
<refsect3 id="gtk-viewport-set-scroll-to-focus.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>viewport</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkViewport"><type>GtkViewport</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>scroll_to_focus</para></entry>
<entry role="parameter_description"><para>whether to keep the focus widget scrolled to view</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-viewport-get-scroll-to-focus" role="function">
<title>gtk_viewport_get_scroll_to_focus&#160;()</title>
<indexterm zone="gtk-viewport-get-scroll-to-focus"><primary>gtk_viewport_get_scroll_to_focus</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_viewport_get_scroll_to_focus (<parameter><link linkend="GtkViewport"><type>GtkViewport</type></link> *viewport</parameter>);</programlisting>
<para>Gets whether the viewport is scrolling to keep the focused
child in view. See <link linkend="gtk-viewport-set-scroll-to-focus"><function>gtk_viewport_set_scroll_to_focus()</function></link>.</para>
<refsect3 id="gtk-viewport-get-scroll-to-focus.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>viewport</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkViewport"><type>GtkViewport</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-viewport-get-scroll-to-focus.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the viewport keeps the focus child scrolled to view</para>
</refsect3></refsect2>
<refsect2 id="gtk-viewport-set-child" role="function">
<title>gtk_viewport_set_child&#160;()</title>
<indexterm zone="gtk-viewport-set-child"><primary>gtk_viewport_set_child</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_viewport_set_child (<parameter><link linkend="GtkViewport"><type>GtkViewport</type></link> *viewport</parameter>,
                        <parameter><link linkend="GtkWidget"><type>GtkWidget</type></link> *child</parameter>);</programlisting>
<para>Sets the child widget of <parameter>viewport</parameter>
.</para>
<refsect3 id="gtk-viewport-set-child.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>viewport</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkViewport"><type>GtkViewport</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>child</para></entry>
<entry role="parameter_description"><para>the child widget. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-viewport-get-child" role="function">
<title>gtk_viewport_get_child&#160;()</title>
<indexterm zone="gtk-viewport-get-child"><primary>gtk_viewport_get_child</primary></indexterm>
<programlisting language="C"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
gtk_viewport_get_child (<parameter><link linkend="GtkViewport"><type>GtkViewport</type></link> *viewport</parameter>);</programlisting>
<para>Gets the child widget of <parameter>viewport</parameter>
.</para>
<refsect3 id="gtk-viewport-get-child.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>viewport</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkViewport"><type>GtkViewport</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-viewport-get-child.returns" role="returns">
<title>Returns</title>
<para>the child widget of <parameter>viewport</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>

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

</refsect1>
<refsect1 id="GtkViewport.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkViewport--child" role="property"><title>The <literal>“child”</literal> property</title>
<indexterm zone="GtkViewport--child"><primary>GtkViewport:child</primary></indexterm>
<programlisting>  “child”                    <link linkend="GtkWidget"><type>GtkWidget</type></link>&#160;*</programlisting>
<para>The child widget.</para><para>Owner: GtkViewport</para>
<para>Flags: Read / Write</para>
</refsect2>
<refsect2 id="GtkViewport--scroll-to-focus" role="property"><title>The <literal>“scroll-to-focus”</literal> property</title>
<indexterm zone="GtkViewport--scroll-to-focus"><primary>GtkViewport:scroll-to-focus</primary></indexterm>
<programlisting>  “scroll-to-focus”          <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Whether to scroll when the focus changes.</para><para>Owner: GtkViewport</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>

</refsect1>
<refsect1 id="GtkViewport.see-also">
<title>See Also</title>
<para><link linkend="GtkScrolledWindow"><type>GtkScrolledWindow</type></link>, <link linkend="GtkAdjustment"><type>GtkAdjustment</type></link></para>

</refsect1>

</refentry>
