Fix background color from wxControl::GetDefaultAttributes() with GTK+3
The default background is not explicitly set on each widget, but is determined by a parent, usually the TLW. Fixes wxDC default background color for controls. See #18325
This commit is contained in:
parent
9a27ea5a2d
commit
b10c6ab3a8
@ -267,6 +267,18 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
attr.font = wxFont(info);
|
attr.font = wxFont(info);
|
||||||
gdk_rgba_free(fc);
|
gdk_rgba_free(fc);
|
||||||
gdk_rgba_free(bc);
|
gdk_rgba_free(bc);
|
||||||
|
|
||||||
|
// Go up the parent chain for a background color
|
||||||
|
while (attr.colBg.Alpha() == 0 && (widget = gtk_widget_get_parent(widget)))
|
||||||
|
{
|
||||||
|
sc = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_save(sc);
|
||||||
|
gtk_style_context_set_state(sc, stateFlag);
|
||||||
|
gtk_style_context_get(sc, stateFlag, "background-color", &bc, NULL);
|
||||||
|
gtk_style_context_restore(sc);
|
||||||
|
attr.colBg = wxColour(*bc);
|
||||||
|
gdk_rgba_free(bc);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
GtkStyle* style;
|
GtkStyle* style;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user