Merge branch 'pr_fix_gtk2_hotlight_color' of obfuscated/wxWidgets

Implement support for wxSYS_COLOUR_HOTLIGHT with GTK2.

See https://github.com/wxWidgets/wxWidgets/pull/1805
This commit is contained in:
Vadim Zeitlin 2020-04-18 17:58:53 +02:00
commit db3ff4e2f8

View File

@ -87,6 +87,21 @@ static GtkWidget* ButtonWidget()
return s_widget;
}
#if GTK_CHECK_VERSION(2,10,0)
static GtkWidget* LinkButtonWidget()
{
static GtkWidget *s_widget;
if (s_widget == NULL && wx_is_at_least_gtk2(10))
{
s_widget = gtk_link_button_new("http://test.com");
g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget);
gtk_container_add(ContainerWidget(), s_widget);
gtk_widget_ensure_style(s_widget);
}
return s_widget;
}
#endif // GTK 2.10+
static GtkWidget* ListWidget()
{
static GtkWidget* s_widget;
@ -623,6 +638,18 @@ static const GtkStyle* ButtonStyle()
return gtk_widget_get_style(ButtonWidget());
}
static const wxColor LinkButtonColor()
{
#if GTK_CHECK_VERSION(2,10,0)
GdkColor *link_color = NULL;
gtk_widget_style_get(LinkButtonWidget(), "link-color", &link_color, NULL);
if (link_color)
return wxColor(*link_color);
#endif // GTK 2.10+
return *wxBLUE;
}
static const GtkStyle* ListStyle()
{
return gtk_widget_get_style(ListWidget());
@ -748,8 +775,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
break;
case wxSYS_COLOUR_HOTLIGHT:
// TODO
color = *wxBLACK;
color = LinkButtonColor();
break;
case wxSYS_COLOUR_MAX: