Signal

GtkWidget::draw

since: 3.0

Declaration

gboolean
draw (
  GtkWidget* self,
  cairo_t* cr,
  gpointer user_data
)

Description [src]

This signal is emitted when a widget is supposed to render itself. The widgets top left corner must be painted at the origin of the passed in context and be sized to the values returned by gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height().

Signal handlers connected to this signal can modify the cairo context passed as cr in any way they like and don’t need to restore it. The signal emission takes care of calling cairo_save() before and cairo_restore() after invoking the handler.

The signal handler will get a cr with a clip region already set to the widget’s dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can get a finer-grained representation of the dirty region with cairo_copy_clip_rectangle_list().

Default handler:

The default handler is called after the handlers added via g_signal_connect().

Available since: 3.0

Parameters

cr

Type: cairo_t

The cairo context to draw to.

The data is owned by the caller of the function.

Return value

Type: gboolean

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.