Re: Goocanvasmm



On Wed, 2008-02-20 at 22:45 +0100, Gennaro Bellizio wrote:
> 
> >----Messaggio originale----
> >Da: jonathon quotidian org
> >Data: 20/02/2008 16.54
> >A: "Gennaro Bellizio"<genbell tiscali it>
> >Cc: <gtkmm-list gnome org>
> >Ogg: Re: Goocanvasmm
> >
> 
> >I'm afraid I don't really understand exactly what the problem is.
> >Could you provide a small code example that shows the issue that
> >you're having?
> >
> >-- 
> >jonner
> >
> 
> Let's consider the coordinates example. When I run the application no 
> rectangle is displayed onto the canvas. 

Really?  It displays fine for me.

> -  Glib::RefPtr<Goocanvas::Item> root = m_canvas.get_root_item();
> -  m_rect = Goocanvas::Rect::create(10, 10, 60, 60);
> +  Glib::RefPtr<Goocanvas::ItemModel> root = Goocanvas::GroupModel::
> create() ;
> +  m_canvas->set_root_item_model(root) ;
> +  m_rect = Goocanvas::RectModel::create(10, 10, 60, 60);
>    root->add_child(m_rect);
>    m_rect->property_line_width().set_value(10.0);
>    m_rect->property_stroke_color().set_value("yellow");
> @@ -74,6 +75,7 @@
>           ", width=" << m_rect->property_width() << ",  height=" << 
> m_rect->property_height() << 
>           ", line_width=" << m_rect->property_line_width() << std::
> endl;
>  
> +  // No bounds are available now, so the following will not compile
>    Goocanvas::Bounds 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;
> 
> the rectangle is displayed but now its bounds aren't available because 
> the *Model classes do not provide the get_bounds() method. The same 
> happens for the Goocanvas::Ellipse instances.

Hmm, well as far as I can tell, the C *Model classes don't have any
concept of 'bounds' either.  It seems like bounds is only a view
property and not available via the model.  So I think you'll need a
Goocanvas::Rect class (not RectModel) in order to get or set the bounds
of an item.
-- 
Jonner



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