avoid gtk_style_context_get_*color(), deprecated in GTK+ 3.16
This commit is contained in:
parent
026659297b
commit
2fe6f9ea59
@ -250,15 +250,16 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
||||
stateFlag = GTK_STATE_FLAG_ACTIVE;
|
||||
}
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
GdkRGBA c;
|
||||
gtk_style_context_get_color(sc, stateFlag, &c);
|
||||
attr.colFg = wxColour(c);
|
||||
gtk_style_context_get_background_color(sc, stateFlag, &c);
|
||||
attr.colBg = wxColour(c);
|
||||
GdkRGBA *fc, *bc;
|
||||
wxNativeFontInfo info;
|
||||
gtk_style_context_get(
|
||||
sc, stateFlag, GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||
gtk_style_context_get(sc, stateFlag,
|
||||
"color", &fc, "background-color", &bc,
|
||||
GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
|
||||
attr.colFg = wxColour(*fc);
|
||||
attr.colBg = wxColour(*bc);
|
||||
attr.font = wxFont(info);
|
||||
gdk_rgba_free(fc);
|
||||
gdk_rgba_free(bc);
|
||||
#else
|
||||
GtkStyle* style;
|
||||
|
||||
|
@ -152,38 +152,33 @@ static GtkWidget* ToolTipWidget()
|
||||
}
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||
static void get_color(const char* name, GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||
{
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
||||
GdkRGBA* rgba;
|
||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||
gdkRGBA = *rgba;
|
||||
gdk_rgba_free(rgba);
|
||||
if (gdkRGBA.alpha <= 0)
|
||||
{
|
||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||
sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_background_color(sc, state, &gdkRGBA);
|
||||
gtk_style_context_get(sc, state, name, &rgba, NULL);
|
||||
gdkRGBA = *rgba;
|
||||
gdk_rgba_free(rgba);
|
||||
}
|
||||
}
|
||||
static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||
{
|
||||
get_color("background-color", widget, state, gdkRGBA);
|
||||
}
|
||||
static void fg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||
{
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
||||
if (gdkRGBA.alpha <= 0)
|
||||
{
|
||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||
sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_color(sc, state, &gdkRGBA);
|
||||
}
|
||||
get_color("color", widget, state, gdkRGBA);
|
||||
}
|
||||
static void border(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
|
||||
{
|
||||
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
||||
if (gdkRGBA.alpha <= 0)
|
||||
{
|
||||
widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget()));
|
||||
sc = gtk_widget_get_style_context(widget);
|
||||
gtk_style_context_get_border_color(sc, state, &gdkRGBA);
|
||||
}
|
||||
get_color("border-color", widget, state, gdkRGBA);
|
||||
}
|
||||
|
||||
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
|
Loading…
Reference in New Issue
Block a user