GNOME Bugzilla – Bug 412134
Add API to query style properties from the style
Last modified: 2008-11-01 04:15:30 UTC
Currently, if one needs to know the value of a style property for a widget class for which one does not have an instance (imagine you need to paint something in a canvas in the same colors used for even and odd rows in a tree view, for example) Aparently, apps that do this (firefox and openoffice, e.g., according to mclasen on irc) create a widget and query its style properties. Here comes a patch that adds: void gtk_style_get_property (GtkStyle *style, GType widget_type, const gchar *property_name, GValue *value); void gtk_style_get_valist (GtkStyle *style, GType widget_type, const gchar *first_property_name, va_list var_args); void gtk_style_get (GtkStyle *style, GType widget_type, const gchar *first_property_name, ...) G_GNUC_NULL_TERMINATED;
Created attachment 83356 [details] [review] Add gtk_style_get_property and friends
This patch looks good to me. It would be nice if someone more involved with GTK itself would take the time to mold this into the tree. It would be extremely helpful for those of us writing custom widgets or adapting different toolkits to the GTK look and feel. It's been 1.5 years since Mariano posted this patch. Some review would be great.
The idea has an essential flaw: theme engines do not simply look at style properties, they do look at whole hierarchies of widgets and their state. There's some great work going on towards a better theming interface these days, you should read on the gtk-devel mailing list about this or consult a web search engine. I don't think the proposal makes much sense at this point.
2008-11-01 Matthias Clasen <mclasen@redhat.com> Bug 412134 – Add API to query style properties from the style * gtk/gtk.symbols: * gtk/gtkstyle.[hc]: Add getters for style properties to avoid the need for ugly workarounds with dummy widget instances. Patch by Mariano Suárez-Alvarez