[goocanvasmm] C++11: Use of auto.



commit 18b44dbaff4345333f41b16f5895c3fb7bf7eddb
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Jul 29 14:04:06 2015 +0200

    C++11: Use of auto.

 examples/coordinates/window.cc           |    6 ++--
 examples/custom_item/exampleitem.cc      |    6 ++--
 examples/custom_item/examplewindow.cc    |    6 ++--
 examples/demo/primitives.cc              |   44 ++++++++++++++---------------
 examples/demo/window.cc                  |    4 +-
 examples/drag_to_canvas/examplewindow.cc |   16 +++++-----
 examples/moving_shapes/window.cc         |   16 +++++-----
 examples/simple/examplewindow.cc         |    8 +++---
 examples/table/examplewindow.cc          |    6 ++--
 examples/tablemodel/examplewindow.cc     |   10 +++---
 examples/text/window.cc                  |    6 ++--
 goocanvas/src/item.ccg                   |   14 +++++-----
 tests/child_properties/main.cc           |    4 +-
 13 files changed, 72 insertions(+), 74 deletions(-)
---
diff --git a/examples/coordinates/window.cc b/examples/coordinates/window.cc
index bec4856..8f2c12c 100644
--- a/examples/coordinates/window.cc
+++ b/examples/coordinates/window.cc
@@ -34,7 +34,7 @@ ExampleWindow::ExampleWindow()
   m_canvas.set_size_request(640, 480);
   m_canvas.set_bounds(0, 0, 1000, 1000);
 
-  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
+  auto root = m_canvas.get_root_item();
   m_rect = Goocanvas::Rect::create(10, 10, 60, 60);
   root->add_child(m_rect);
 #ifdef GLIBMM_PROPERTIES_ENABLED
@@ -48,7 +48,7 @@ ExampleWindow::ExampleWindow()
 #endif
 
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   m_box.pack_start(*sw);
 
@@ -84,7 +84,7 @@ void ExampleWindow::update_label()
   //TODO.
 #endif
 
-  Goocanvas::Bounds bounds = m_rect->get_bounds();
+  auto bounds = m_rect->get_bounds();
   str << "Item bounds: x1=" << bounds.get_x1() << ", y1=" << bounds.get_y1() << ", x2=" << bounds.get_x2() 
