Something like this is one way:
GdkRGBA text_color = { 0.0, 0.0, 0.0, 1.0 }; /* Fallback to black */
gtk_style_context_lookup_color (gtk_widget_get_style_context (widget),
"theme_text_color", &text_color);
which is roughly equivalent of the legacy way of getting this:
gtk_widget_get_style (widget)->text[GTK_STATE_NORMAL]
You could maybe use that for gtk2 if wx still cares about (is somewhat
mapped into gtk3 too with heavy deprecation warnings). I thought it
already does, though.
It's hard to map any of this to wxSystemColour though. I vaguely recall
trying it in the past.
MR> However custom controls within wxGTK should be doing things
different.
MR> Apply CSS classes as appropriate on the components of the control,
MR> define some custom CSS if needed (e.g. if it isn't purely a
composition
MR> of widgets which you might just want to show together through
applying
MR> a "linked" CSS class name where appropriate) and have the whole
MR> machinery do everything for you. In those cases these names aren't
MR> used, but rather the generated full CSS will apply to them, with
what
MR> you'd know more in the web.
MR> And then you get all that rendered with OpenGL quickly with GTK 4.
This is undoubtedly great for GTK 4 applications (until you need to
rewrite them using GTK 5 API, anyhow), but is not very compatible with
the
existing wx API. It would be nice if could add some new API to make
using
theme colours easier at wx level, but I'm still not sure how to do
it...
I meant if you need a custom implementation for something like
wxDatePickerCtrl, wxDataViewCtrl, wxSearchCtrl or some such, then those
could be implemented as a "native" gtk control with appropriate styling
applied, so it would all be themed as appropriate more or less
automatically, instead of picking colors through the API discussed here
and using them directly.
Like all well-written native gtk apps would do their custom widget
needs.
But yeah, can't really have all consumers of wx write a native GUI
toolkit version of controls and wrap it in a common API just for their
own use, and then these colors can come in handy.
Mart