<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkdrawingarea">
  <refnamediv>
    <refname>gtk.DrawingArea</refname>
    <refpurpose>a widget for custom user interface elements.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.DrawingArea</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkwidget">gtk.Widget</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtkdrawingarea">gtk.DrawingArea</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkdrawingarea">gtk.DrawingArea</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkdrawingarea"><classname>gtk.DrawingArea</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>

  <refsect1 id="properties-gtkdrawingarea">
    <title>gtk.DrawingArea Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>

  </refsect1>

  <refsect1 id="style-properties-gtkdrawingarea">
    <title>gtk.DrawingArea Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkdrawingarea">
    <title>gtk.DrawingArea Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
</refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gtkdrawingarea"><classname>gtk.DrawingArea</classname></link>
widget is used for creating custom user interface elements. It's essentially
a blank widget containing a <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link> that
you can draw on. The contained <link
linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link> is
accessed using the <link
linkend="class-gtkwidget"><classname>gtk.Widget</classname></link> "window"
attribute as:</para>

    <programlisting>
  gdkwindow = drawingarea.window
</programlisting>

    <para>Since a <link
    linkend="class-gdkwindow"><classname>gtk.gdk.Window</classname></link>
    is a subclass of <link
    linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>,
    all of the <link
    linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>
    methods are available for drawing on the <link
    linkend="class-gtkdrawingarea"><classname>gtk.DrawingArea</classname></link>'s
    gdkwindow.</para>

    <para>After creating a drawing area, the application may want to
connect to:</para>

    <itemizedlist>
      <listitem>
	<para>Mouse and button press signals to respond to input from the
user. Use the <link
linkend="method-gtkwidget--add-events"><methodname>gtk.Widget.add_events</methodname>()</link>
method to enable events you wish to receive. To receive keyboard events, you
will need to set the <literal>gtk.CAN_FOCUS</literal> flag on the drawing
area</para>
      </listitem>

      <listitem>
	<para>The "realize" signal to take any necessary actions when the
widget is instantiated on a particular display.</para>
      </listitem>

      <listitem>
	<para>The "configure_event" signal to take any necessary actions
when the widget changes size.</para>
      </listitem>

      <listitem>
	<para>The "expose_event" signal to handle redrawing the contents of
the widget when a drawing area first comes on screen, or when it's covered by
another window and then uncovered (exposed). You can also force an expose
event by adding to the "damage region" of the drawing area's window using
the <link
linkend="method-gtkwidget--queue-draw-area"><methodname>gtk.Widget.queue_draw_area</methodname>()</link>
method.</para>
      </listitem>
    </itemizedlist>

    <para>See the <ulink
url="http://www.pygtk.org/pygtk2tutorial/ch-DrawingArea.html">Drawing
Area</ulink> chapter in the tutorial for more information on using a <link
linkend="class-gtkdrawingarea"><classname>gtk.DrawingArea</classname></link>.</para>

    <para>Sometimes a <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> is a useful
alternative to a drawing area. You can put a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link> in
the <link linkend="class-gtkimage"><classname>gtk.Image</classname></link>
and draw to the <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link>,
calling the <link
linkend="method-gtkwidget--queue-draw"><methodname>gtk.Widget.queue_draw</methodname>()</link>
method on the <link
linkend="class-gtkimage"><classname>gtk.Image</classname></link> when you
want to refresh to the screen.</para>

  </refsect1>

  <refsect1 id="constructor-gtkdrawingarea">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.DrawingArea</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new drawingarea widget</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtkdrawingarea"><classname>gtk.DrawingArea</classname></link>
widget.</para>

  </refsect1>

</refentry>
