How to obtain a specific property from GtkStyle?
I want to obtain the "base" property from a gtkstyle, which is a GdkColor type, but I just can manage to get it. I know I can use gtk_style_get_style_property()
void gtk_style_get_style_property (GtkStyle *style,GType widget_type, const gchar *pr开发者_如何学运维operty_name, GValue *value);
but what am I supposed to put in "widget_type" and how a can get a gdkcolor type from "value"?
You must pass the GType of a widget class (e.g. GTK_TYPE_LABEL
, GTK_TYPE_BUTTON
, etc.) in widget_type
.
To get a GdkColor from a GValue, call g_value_get_boxed():
GdkColor *color = (GdkColor *) g_value_get_boxed(value);
精彩评论