RE: [gnomemm] custom canvas item
- From: Murray Cumming Comneon com
- To: Marcus Brinkmann ruhr-uni-bochum de, gnomemm-list gnome org
- Subject: RE: [gnomemm] custom canvas item
- Date: Fri, 14 Mar 2003 08:36:28 +0100
> From: Marcus Brinkmann [mailto:Marcus Brinkmann ruhr-uni-bochum de]
> It would be nice to have a
> Gnome::Canvas::Item (Gnome::Canvas::Group &parentx)
> constructor that does the above wrapping of the C object in
> an opaque way.
If that would help then please do submit a patch. It could be applied in an
unstable API branch for the future.
> Now, I thought that to make my item behave like the other
> items, it would be nice to use the property system. However,
> adding the property proxies doesn't appear to be enough,
> because the underlying gobject doesn't know anything about
> the properties:
>
> class AudioFileItem
> {
> ...
>
> public:
> Glib::PropertyProxy<Glib::ustring> property_fill_color ();
> };
>
> Glib::PropertyProxy<Glib::ustring>
> AudioFileItem::property_fill_color()
> {
> return Glib::PropertyProxy<Glib::ustring> (this, "fill_color"); }
>
> This results in a run-time warning:
>
> (main:2738): GLib-GObject-WARNING **: gobject.c:1032: object
> class tkmm__GnomeCanvasItem' has no property named ill_color'
Glib::PropertyProxy is for wrapping pre-existing GTK+ properties. You
probably need to use the C API to add properties.
> It would be nice to have a somewhat automatic way to register
> a new object class and register its properties.
OK. Please add a bug glibmm 2.4 bug about that. Any suggestions for API
would be useful, after you have looked at the C API.
> However, I
> wouldn't mind a manual way to do that, too. I am quite a
> Glib/Gdk/Gtk/Gnome newbie, so if you have an example or a
> suggestion how to do that, I would appreciate it.
You should look at some of the _init functions in GTK+ or libgnomecanvas, I
suppose.
> I also found a bug, but I am not sure if I didn't something
> wrong. If in the above class I would change the order and
> first list the canvas item, then the audiofile, and the
> audiofile constructor throws an exception, then the
> application crashes in the Item destructor:
>
> (main:2772): GnomeCanvas-CRITICAL **: file gnome-canvas.c: line 3721
> (gnome_canvas_request_redraw): assertion NOME_IS_CANVAS
> (canvas)' failed
>
> #0 0x406a0add in gnome_canvas_item_construct () from
> /usr/lib/libgnomecanvas-2.so.0 #1 0x40af0429 in
> g_object_class_list_properties () from
> /usr/lib/libgobject-2.0.so.0 #2 0x4038eb43 in
> Gtk::Object::_destroy_c_instance() () from
> /usr/lib/libgtkmm-2.0.so.1 #3 0x4038ee0a in
> Gtk::Object::destroy_() () from /usr/lib/libgtkmm-2.0.so.1 #4
> 0x400b17d1 in Gnome::Canvas::Item::~Item() () from
> /usr/lib/libgnomecanvasmm-2.0.so.1
>
> I don't have debugging symbols installed, but I can probably
> make a small test case if useful.
Yes, please. We like small simple-as-possible test cases.
Murray Cumming
murrayc usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]