From 0ef695ef9b10429e89358af31d8b2f6ded948ff5 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 23 Nov 2016 09:28:28 -0800 Subject: [PATCH] Revert d30673e5, it's completely broken. See #17089 --- docs/changes.txt | 1 - include/wx/gtk/hyperlink.h | 21 ---------- src/gtk/hyperlink.cpp | 84 ++------------------------------------ 3 files changed, 4 insertions(+), 102 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d89b055450..a0485c3f6b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -120,7 +120,6 @@ wxGTK: - Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert). - Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn). -- Implement setting link colours in wxHyperlinkCtrl for GTK+3 (Hanmac). - Support background colour in wxDataViewCtrl attributes. - Improve wxSpinCtrl best size calculation. - Implement support for icon locations in wxMimeTypesManager (Hanmac). diff --git a/include/wx/gtk/hyperlink.h b/include/wx/gtk/hyperlink.h index 16ea5c02c7..d7748ce159 100644 --- a/include/wx/gtk/hyperlink.h +++ b/include/wx/gtk/hyperlink.h @@ -13,12 +13,6 @@ #include "wx/generic/hyperlink.h" -#include "wx/scopedptr.h" - -#ifdef __WXGTK3__ -class wxHyperlinkCtrlColData; -#endif - // ---------------------------------------------------------------------------- // wxHyperlinkCtrl // ---------------------------------------------------------------------------- @@ -27,8 +21,6 @@ class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl { typedef wxGenericHyperlinkCtrl base_type; public: - // Constructors (notice that they can't be defined inline for this class - // because of m_colData which uses incomplete wxHyperlinkCtrlColData). wxHyperlinkCtrl(); wxHyperlinkCtrl(wxWindow *parent, wxWindowID id, @@ -74,19 +66,6 @@ protected: virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; -private: - enum LinkKind - { - Link_Normal, - Link_Visited - }; - - void DoSetLinkColour(LinkKind linkKind, const wxColour& colour); - -#ifdef __WXGTK3__ - wxScopedPtr m_colData; -#endif - wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl); }; diff --git a/src/gtk/hyperlink.cpp b/src/gtk/hyperlink.cpp index aaead3dc88..6e38799cb5 100644 --- a/src/gtk/hyperlink.cpp +++ b/src/gtk/hyperlink.cpp @@ -32,10 +32,6 @@ #include #include "wx/gtk/private.h" -#ifdef __WXGTK3__ - #include "wx/gtk/private/object.h" -#endif - // ---------------------------------------------------------------------------- // local functions // ---------------------------------------------------------------------------- @@ -89,23 +85,6 @@ static void clicked_hook(GtkLinkButton* button, const char*, void*) } #endif -#ifdef __WXGTK3__ - -// Used to store GtkCssProviders we need to change the link colours with GTK+3. -class wxHyperlinkCtrlColData -{ -public: - wxHyperlinkCtrlColData() : - m_normalLinkCssProvider(gtk_css_provider_new()), - m_visitedLinkCssProvider(gtk_css_provider_new()) - {} - - wxGtkObject m_normalLinkCssProvider; - wxGtkObject m_visitedLinkCssProvider; -}; - -#endif // __WXGTK3__ - // ---------------------------------------------------------------------------- // wxHyperlinkCtrl // ---------------------------------------------------------------------------- @@ -234,45 +213,12 @@ wxString wxHyperlinkCtrl::GetURL() const return wxGenericHyperlinkCtrl::GetURL(); } -void wxHyperlinkCtrl::DoSetLinkColour(LinkKind linkKind, const wxColour& colour) -{ -#ifdef __WXGTK3__ - if ( !m_colData ) - m_colData.reset(new wxHyperlinkCtrlColData()); - - const char* cssProp = NULL; - GtkCssProvider* cssProvider = NULL; - switch ( linkKind ) - { - case Link_Normal: - cssProp = "link-color"; - cssProvider = m_colData->m_normalLinkCssProvider; - break; - - case Link_Visited: - cssProp = "visited-link-color"; - cssProvider = m_colData->m_visitedLinkCssProvider; - break; - } - - wxCHECK_RET( cssProvider, wxS("unknown link kind") ); - - const GdkRGBA *col = colour; - - wxGtkString - css(g_strdup_printf("* { %s: %s; }", cssProp, gdk_rgba_to_string(col))); - ApplyCssStyle(cssProvider, css); -#else // !__WXGTK3__ - // simply do nothing: GTK+ does not allow us to change it :( - wxUnusedVar(linkKind); - wxUnusedVar(colour); -#endif -} - void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour) { if ( UseNative() ) - DoSetLinkColour(Link_Normal, colour); + { + // simply do nothing: GTK+ does not allow us to change it :( + } else wxGenericHyperlinkCtrl::SetNormalColour(colour); } @@ -282,16 +228,6 @@ wxColour wxHyperlinkCtrl::GetNormalColour() const wxColour ret; if ( UseNative() ) { -#ifdef __WXGTK3__ - GdkRGBA *link_color = NULL; - gtk_widget_style_get(m_widget, "link-color", &link_color, NULL); - - if ( link_color ) - { - ret = wxColour(*link_color); - gdk_rgba_free (link_color); - } -#else // !__WXGTK3__ GdkColor* link_color; GdkColor color = { 0, 0, 0, 0xeeee }; @@ -306,7 +242,6 @@ wxColour wxHyperlinkCtrl::GetNormalColour() const } wxGCC_WARNING_RESTORE() ret = wxColour(color); -#endif // __WXGTK3__/!__WXGTK3__ } else ret = wxGenericHyperlinkCtrl::GetNormalColour(); @@ -318,7 +253,7 @@ void wxHyperlinkCtrl::SetVisitedColour(const wxColour &colour) { if ( UseNative() ) { - DoSetLinkColour(Link_Visited, colour); + // simply do nothing: GTK+ does not allow us to change it :( } else wxGenericHyperlinkCtrl::SetVisitedColour(colour); @@ -329,16 +264,6 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const wxColour ret; if ( UseNative() ) { -#ifdef __WXGTK3__ - GdkRGBA *link_color = NULL; - gtk_widget_style_get(m_widget, "visited-link-color", &link_color, NULL); - - if ( link_color ) - { - ret = wxColour(*link_color); - gdk_rgba_free (link_color); - } -#else // !__WXGTK3__ GdkColor* link_color; GdkColor color = { 0, 0x5555, 0x1a1a, 0x8b8b }; @@ -353,7 +278,6 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const } wxGCC_WARNING_RESTORE() ret = wxColour(color); -#endif // __WXGTK3__/!__WXGTK3__ } else ret = base_type::GetVisitedColour();