1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 a widget for custom user interface elements.
7 <!-- ##### SECTION Long_Description ##### -->
9 The #GtkDrawingArea widget is used for creating custom
10 user interface elements. After creating a drawing
11 area, the application may want to connect to:
15 Mouse and button press signals to respond to input from
21 The "realize" signal to take any necessary actions
27 The "size_allocate" signal to take any necessary actions
28 when the widget changes size.
33 The "expose_event" signal to handle redrawing the
34 contents of the widget.
38 As a convenience, the #GtkDrawingArea widget synthesizes
39 a "configure_event" when the widget is realized
40 and any time the size of a widget changes when it
41 is realized. It often suffices to connect to this
42 signal instead of "realize" and "size_allocate".
45 The following code portion demonstrates using a drawing
46 area to implement a widget that draws a circle.
47 As this example demonstrates, an expose handler should
48 draw only the pixels within the requested area and
49 should draw or clear all these pixels.
52 <title>Simple <structname>GtkDrawingArea</structname> usage.</title>
55 expose_event (GdkWidget *widget, GdkEventExpose *event, gpointer data)
57 gdk_window_clear_area (widget->window,
58 event->area.x, event->area.y,
59 event->area.width, event->area.height);
60 gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
62 gdk_draw_arc (widget->window,
63 widget->style->fg_gc[widget->state],
65 0, 0, widget->allocation.width, widget->allocation.height,
67 gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
73 GtkWidget *drawing_area = gtk_drawing_area_new (<!>);
74 gtk_signal_connect (GTK_OBJECT (drawing_area),
78 <!-- ##### SECTION See_Also ##### -->
83 <!-- ##### STRUCT GtkDrawingArea ##### -->
85 The #GtkDrawingArea struct contains private data only, and
86 should be accessed using the functions below.
90 <!-- ##### FUNCTION gtk_drawing_area_new ##### -->
92 Creates a new drawing area.
95 @Returns: a new #GtkDrawingArea
98 <!-- ##### FUNCTION gtk_drawing_area_size ##### -->
100 Sets the size that the drawing area will request
101 in response to a "size_request" signal. The
102 drawing area may actually be allocated a size
103 larger than this depending on how it is packed
104 within the enclosing containers.
107 @darea: a #GtkDrawingArea.
108 @width: the width to request.
109 @height: the height to request.