Fix wxSystemSettings::GetColour() returning transparent colors with GTK3, closes #16255

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2014-05-17 17:34:36 +00:00
parent 8a78ec6b38
commit c13a63a26a

View File

@ -156,16 +156,34 @@ static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA)
{
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
gtk_style_context_get_background_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_background_color(sc, 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);
}
}
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);
}
}
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
@ -235,14 +253,21 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
break;
case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_MENUHILIGHT:
bg(MenuItemWidget(), GTK_STATE_FLAG_SELECTED, gdkRGBA);
bg(MenuItemWidget(), GTK_STATE_FLAG_PRELIGHT, gdkRGBA);
break;
case wxSYS_COLOUR_MENUTEXT:
fg(MenuItemWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA);
break;
case wxSYS_COLOUR_APPWORKSPACE:
case wxSYS_COLOUR_WINDOW:
bg(TextCtrlWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA);
{
GtkWidget* widget = TextCtrlWidget();
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
gtk_style_context_save(sc);
gtk_style_context_add_class(sc, GTK_STYLE_CLASS_VIEW);
bg(widget, GTK_STATE_FLAG_NORMAL, gdkRGBA);
gtk_style_context_restore(sc);
}
break;
case wxSYS_COLOUR_CAPTIONTEXT:
{