For rendering a custom widget I’ve used the above in GTK3 to retrieve e.g. the font to use from CSS. This allowed to keep the styling information out of the code. How would I do the same in GTK4? (I’ve also used gtk_style_context_set_{path,parent} but I think I can emulate that with gtk_widget_add_css_class() sufficiently well).
The purpose here is not to support external themes (I only care about Adwaita and HC) but rather to not have those things hardcoded in C.
Thanks for the answer but how does that apply to custom widgets where I want to retrieve the style properties to do custom rendering in the snapshot vfunc and therefore e.g. get the font via
I’ve read the documentation and I think I have some idea how to apply CSS to widgets in general. My question is how I can query e.g. the effective pango font description that applies to a widget in a hierarchy for custom rendering. Can you point me where the examples you refer to do this?
GtkInspector can do it but uses GtkCssNode which is private.