Re: Wrapping style properties.



I investigated this problem with unability to get Gtk::Border as a
style property. I hope I got it right and my explanation is not messy.

When trying to get a style property via
Gtk::Widget::get_style_property() Glib::Value<> is involved. For boxed
types like Gdk::Color it works - internally Glib::Value<Gdk::Color>
does not use Glib::Value generic template, but a specialization, that
is - Glib::Value_Boxed. So, when calling
Glib::Value<Gdk::Color>::value_type() gdk_color_get_type() function is
called, so in effect copying from GValue taken from widget's style
property to GValue taken from Glib::Value ends with success, because
both holds the same GType.

The above fails to Gtk::Border - instead of using Glib::Value_Boxed
specialization it uses generic template, which creates new GType and
type name when calling Glib::Value<Gtk::Border>::value_type(). In the
end Gtk warns about unability to copy between 'GtkBorder' and
'glibmm__CustomBoxed_10_GtkBorder', because it does not know how to
make transformation from former to latter type.

Root of this problem is that Gtk::Border, unlike Gdk::Color, is just a
typedef, not a separate class wrapping a boxed type GtkBorder. The
solution would be just wrapping it with _CLASS_BOXEDTYPE, but that
will break ABI.

I'll file a bug in bugzilla.

Krzesimir.


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