[gtkmm] Widget: Added should_draw_window() and transform_cairo_context_to_window().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Widget: Added should_draw_window() and transform_cairo_context_to_window().
- Date: Mon, 14 Feb 2011 10:30:30 +0000 (UTC)
commit 2d08702a5a2d91cefb3d414620bbe0bdba9a9ce5
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Feb 14 11:30:14 2011 +0100
Widget: Added should_draw_window() and transform_cairo_context_to_window().
* gtk/src/widget.[hg|ccg]: Added Widget::transform_cairo_context_to_window(),
wrapping gtk_cairo_transform_to_window().
Added Widget::should_draw_window(), wrapping gtk_cairo_should_draw_window().
These are both protected because they are for use in Gtk::Container
implementation.
* tools/m4/convert_gtk.m4: Added a Cairo::Context conversion.
ChangeLog | 11 +++++++++++
gtk/src/widget.ccg | 6 ++++++
gtk/src/widget.hg | 21 ++++++++++++++++++++-
tools/m4/convert_gtk.m4 | 1 +
4 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8fb1b60..125b420 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-02-14 Murray Cumming <murrayc murrayc com>
+
+ Widget: Added should_draw_window() and transform_cairo_context_to_window().
+
+ * gtk/src/widget.[hg|ccg]: Added Widget::transform_cairo_context_to_window(),
+ wrapping gtk_cairo_transform_to_window().
+ Added Widget::should_draw_window(), wrapping gtk_cairo_should_draw_window().
+ These are both protected because they are for use in Gtk::Container
+ implementation.
+ * tools/m4/convert_gtk.m4: Added a Cairo::Context conversion.
+
2011-02-11 Murray Cumming <murrayc murrayc com>
Make sure that we do not wrap the deprecated CellRenderer::get_size() vfunc.
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index c0a86a3..fa4dff7 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -646,4 +646,10 @@ void Widget::unset_cursor()
gtk_widget_override_cursor(gobj(), 0, 0);
}
+
+void Widget::transform_cairo_context_to_window(const Cairo::RefPtr<Cairo::Context>& cr, const Glib::RefPtr<const Gdk::Window>& window)
+{
+ gtk_cairo_transform_to_window((cr)->cobj(), gobj(), const_cast<GdkWindow*>(Glib::unwrap<Gdk::Window>(window)));
+}
+
} // namespace Gtk
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index f2a664f..ca040e9 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -856,7 +856,26 @@ protected:
void set_window(const Glib::RefPtr<Gdk::Window>& window);
_IGNORE(gtk_widget_set_window)
- //TODO: Move this to protected when we can break API:
+ _WRAP_METHOD(static bool should_draw_window(const Cairo::RefPtr<const Cairo::Context>& cr, const Glib::RefPtr<const Gdk::Window>& window), gtk_cairo_should_draw_window)
+
+ /** Transforms the given cairo context @a cr from widget-relative
+ * coordinates to window-relative coordinates.
+ * If the widget's window is not an ancestor of @a window, no
+ * modification will be applied.
+ *
+ * This is the inverse to the transformation GTK applies when
+ * preparing an expose event to be emitted with the Widget's draw
+ * signal. It is intended to help porting multiwindow widgets from
+ * GTK+ 2 to the rendering architecture of GTK+ 3.
+ *
+ * @param cr The cairo context to transform.
+ * @param window The window to transform the context to.
+ *
+ * @newin{3,0}
+ */
+ void transform_cairo_context_to_window(const Cairo::RefPtr<Cairo::Context>& cr, const Glib::RefPtr<const Gdk::Window>& window);
+ _IGNORE(gtk_cairo_transform_to_window)
+
/** Retrieves the widget's requisition.
*
* This method should only be used by widget implementations in
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index aa6f2de..77f7833 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -614,6 +614,7 @@ _CONVERSION(`GtkPrintOperationResult',`PrintOperationResult',`($2)$3')
_CONVERSION(`GtkPrintStatus',`PrintStatus',`($2)$3')
_CONVERSION(`const Cairo::RefPtr<Cairo::Context>&',`cairo_t*',`($3)->cobj()')
+_CONVERSION(`const Cairo::RefPtr<const Cairo::Context>&',`cairo_t*',`const_cast<cairo_t*>(($3)->cobj())')
_CONVERSION(`const Cairo::FontOptions&',`const cairo_font_options_t*',`($3).cobj()')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]