I want to have a goocanvas with a rect item which contains a text.
How to build a group with a rect to add the text as a child is known. But I want to know the size of the text to give the box ( rect ) enough space to display the complete text.
txt->property_width()
delivers 0! :-(
Glib::RefPtr<Goocanvas::Text> txt = Goocanvas::Text::create( "W123", 0, 0 );
Goocanvas::Bounds b = txt->get_bounds();
cout << b.get_x1() << endl;
cout << b.get_x2() << endl;
cout << b.get_y1() << endl;
cout << b.get_y2() << endl;
All values are zero!
Wow! If I change the code to:
Glib::RefPtr<Goocanvas::Text> txt = Goocanvas::Text::create( "W123", 0, 0 );
Goocanvas::Bounds b = txt->get_bounds();
GooCanvasBounds bounds;
goo_canvas_item_get_bounds (( GooCanvasItem*)txt->gobj(), &bounds);
cout << b.get_x1() << endl;
cout << b.get_x2() << endl;
cout << b.get_y1() << endl;
cout << b.get_y2() << endl;
The output is as expected! Attention: I look not at the bounds var! I still look for 'b'. Looks strange!
[Edit] I wrote a bug report: https://bugzilla.gnome.org/show_bug.cgi?id=721627