[gtkmm] Use Cairo::make_refptr_for_instance().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Use Cairo::make_refptr_for_instance().
- Date: Wed, 7 Dec 2016 12:16:28 +0000 (UTC)
commit b1bd48a09292020cf7042c2802fe8275760ddba4
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Dec 7 12:05:31 2016 +0100
Use Cairo::make_refptr_for_instance().
This is new in cairomm. It lets us hide the construction
details of the RefPtr.
gdk/src/cursor.hg | 4 ++--
gdk/src/drawingcontext.hg | 4 ++--
gdk/src/window.hg | 6 +++---
gtk/src/cellrenderer.hg | 2 +-
gtk/src/checkbutton.hg | 2 +-
gtk/src/checkmenuitem.hg | 2 +-
gtk/src/drawingarea.ccg | 2 +-
gtk/src/iconinfo.hg | 2 +-
gtk/src/icontheme.hg | 2 +-
gtk/src/iconview.hg | 2 +-
gtk/src/printcontext.hg | 4 ++--
gtk/src/printjob.hg | 4 ++--
gtk/src/treeview.hg | 2 +-
gtk/src/widget.hg | 2 +-
14 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/gdk/src/cursor.hg b/gdk/src/cursor.hg
index 3768185..e5f9719 100644
--- a/gdk/src/cursor.hg
+++ b/gdk/src/cursor.hg
@@ -60,8 +60,8 @@ public:
_WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_image() const, gdk_cursor_get_image, constversion)
//TODO: Should this always be const?
-#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr<
::Cairo::Surface>(new ::Cairo::Surface($3, true /* take reference */))')
-#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr<const ::Cairo::Surface>',`::Cairo::RefPtr<
::Cairo::Surface>(new ::Cairo::Surface($3, true /* take reference */))')
+#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::make_refptr_for_instance<
::Cairo::Surface>(new ::Cairo::Surface($3, true /* take reference */))')
+#m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr<const
::Cairo::Surface>',`::Cairo::make_refptr_for_instance< ::Cairo::Surface>(new ::Cairo::Surface($3, true /*
take reference */))')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> get_surface(double& x_hot, double& y_hot),
gdk_cursor_get_surface)
_WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Surface> get_surface(double& x_hot, double& y_hot) const,
gdk_cursor_get_surface, constversion)
diff --git a/gdk/src/drawingcontext.hg b/gdk/src/drawingcontext.hg
index 4634a1a..4ef410a 100644
--- a/gdk/src/drawingcontext.hg
+++ b/gdk/src/drawingcontext.hg
@@ -49,13 +49,13 @@ public:
_WRAP_METHOD(Glib::RefPtr<Window> get_window(), gdk_drawing_context_get_window, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Window> get_window() const, gdk_drawing_context_get_window, refreturn,
constversion)
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::RefPtr< ::Cairo::Region>(new
::Cairo::Region($3, true /* do not take ref */))')
+#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance<
::Cairo::Region>(new ::Cairo::Region($3, true /* do not take ref */))')
// This is const because it returns a copy.
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_clip() const, gdk_drawing_context_get_clip)
_WRAP_METHOD(bool is_valid() const, gdk_drawing_context_is_valid)
-#m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::RefPtr< ::Cairo::Context>(new
::Cairo::Context($3, false /* take reference */))')
+#m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* take reference */))')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Context> get_cairo_context(), gdk_drawing_context_get_cairo_context)
_WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Context> get_cairo_context() const,
gdk_drawing_context_get_cairo_context, constversion)
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index a0daabb..dc58ffa 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -223,7 +223,7 @@ public:
_WRAP_METHOD(bool get_decorations(WMDecoration& decorations) const, gdk_window_get_decorations)
_WRAP_METHOD(void set_functions(WMFunction functions), gdk_window_set_functions)
- #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr<
::Cairo::Surface>(new ::Cairo::Surface($3, false /* take reference */))')
+ #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr<
::Cairo::Surface>',`::Cairo::make_refptr_for_instance< ::Cairo::Surface>(new ::Cairo::Surface($3, false /*
take reference */))')
#m4 _CONVERSION(`::Cairo::Content',`cairo_content_t',`(cairo_content_t)($3)')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> create_similar_surface(::Cairo::Content content, int
width, int height), gdk_window_create_similar_surface )
@@ -290,7 +290,7 @@ public:
gpointer user_data);
*/
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::RefPtr< ::Cairo::Region>(new
::Cairo::Region(($3), true /* do not take ref */))')
+#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance<
::Cairo::Region>(new ::Cairo::Region(($3), true /* do not take ref */))')
//This method should not have a const version - see the docs
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_update_area(), gdk_window_get_update_area)
@@ -330,7 +330,7 @@ public:
_WRAP_METHOD(void set_support_multidevice(bool support_multidevice = true),
gdk_window_set_support_multidevice)
_WRAP_METHOD(bool get_support_multidevice(), gdk_window_get_support_multidevice)
-#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::RefPtr< ::Cairo::Region>(new
::Cairo::Region($3, true /* do not take ref */))')
+#m4 _CONVERSION(`cairo_region_t*',`::Cairo::RefPtr< ::Cairo::Region>',`::Cairo::make_refptr_for_instance<
::Cairo::Region>(new ::Cairo::Region($3, true /* do not take ref */))')
//This is const because it returns a copy (though that is not very clear from the C documentation)
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Region> get_clip_region() const, gdk_window_get_clip_region)
diff --git a/gtk/src/cellrenderer.hg b/gtk/src/cellrenderer.hg
index 83e61e5..7e26dd1 100644
--- a/gtk/src/cellrenderer.hg
+++ b/gtk/src/cellrenderer.hg
@@ -142,7 +142,7 @@ protected:
#m4begin
dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal.
- _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
+ _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
#m4end
#m4 _CONVERSION(`const GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
diff --git a/gtk/src/checkbutton.hg b/gtk/src/checkbutton.hg
index 3c9e17f..53bbdd4 100644
--- a/gtk/src/checkbutton.hg
+++ b/gtk/src/checkbutton.hg
@@ -61,7 +61,7 @@ protected:
#m4begin
dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal.
-_CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr< ::Cairo::Context>(new
::Cairo::Context($3, false /* has_reference */))')
+_CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
#m4end
/** Emited on button redraw to update indicator.
diff --git a/gtk/src/checkmenuitem.hg b/gtk/src/checkmenuitem.hg
index 71d2be2..e2b9c41 100644
--- a/gtk/src/checkmenuitem.hg
+++ b/gtk/src/checkmenuitem.hg
@@ -60,7 +60,7 @@ protected:
#m4begin
dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal.
-_CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr< ::Cairo::Context>(new
::Cairo::Context($3, false /* has_reference */))')
+_CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
#m4end
/** Triggered when the item is redrawn (e.g.after being toggled)
diff --git a/gtk/src/drawingarea.ccg b/gtk/src/drawingarea.ccg
index c80dfa3..2d7c011 100644
--- a/gtk/src/drawingarea.ccg
+++ b/gtk/src/drawingarea.ccg
@@ -25,7 +25,7 @@ void SignalProxy_Draw_gtk_callback(GtkDrawingArea* /* drawing_area */, cairo_t*
int width, int height, void* user_data)
{
auto the_slot = static_cast<Gtk::DrawingArea::SlotDraw*>(user_data);
- auto cr2 = ::Cairo::RefPtr< ::Cairo::Context>(new ::Cairo::Context(cr, false /* has_reference */));
+ auto cr2 = ::Cairo::make_refptr_for_instance< ::Cairo::Context>(new ::Cairo::Context(cr, false /*
has_reference */));
try
{
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index fbd0b12..3755f43 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -52,7 +52,7 @@ public:
_WRAP_METHOD(Glib::ustring get_filename() const, gtk_icon_info_get_filename)
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon() const, gtk_icon_info_load_icon, errthrow)
- #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr<
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
+ #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::make_refptr_for_instance<
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> load_surface(const Glib::RefPtr<Gdk::Window>& for_window),
gtk_icon_info_load_surface, errthrow)
//TODO: Documentation
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index e7bdfc3..64427c9 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -73,7 +73,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags
flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, int scale,
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, errthrow)
- #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr<
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
+ #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::make_refptr_for_instance<
::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> load_surface(const Glib::ustring& icon_name, int size, int
scale, const Glib::RefPtr<Gdk::Window>& for_window, IconLookupFlags flags = (IconLookupFlags)0),
gtk_icon_theme_load_surface, errthrow)
#m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector($3,
Glib::OWNERSHIP_DEEP)')
diff --git a/gtk/src/iconview.hg b/gtk/src/iconview.hg
index b8b910b..15fa51d 100644
--- a/gtk/src/iconview.hg
+++ b/gtk/src/iconview.hg
@@ -328,7 +328,7 @@ public:
bool get_dest_item_at_pos(int drag_x, int drag_y, IconViewDropPosition& pos) const;
_IGNORE(gtk_icon_view_get_dest_item_at_pos)
-#m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new
Cairo::Surface($3, false /* take reference */))')
+#m4
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
Cairo::Surface($3, false /* take reference */))')
_WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> create_drag_icon( const TreeModel::Path& path),
gtk_icon_view_create_drag_icon)
_WRAP_METHOD(void convert_widget_to_bin_window_coords(int wx, int wy, int& bx, int& by) const,
gtk_icon_view_convert_widget_to_bin_window_coords)
diff --git a/gtk/src/printcontext.hg b/gtk/src/printcontext.hg
index d910f6f..d97c8c3 100644
--- a/gtk/src/printcontext.hg
+++ b/gtk/src/printcontext.hg
@@ -50,8 +50,8 @@ class PrintContext : public Glib::Object
public:
- #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::RefPtr< ::Cairo::Context>(new
::Cairo::Context($3, false /* take ref */))')
- #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr<const ::Cairo::Context>',`::Cairo::RefPtr<
::Cairo::Context>(new ::Cairo::Context($3, false /* take ref */))')
+ #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr< ::Cairo::Context>',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* take ref */))')
+ #m4 _CONVERSION(`cairo_t*',`::Cairo::RefPtr<const ::Cairo::Context>',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* take ref */))')
_WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Context> get_cairo_context(), gtk_print_context_get_cairo_context)
_WRAP_METHOD(::Cairo::RefPtr<const ::Cairo::Context> get_cairo_context() const,
gtk_print_context_get_cairo_context, constversion)
diff --git a/gtk/src/printjob.hg b/gtk/src/printjob.hg
index 9e51a2f..ccab5d3 100644
--- a/gtk/src/printjob.hg
+++ b/gtk/src/printjob.hg
@@ -60,8 +60,8 @@ public:
_WRAP_METHOD(PrintStatus get_status() const, gtk_print_job_get_status)
_WRAP_METHOD(void set_source_file(const std::string& filename), gtk_print_job_set_source_file, errthrow)
- #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new
Cairo::Surface($3, false /* take reference */))')
- #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const
Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new Cairo::Surface($3, false /* take reference */))')
+ #m4
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
Cairo::Surface($3, false /* take reference */))')
+ #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const
Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new Cairo::Surface($3, false /* take
reference */))')
_WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_print_job_get_surface, errthrow)
_WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_print_job_get_surface, errthrow)
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index a205c89..5f53f24 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -637,7 +637,7 @@ public:
*/
bool get_dest_row_at_pos(int drag_x, int drag_y, TreeModel::Path& path, TreeViewDropPosition& pos) const;
-#m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new
Cairo::Surface($3, true /* take reference */))')
+#m4
_CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::make_refptr_for_instance<Cairo::Surface>(new
Cairo::Surface($3, true /* take reference */))')
_WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> create_row_drag_icon(const TreeModel::Path& path) const,
gtk_tree_view_create_row_drag_icon)
/* Interactive search */
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index a502ace..4973f3d 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -599,7 +599,7 @@ dnl
_POP()
#m4end
-#m4 _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
+#m4 _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::make_refptr_for_instance<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
//TODO: no_default_handler is a temporary fix (rather workaround) for the
// problem with get_render_mode() in gtk+.
// Most widgets will be correctly drawn, even Gtk::DrawingArea since it now
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]