Remove some duplicate code for getting hyperlink color

This commit is contained in:
Paul Cornett 2020-04-21 08:35:07 -07:00
parent d76b0186e3
commit d551c156c4

View File

@ -27,6 +27,7 @@
#include "wx/hyperlink.h" #include "wx/hyperlink.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/settings.h"
#endif #endif
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
@ -220,28 +221,9 @@ void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour)
wxColour wxHyperlinkCtrl::GetNormalColour() const wxColour wxHyperlinkCtrl::GetNormalColour() const
{ {
wxColour ret; return UseNative()
if ( UseNative() ) ? wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT)
{ : wxGenericHyperlinkCtrl::GetNormalColour();
GdkColor* link_color;
GdkColor color = { 0, 0, 0, 0xeeee };
GtkWidget* widget = gtk_bin_get_child(GTK_BIN(m_widget));
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
gtk_widget_ensure_style(widget);
gtk_widget_style_get(widget, "link-color", &link_color, NULL);
if (link_color)
{
color = *link_color;
gdk_color_free(link_color);
}
wxGCC_WARNING_RESTORE()
ret = wxColour(color);
}
else
ret = wxGenericHyperlinkCtrl::GetNormalColour();
return ret;
} }
void wxHyperlinkCtrl::SetVisitedColour(const wxColour &colour) void wxHyperlinkCtrl::SetVisitedColour(const wxColour &colour)