[gtk+/rendering-cleanup-next: 154/199] API: Add gtk_widget_draw()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 154/199] API: Add gtk_widget_draw()
- Date: Thu, 23 Sep 2010 21:32:03 +0000 (UTC)
commit adc83be3b461a46228ce71828752724c74439e01
Author: Benjamin Otte <otte redhat com>
Date: Sat Sep 11 05:19:28 2010 +0200
API: Add gtk_widget_draw()
And here's the final patch that all the previous patches were about.
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtk.symbols | 1 +
gtk/gtkwidget.c | 47 ++++++++++++++++++++++++++++++++++
gtk/gtkwidget.h | 2 +
4 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 6754cc0..4695818 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -4770,6 +4770,7 @@ gtk_widget_map
gtk_widget_unmap
gtk_widget_realize
gtk_widget_unrealize
+gtk_widget_draw
gtk_widget_queue_draw
gtk_widget_queue_resize
gtk_widget_queue_resize_no_redraw
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 7954778..226dbd6 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -4199,6 +4199,7 @@ gtk_widget_create_pango_context
gtk_widget_create_pango_layout
gtk_widget_destroy
gtk_widget_destroyed
+gtk_widget_draw
gtk_widget_ensure_style
gtk_widget_error_bell
gtk_widget_event
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4084609..8e9e141 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5119,6 +5119,53 @@ _gtk_widget_draw_internal (GtkWidget *widget,
}
}
+/**
+ * gtk_widget_draw:
+ * @widget: the widget to draw. It must be drawable (see
+ * gtk_widget_is_drawable()) and a size must have been allocated.
+ * @cr: a cairo context to draw to
+ *
+ * Draws @widget to @cr. The top left corner of the widget will be
+ * drawn to the currently set origin point of @cr.
+ *
+ * You should pass a cairo context as @cr argument that is in an
+ * original state. Otherwise the resulting drawing is undefined. For
+ * example changing the operator using cairo_set_operator() or the
+ * line width using cairo_set_line_width() might have unwanted side
+ * effects.
+ * You may however change the context's transform matrix - like with
+ * cairo_scale(), cairo_translate() or cairo_set_matrix() and clip
+ * region with cairo_clip() prior to calling this function. Also, it
+ * is fine to modify the context with cairo_save() and
+ * cairo_push_group() prior to calling this function.
+ *
+ * <note><para>Special purpose widgets may contain special code for
+ * rendering to the screen and might appear differently on screen
+ * and when rendered using gtk_widget_draw().</para></note>
+ **/
+void
+gtk_widget_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GdkEventExpose *tmp_event;
+
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (cr != NULL);
+
+ cairo_save (cr);
+ /* We have to reset the event here so that draw functions can call
+ * gtk_widget_draw() on random other widgets and get the desired
+ * effect: Drawing all contents, not just the current window.
+ */
+ tmp_event = _gtk_cairo_get_event (cr);
+ gtk_cairo_set_event (cr, NULL);
+
+ _gtk_widget_draw_internal (widget, cr, TRUE);
+
+ gtk_cairo_set_event (cr, tmp_event);
+ cairo_restore (cr);
+}
+
static gboolean
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 5b9e3a5..117cd2e 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -550,6 +550,8 @@ void gtk_widget_unmap (GtkWidget *widget);
void gtk_widget_realize (GtkWidget *widget);
void gtk_widget_unrealize (GtkWidget *widget);
+void gtk_widget_draw (GtkWidget *widget,
+ cairo_t *cr);
/* Queuing draws */
void gtk_widget_queue_draw (GtkWidget *widget);
void gtk_widget_queue_draw_area (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]