<< ", y2=" << bounds.get_y2() << std::endl;
 
   
diff --git a/examples/custom_item/exampleitem.cc b/examples/custom_item/exampleitem.cc
index 031d8c7..e13a4bd 100644
--- a/examples/custom_item/exampleitem.cc
+++ b/examples/custom_item/exampleitem.cc
@@ -36,7 +36,7 @@ void ExampleItem::simple_update_vfunc(const Cairo::RefPtr<Cairo::Context>& cr)
 {
   Goocanvas::ItemSimple::simple_update_vfunc(cr);
 
-  GooCanvasItemSimple* simple = GOO_CANVAS_ITEM_SIMPLE(gobj());
+  auto simple = GOO_CANVAS_ITEM_SIMPLE(gobj());
   if(simple)
   {
     /* Compute the new bounds. */
@@ -61,10 +61,10 @@ void ExampleItem::simple_paint_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, co
   cr->line_to(m_x + m_width, m_y);
   cr->close_path();
 
-  GooCanvasItemSimple* simple = GOO_CANVAS_ITEM_SIMPLE(gobj());
+  auto simple = GOO_CANVAS_ITEM_SIMPLE(gobj());
   if(simple && simple->simple_data)
   {
-    Glib::RefPtr<Goocanvas::Style> style = Glib::wrap(simple->simple_data->style, true /* take_copy */);
+    auto style = Glib::wrap(simple->simple_data->style, true /* take_copy */);
     if(style)
       style->set_fill_options(cr);
   }
diff --git a/examples/custom_item/examplewindow.cc b/examples/custom_item/examplewindow.cc
index 78bd37b..8764ab0 100644
--- a/examples/custom_item/examplewindow.cc
+++ b/examples/custom_item/examplewindow.cc
@@ -27,7 +27,7 @@ ExampleWindow::ExampleWindow()
   m_canvas.set_bounds(0, 0, 1000, 1000);
 
 
-  Glib::RefPtr<ExampleItem> item = ExampleItem::create(100, 100, 400, 400);
+  auto item = ExampleItem::create(100, 100, 400, 400);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   item->property_line_width() = 10.0;
   item->property_stroke_color() = "yellow";
@@ -38,10 +38,10 @@ ExampleWindow::ExampleWindow()
   item->set_property("fill_color", Glib::ustring("red"));
 #endif
 
-  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
+  auto root = m_canvas.get_root_item();
   root->add_child(item);
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   add(*sw);
 
diff --git a/examples/demo/primitives.cc b/examples/demo/primitives.cc
index d447acd..30bc793 100644
--- a/examples/demo/primitives.cc
+++ b/examples/demo/primitives.cc
@@ -26,7 +26,7 @@ Primitives::Primitives()
 {
   _vbox = Gtk::manage(new Gtk::VBox());
 
-  Gtk::Label* lbl = Gtk::manage(new Gtk::Label("Drag an item with button 1. Click button 2 on an item to 
lower it, or button 3 to raise it."));
+  auto lbl = Gtk::manage(new Gtk::Label("Drag an item with button 1. Click button 2 on an item to lower it, 
or button 3 to raise it."));
   _vbox->pack_start(*lbl, Gtk::PACK_SHRINK);
 
 
@@ -98,7 +98,7 @@ Primitives::_setup_heading(const Glib::ustring& heading, int pos)
   double x = (pos%3) * 200 + 100 ;
   double y = (pos/3) * 150 + 5 ;
 
-  Glib::RefPtr<Goocanvas::Text> text = Goocanvas::Text::create(heading, x, y, -1, Goocanvas::ANCHOR_N);
+  auto text = Goocanvas::Text::create(heading, x, y, -1, Goocanvas::ANCHOR_N);
   _canvas->get_root_item()->add_child(text);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   text->property_font() = "Sans 12" ;
@@ -112,7 +112,7 @@ Primitives::_setup_heading(const Glib::ustring& heading, int pos)
 void
 Primitives::_setup_divisions()
 {
-  Glib::RefPtr<Goocanvas::Group> group = Goocanvas::Group::create();
+  auto group = Goocanvas::Group::create();
   _canvas->get_root_item()->add_child(group);
   group->translate(2, 2);
 
@@ -173,7 +173,7 @@ void
 Primitives::_setup_rectangles()
 {
   Glib::RefPtr<Goocanvas::Rect> rect ;
-  Glib::RefPtr<Goocanvas::Item> root = _canvas->get_root_item();
+  auto root = _canvas->get_root_item();
 
   rect = Goocanvas::Rect::create(20, 30, 50, 30);
   root->add_child(rect);
@@ -189,7 +189,7 @@ Primitives::_setup_rectangles()
   rect = Goocanvas::Rect::create(90, 40, 90, 60);
   root->add_child(rect);
   //rect->property_fill_pattern() = _create_stipple("mediumseagreen");
-  Cairo::RefPtr<Cairo::Pattern> p = _create_stipple("mediumseagreen");
+  auto p = _create_stipple("mediumseagreen");
   g_object_set(rect->gobj(), "fill-pattern", p->cobj(), (void*)0);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   rect->property_stroke_color() = "black" ;
@@ -251,7 +251,7 @@ void
 Primitives::_setup_ellipses()
 {
   Glib::RefPtr<Goocanvas::Ellipse> ellipse ;
-  Glib::RefPtr<Goocanvas::Item> root = _canvas->get_root_item();
+  auto root = _canvas->get_root_item();
 
   ellipse = Goocanvas::Ellipse::create(245, 45, 25, 15);
   root->add_child(ellipse);
@@ -282,7 +282,7 @@ Primitives::_setup_ellipses()
   ellipse = Goocanvas::Ellipse::create(245, 110, 35, 30);
   root->add_child(ellipse);
   //ellipse->property_fill_pattern() = _create_stipple("cadetblue");
-  Cairo::RefPtr<Cairo::Pattern> p = _create_stipple("cadetblue");
+  auto p = _create_stipple("cadetblue");
   g_object_set(ellipse->gobj(), "fill-pattern", p->cobj(), (void*)0);
 
 #ifdef GLIBMM_PROPERTIES_ENABLED
@@ -305,7 +305,7 @@ Primitives::_setup_texts()
   anchor->add_child(text);
 
   //ellipse->property_fill_pattern() = _create_stipple("blue");
-  Cairo::RefPtr<Cairo::Pattern> p = _create_stipple("blue");
+  auto p = _create_stipple("blue");
   g_object_set(text->gobj(), "fill-pattern", p->cobj(), (void*)0);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   text->property_font() = "Sans Bold 24" ;
@@ -385,7 +385,7 @@ Primitives::_setup_images()
   double w = pb->get_width();
   double h = pb->get_height();
 
-  Glib::RefPtr<Goocanvas::Image> img = Goocanvas::Image::create(pb, 100.0 - w / 2.0, 225.0 - h / 2.0);
+  auto img = Goocanvas::Image::create(pb, 100.0 - w / 2.0, 225.0 - h / 2.0);
   _canvas->get_root_item()->add_child(img);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   img->property_width() = w ;
@@ -409,10 +409,10 @@ Primitives::_setup_lines()
   _create_hilbert();
 
   Glib::RefPtr<Goocanvas::Polyline> line ;
-  Glib::RefPtr<Goocanvas::Item> root = _canvas->get_root_item();
+  auto root = _canvas->get_root_item();
 
 /*
-  Glib::RefPtr<Goocanvas::Points> points = Goocanvas::Points::create(4);
+  auto points = Goocanvas::Points::create(4);
   points->set_coordinate(0, 340, 170);
   points->set_coordinate(1, 340, 230);
   points->set_coordinate(2, 390, 230);
@@ -479,8 +479,8 @@ Primitives::_create_stipple(const Glib::ustring& color)
   data[1] = data[13] = c.get_green() << 8 ;
   data[0] = data[12] = c.get_blue() << 8 ;
 
-  Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(data, Cairo::FORMAT_ARGB32, 2, 2, 
8);
-  Cairo::RefPtr<Cairo::SurfacePattern> pattern = Cairo::SurfacePattern::create(surface);
+  auto surface = Cairo::ImageSurface::create(data, Cairo::FORMAT_ARGB32, 2, 2, 8);
+  auto pattern = Cairo::SurfacePattern::create(surface);
   pattern->set_extend(Cairo::EXTEND_REPEAT);
   return pattern ;
 }
@@ -490,13 +490,13 @@ Primitives::_create_anchor(double x, double y)
 {
   cairo_matrix_t m = { 0.8, 0.2, -0.3, 0.5, x, y };
 
-  Glib::RefPtr<Goocanvas::Group> group = Goocanvas::Group::create();
+  auto group = Goocanvas::Group::create();
   _canvas->get_root_item()->add_child(group);
   group->translate(x, y);
   //group->property_transform() = &m ;
   g_object_set(group->gobj(), "transform", &m, (void*)0);
 
-  Glib::RefPtr<Goocanvas::Rect> rect = Goocanvas::Rect::create(-2.5, -2.5, 4, 4);
+  auto rect = Goocanvas::Rect::create(-2.5, -2.5, 4, 4);
   group->add_child(rect);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   rect->property_line_width() = 1.0 ;
@@ -526,12 +526,12 @@ Primitives::_create_flower(double x, double y, Goocanvas::AnchorType /* anchor *
     return ;
   }
 
-  const double w = surface->get_width();
-  const double h = surface->get_height();
+  const auto w = surface->get_width();
+  const auto h = surface->get_height();
 
-  Cairo::RefPtr<Cairo::SurfacePattern> pattern = Cairo::SurfacePattern::create(surface);
+  auto pattern = Cairo::SurfacePattern::create(surface);
 
-  Glib::RefPtr<Goocanvas::Image> img = Goocanvas::Image::create(x, y);
+  auto img = Goocanvas::Image::create(x, y);
    _canvas->get_root_item()->add_child(img);
   //TODO: img->property_pattern() = pattern ;
   g_object_set(img->gobj(), "pattern", pattern->cobj(), (void*)0);
@@ -548,12 +548,10 @@ Primitives::_create_flower(double x, double y, Goocanvas::AnchorType /* anchor *
 void
 Primitives::_create_polish_diamond()
 {
-  Glib::RefPtr<Goocanvas::Group> group = Goocanvas::Group::create();
+  auto group = Goocanvas::Group::create();
   _canvas->get_root_item()->add_child(group); 
   group->translate(270, 230);
 
-  Glib::RefPtr<Goocanvas::Polyline> line ;
-
   double vertices = 10.0 ;
   double radius = 60.0 ;
 
@@ -569,7 +567,7 @@ Primitives::_create_polish_diamond()
       double x2 = radius * cos(a);
       double y2 = radius * sin(a);
 
-      line = Goocanvas::Polyline::create(x1, y1, x2, y2);
+      auto line = Goocanvas::Polyline::create(x1, y1, x2, y2);
       group->add_child(line);
     }
   }
diff --git a/examples/demo/window.cc b/examples/demo/window.cc
index 4be0c8c..db113f6 100644
--- a/examples/demo/window.cc
+++ b/examples/demo/window.cc
@@ -26,12 +26,12 @@ DemoWindow::DemoWindow()
   _pages.push_back(new Primitives());
 
 
-  Gtk::Notebook* nb = Gtk::manage(new Gtk::Notebook());
+  auto nb = Gtk::manage(new Gtk::Notebook());
 
   std::vector< Page* >::iterator iter ;
   for(iter = _pages.begin(); iter != _pages.end(); iter++)
   {
-    Page* p = *iter ;
+    auto p = *iter ;
     nb->append_page(*(p->getWidget()), p->getName());
   }
 
diff --git a/examples/drag_to_canvas/examplewindow.cc b/examples/drag_to_canvas/examplewindow.cc
index f696dad..7e380d3 100644
--- a/examples/drag_to_canvas/examplewindow.cc
+++ b/examples/drag_to_canvas/examplewindow.cc
@@ -43,7 +43,7 @@ ExampleWindow::ExampleWindow()
   m_canvas.set_bounds(0, 0, 1000, 1000);
 
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   m_vbox.pack_start(*sw);
 
@@ -88,7 +88,7 @@ void ExampleWindow::make_widget_draggable(Gtk::Widget& widget, DragItem drag_ite
 bool ExampleWindow::on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& drag_context, int /* x */, int 
/* y */, guint timestamp)
 {
   std::cout << "ExampleWindow::on_canvas_drag_drop" << std::endl;
-  Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
+  auto target = m_canvas.drag_dest_find_target(drag_context);
   if(target.empty())
     return false;
 
@@ -103,7 +103,7 @@ bool ExampleWindow::on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& dr
 bool ExampleWindow::on_canvas_drag_motion(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, 
guint timestamp)
 {
   std::cout << "ExampleWindow::on_canvas_drag_motion" << std::endl;
-  Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
+  auto target = m_canvas.drag_dest_find_target(drag_context);
   if(target.empty())
     return false;
 
@@ -144,7 +144,7 @@ ExampleWindow::DragItem ExampleWindow::get_drag_item_from_selection_data(const G
   DragItem item_type = DRAG_ITEM_NONE;
   if((selection_data.get_length() >= 0) && (selection_data.get_format() == DRAG_DATA_FORMAT))
   {
-    const guint8* data = selection_data.get_data();
+    const auto data = selection_data.get_data();
     if(data)
       item_type = (DragItem)(data[0]);
   }
@@ -160,7 +160,7 @@ void ExampleWindow::on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragCon
   //or after our drag_motion handler has called drag_get_data()): 
   
   //Discover what toolbar item was dragged:
-  const DragItem drag_item = get_drag_item_from_selection_data(selection_data);
+  const auto drag_item = get_drag_item_from_selection_data(selection_data);
 
 
   //Create the temporary drag item if necessary:
@@ -206,7 +206,7 @@ Glib::RefPtr<Goocanvas::Item> ExampleWindow::create_canvas_item(DragItem drag_it
 
   if(drag_item == DRAG_ITEM_RECTANGLE)
   {
-    Glib::RefPtr<Goocanvas::Rect> rect = Goocanvas::Rect::create(0, 0, 20, 20);
+    auto rect = Goocanvas::Rect::create(0, 0, 20, 20);
 #ifdef GLIBMM_PROPERTIES_ENABLED
     rect->property_line_width() = 10.0;
     rect->property_stroke_color() = "yellow";
@@ -220,7 +220,7 @@ Glib::RefPtr<Goocanvas::Item> ExampleWindow::create_canvas_item(DragItem drag_it
   }
   else if(drag_item == DRAG_ITEM_ELLIPSE)
   {
-    Glib::RefPtr<Goocanvas::Ellipse> ellipse = Goocanvas::Ellipse::create();
+    auto ellipse = Goocanvas::Ellipse::create();
 #ifdef GLIBMM_PROPERTIES_ENABLED
     ellipse->property_line_width() = 10.0;
     ellipse->property_radius_x() = 20.0;
@@ -239,7 +239,7 @@ Glib::RefPtr<Goocanvas::Item> ExampleWindow::create_canvas_item(DragItem drag_it
 
   if(result)
   {
-    Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
+    auto root = m_canvas.get_root_item();
     root->add_child(result);
 
     //Show it on the canvas, at the position:
diff --git a/examples/moving_shapes/window.cc b/examples/moving_shapes/window.cc
index 194dfe4..109dd55 100644
--- a/examples/moving_shapes/window.cc
+++ b/examples/moving_shapes/window.cc
@@ -26,10 +26,10 @@ Window::Window()
 
   _canvas = Gtk::manage(new Goocanvas::Canvas());
   _canvas->signal_item_created().connect(sigc::mem_fun(*this, &Window::on_item_created));
-  Glib::RefPtr<Goocanvas::ItemModel> root = Goocanvas::GroupModel::create();
+  auto root = Goocanvas::GroupModel::create();
   _canvas->set_root_item_model(root);
 
-  Glib::RefPtr<Goocanvas::RectModel> rect = Goocanvas::RectModel::create(200, 200, 100, 100);
+  auto rect = Goocanvas::RectModel::create(200, 200, 100, 100);
         root->add_child(rect);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   rect->property_line_width() = 3;
@@ -45,7 +45,7 @@ Window::Window()
   rect->set_property("fill_color", Glib::ustring("blue"));
 #endif //GLIBMM_PROPERTIES_ENABLED
 
-  Glib::RefPtr<Goocanvas::EllipseModel> ellipse = Goocanvas::EllipseModel::create(400, 200, 100, 50);
+  auto ellipse = Goocanvas::EllipseModel::create(400, 200, 100, 50);
         root->add_child(ellipse);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   ellipse->property_line_width() = 3;
@@ -57,7 +57,7 @@ Window::Window()
   ellipse->set_property("fill_color", Glib::ustring("wheat"));
 #endif //GLIBMM_PROPERTIES_ENABLED
 
-  Glib::RefPtr<Goocanvas::PolylineModel> polyline = Goocanvas::PolylineModel::create(250, 250, 450, 225);
+  auto polyline = Goocanvas::PolylineModel::create(250, 250, 450, 225);
         root->add_child(polyline);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   polyline->property_line_width() = 4;
@@ -65,7 +65,7 @@ Window::Window()
   polyline->set_property("line_width", 4);
 #endif //GLIBMM_PROPERTIES_ENABLED
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(*_canvas);
   add(*sw);
 
@@ -75,7 +75,7 @@ Window::Window()
 void
 Window::on_item_created(const Glib::RefPtr<Goocanvas::Item>& item, const Glib::RefPtr<Goocanvas::ItemModel>& 
/* model */)
 {
-  Glib::RefPtr<Goocanvas::Group> group = Glib::RefPtr<Goocanvas::Group>::cast_dynamic(item);
+  auto group = Glib::RefPtr<Goocanvas::Group>::cast_dynamic(item);
   if(group)
     return ;
 
@@ -111,8 +111,8 @@ Window::on_item_motion_notify_event(const Glib::RefPtr<Goocanvas::Item>& item, G
 {
   if(item && _dragging && item == _dragging)
   {
-    double new_x = event->x ;
-    double new_y = event->y ;
+    auto new_x = event->x ;
+    auto new_y = event->y ;
     item->translate(new_x - _drag_x, new_y - _drag_y);
   }
   return false;
diff --git a/examples/simple/examplewindow.cc b/examples/simple/examplewindow.cc
index 01dfa6b..df745db 100644
--- a/examples/simple/examplewindow.cc
+++ b/examples/simple/examplewindow.cc
@@ -26,8 +26,8 @@ ExampleWindow::ExampleWindow()
   m_canvas.set_size_request(640, 480);
   m_canvas.set_bounds(0, 0, 1000, 1000);
 
-  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
-  Glib::RefPtr<Goocanvas::Rect> rect = Goocanvas::Rect::create(100, 100, 400, 400);
+  auto root = m_canvas.get_root_item();
+  auto rect = Goocanvas::Rect::create(100, 100, 400, 400);
   root->add_child(rect);
 
 #ifdef GLIBMM_PROPERTIES_ENABLED
@@ -46,7 +46,7 @@ ExampleWindow::ExampleWindow()
   rect->signal_button_press_event ().connect (sigc::mem_fun (this,
     &ExampleWindow::on_rect_button_press));
 
-  Glib::RefPtr<Goocanvas::Text> text = Goocanvas::Text::create("Hello World", 300, 300, -1, 
Goocanvas::ANCHOR_CENTER);
+  auto text = Goocanvas::Text::create("Hello World", 300, 300, -1, Goocanvas::ANCHOR_CENTER);
   root->add_child(text);
 #ifdef GLIBMM_PROPERTIES_ENABLED
   text->property_font() = "Sans 24";
@@ -55,7 +55,7 @@ ExampleWindow::ExampleWindow()
 #endif //GLIBMM_PROPERTIES_ENABLED
   text->rotate(45, 300, 300);
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   add(*sw);
 
diff --git a/examples/table/examplewindow.cc b/examples/table/examplewindow.cc
index ce2bae5..78b5f4b 100644
--- a/examples/table/examplewindow.cc
+++ b/examples/table/examplewindow.cc
@@ -27,7 +27,7 @@ ExampleWindow::ExampleWindow()
   m_canvas.set_size_request(640, 480);
   m_canvas.set_bounds(0, 0, 1000, 1000);
 
-  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
+  auto root = m_canvas.get_root_item();
 
   m_table = Goocanvas::Table::create();
   //m_table->property_x() = 10;
@@ -53,7 +53,7 @@ ExampleWindow::ExampleWindow()
   add_text_to_cell(m_table, "bottom right", 1, 1);
 
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   add(*sw);
 
@@ -62,7 +62,7 @@ ExampleWindow::ExampleWindow()
 
 void ExampleWindow::add_text_to_cell(const Glib::RefPtr<Goocanvas::Table>& table, const Glib::ustring& text, 
guint row, guint col)
 {
-  Glib::RefPtr<Goocanvas::Text> text_item = Goocanvas::Text::create(text);
+  auto text_item = Goocanvas::Text::create(text);
   table->attach(text_item, col, col+1, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
 }
 
diff --git a/examples/tablemodel/examplewindow.cc b/examples/tablemodel/examplewindow.cc
index a274df3..9e51735 100644
--- a/examples/tablemodel/examplewindow.cc
+++ b/examples/tablemodel/examplewindow.cc
@@ -30,7 +30,7 @@ ExampleWindow::ExampleWindow()
   m_second_canvas.set_size_request(640, 240);
   m_second_canvas.set_bounds(0, 0, 500, 500);
 
-  Glib::RefPtr<Goocanvas::ItemModel> root = Goocanvas::GroupModel::create();
+  auto root = Goocanvas::GroupModel::create();
   m_first_canvas.set_root_item_model(root);
   m_second_canvas.set_root_item_model(root);
 
@@ -58,12 +58,12 @@ ExampleWindow::ExampleWindow()
   add_text_to_cell(m_table, "bottom right", 1, 1);
 
 
-  Gtk::ScrolledWindow* sw1 = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw1 = Gtk::manage(new Gtk::ScrolledWindow());
   sw1->add(m_first_canvas);
-  Gtk::ScrolledWindow* sw2 = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw2 = Gtk::manage(new Gtk::ScrolledWindow());
   sw2->add(m_second_canvas);
 
-  Gtk::VBox* box = Gtk::manage(new Gtk::VBox(false, 6));
+  auto box = Gtk::manage(new Gtk::VBox(false, 6));
   box->pack_start(*sw1, Gtk::PACK_EXPAND_WIDGET);
   box->pack_start(*sw2, Gtk::PACK_EXPAND_WIDGET);
   add(*box);
@@ -73,7 +73,7 @@ ExampleWindow::ExampleWindow()
 
 void ExampleWindow::add_text_to_cell(const Glib::RefPtr<Goocanvas::TableModel>& table, const Glib::ustring& 
text, guint row, guint col)
 {
-  Glib::RefPtr<Goocanvas::TextModel> text_item = Goocanvas::TextModel::create(text);
+  auto text_item = Goocanvas::TextModel::create(text);
   table->attach(text_item, col, col+1, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
 }
 
diff --git a/examples/text/window.cc b/examples/text/window.cc
index e864077..2496481 100644
--- a/examples/text/window.cc
+++ b/examples/text/window.cc
@@ -43,7 +43,7 @@ ExampleWindow::ExampleWindow()
 #endif 
   m_canvas.set_bounds(0, 0, 210, 297);
 
-  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
+  auto root = m_canvas.get_root_item();
   m_text = Goocanvas::Text::create("some text");
   root->add_child(m_text);
 #ifdef GLIBMM_PROPERTIES_ENABLED
@@ -59,7 +59,7 @@ ExampleWindow::ExampleWindow()
 #endif
 
 
-  Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow());
+  auto sw = Gtk::manage(new Gtk::ScrolledWindow());
   sw->add(m_canvas);
   m_box.pack_start(*sw);
 
@@ -107,7 +107,7 @@ void ExampleWindow::update_label()
   //TODO:
 #endif
 
-  Goocanvas::Bounds bounds = m_text->get_bounds();
+  auto bounds = m_text->get_bounds();
   str << "Item bounds: x1=" << bounds.get_x1() << ", y1=" << bounds.get_y1() << ", x2=" << bounds.get_x2() 
<< ", y2=" << bounds.get_y2() << std::endl;
 
   
diff --git a/goocanvas/src/item.ccg b/goocanvas/src/item.ccg
index ec06767..5678220 100644
--- a/goocanvas/src/item.ccg
+++ b/goocanvas/src/item.ccg
@@ -50,7 +50,7 @@ void Item::add_child(const Glib::RefPtr<Item>& child)
 // make a copy.
 void Item_Class::get_bounds_vfunc_callback(GooCanvasItem* item, GooCanvasBounds* bounds)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  const auto obj = dynamic_cast<CppObjectType*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)item));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -78,7 +78,7 @@ void Item_Class::get_bounds_vfunc_callback(GooCanvasItem* item, GooCanvasBounds*
   }
   else
   {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+    const auto base = static_cast<BaseClassType*>(
         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying 
C interface).
 g_type_interface_peek(G_OBJECT_GET_CLASS(item), CppObjectType::get_type()) // Get the interface.
 )    );
@@ -93,7 +93,7 @@ void Item::get_bounds_vfunc(Bounds& bounds) const
 {
   //Call the default C implementation:
 
-  BaseClassType *const base = static_cast<BaseClassType*>(
+  const auto base = static_cast<BaseClassType*>(
     g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C 
interface).
       g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
     )
@@ -111,7 +111,7 @@ void Item::get_bounds_vfunc(Bounds& bounds) const
 // free the one passed in.
 GList* Item_Class::get_items_at_vfunc_callback(GooCanvasItem* self, gdouble x, gdouble y, cairo_t* cr, 
gboolean is_pointer_event, gboolean parent_is_visible, GList* found_items)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  const auto obj = dynamic_cast<CppObjectType*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -128,7 +128,7 @@ GList* Item_Class::get_items_at_vfunc_callback(GooCanvasItem* self, gdouble x, g
       // Call the virtual member method, which derived classes might override.
       Bounds cpp_bounds;
       
-      const std::vector<Glib::RefPtr<Item> > vec_found_items = 
+      const auto vec_found_items = 
         Glib::ListHandler<Glib::RefPtr<Item> >::list_to_vector(found_items, Glib::OWNERSHIP_NONE);
       std::vector<Glib::RefPtr<Item> > retval(obj->get_items_at_vfunc(x, y, 
Cairo::RefPtr<Cairo::Context>(new Cairo::Context(cr, false /* has_reference */)), is_pointer_event == TRUE, 
parent_is_visible == TRUE, vec_found_items));
       // retval will free the list on destruction, and we can't change the
@@ -144,7 +144,7 @@ GList* Item_Class::get_items_at_vfunc_callback(GooCanvasItem* self, gdouble x, g
   }
   else
   {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+    const auto base = static_cast<BaseClassType*>(
         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying 
C interface).
 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
 )    );
@@ -161,7 +161,7 @@ std::vector<Glib::RefPtr<Item> > Item::get_items_at_vfunc(double x, double y, co
 {
   //Call the default C implementation:
 
-  BaseClassType *const base = static_cast<BaseClassType*>(
+  const auto base = static_cast<BaseClassType*>(
     g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C 
interface).
       g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
     )
diff --git a/tests/child_properties/main.cc b/tests/child_properties/main.cc
index 159a689..45d7a5c 100644
--- a/tests/child_properties/main.cc
+++ b/tests/child_properties/main.cc
@@ -25,10 +25,10 @@ main(int argc, char* argv[])
   Gtk::Main app(&argc, &argv);
   Goocanvas::init();
 
-  Glib::RefPtr<Goocanvas::Table> table = Goocanvas::Table::create();
+  auto table = Goocanvas::Table::create();
 
   //Add a child to the table:
-  Glib::RefPtr<Goocanvas::Text> child = Goocanvas::Text::create("test");
+  auto child = Goocanvas::Text::create("test");
   table->attach(child, 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
 
   //Examine the child property:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]