<?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-GtkWidgetPaintable">
<refmeta>
<refentrytitle role="top_of_page" id="gtk4-GtkWidgetPaintable.top_of_page">GtkWidgetPaintable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkWidgetPaintable</refname>
<refpurpose>Drawing a widget elsewhere</refpurpose>
</refnamediv>

<refsect1 id="gtk4-GtkWidgetPaintable.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="GdkPaintable"><returnvalue>GdkPaintable</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-widget-paintable-new">gtk_widget_paintable_new</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-widget-paintable-get-widget">gtk_widget_paintable_get_widget</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-widget-paintable-set-widget">gtk_widget_paintable_set_widget</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

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

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

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

<refsect1 id="gtk4-GtkWidgetPaintable.description" role="desc">
<title role="desc.title">Description</title>
<para>GtkWidgetPaintable is an implementation of the <link linkend="GdkPaintable"><type>GdkPaintable</type></link> interface 
that allows displaying the contents of a <link linkend="GtkWidget"><type>GtkWidget</type></link>.</para>
<para>GtkWidgetPaintable will also take care of the widget not being in a
state where it can be drawn (like when it isn't shown) and just draw
nothing or where it does not have a size (like when it is hidden) and
report no size in that case.</para>
<para>Of course, GtkWidgetPaintable allows you to monitor widgets for size
changes by emitting the <link linkend="GdkPaintable-invalidate-size"><type>“invalidate-size”</type></link> signal whenever
the size of the widget changes as well as for visual changes by
emitting the <link linkend="GdkPaintable-invalidate-contents"><type>“invalidate-contents”</type></link> signal whenever the
widget changes.</para>
<para>You can of course use a GtkWidgetPaintable everywhere a
<link linkend="GdkPaintable"><type>GdkPaintable</type></link> is allowed, including using it on a <link linkend="GtkPicture"><type>GtkPicture</type></link> (or one
of its parents) that it was set on itself via <link linkend="gtk-picture-set-paintable"><function>gtk_picture_set_paintable()</function></link>.
The paintable will take care of recursion when this happens. If you do
this however, ensure the <link linkend="GtkPicture--can-shrink"><type>“can-shrink”</type></link> property is set to
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link> or you might end up with an infinitely growing widget.</para>

</refsect1>
<refsect1 id="gtk4-GtkWidgetPaintable.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-widget-paintable-new" role="function">
<title>gtk_widget_paintable_new&#160;()</title>
<indexterm zone="gtk-widget-paintable-new"><primary>gtk_widget_paintable_new</primary></indexterm>
<programlisting language="C"><link linkend="GdkPaintable"><returnvalue>GdkPaintable</returnvalue></link>&#160;*
gtk_widget_paintable_new (<parameter><link linkend="GtkWidget"><type>GtkWidget</type></link> *widget</parameter>);</programlisting>
<para>Creates a new widget paintable observing the given widget.</para>
<refsect3 id="gtk-widget-paintable-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>widget</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkWidget"><type>GtkWidget</type></link> or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>][<acronym>transfer none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-widget-paintable-new.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GtkWidgetPaintable"><type>GtkWidgetPaintable</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>type</acronym> GtkWidgetPaintable]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-widget-paintable-get-widget" role="function">
<title>gtk_widget_paintable_get_widget&#160;()</title>
<indexterm zone="gtk-widget-paintable-get-widget"><primary>gtk_widget_paintable_get_widget</primary></indexterm>
<programlisting language="C"><link linkend="GtkWidget"><returnvalue>GtkWidget</returnvalue></link>&#160;*
gtk_widget_paintable_get_widget (<parameter><link linkend="GtkWidgetPaintable"><type>GtkWidgetPaintable</type></link> *self</parameter>);</programlisting>
<para>Returns the widget that is observed or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if none.</para>
<refsect3 id="gtk-widget-paintable-get-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>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkWidgetPaintable"><type>GtkWidgetPaintable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-widget-paintable-get-widget.returns" role="returns">
<title>Returns</title>
<para>the observed widget. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-widget-paintable-set-widget" role="function">
<title>gtk_widget_paintable_set_widget&#160;()</title>
<indexterm zone="gtk-widget-paintable-set-widget"><primary>gtk_widget_paintable_set_widget</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_widget_paintable_set_widget (<parameter><link linkend="GtkWidgetPaintable"><type>GtkWidgetPaintable</type></link> *self</parameter>,
                                 <parameter><link linkend="GtkWidget"><type>GtkWidget</type></link> *widget</parameter>);</programlisting>
<para>Sets the widget that should be observed.</para>
<refsect3 id="gtk-widget-paintable-set-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>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkWidgetPaintable"><type>GtkWidgetPaintable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>widget</para></entry>
<entry role="parameter_description"><para>the widget to observe or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

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

</refsect1>
<refsect1 id="gtk4-GtkWidgetPaintable.see-also">
<title>See Also</title>
<para><link linkend="GtkWidget"><type>GtkWidget</type></link>, <link linkend="GdkPaintable"><type>GdkPaintable</type></link></para>

</refsect1>

</refentry>
