Revert d30673e5, it's completely broken. See #17089

This commit is contained in:
Paul Cornett
2016-11-23 09:28:28 -08:00
parent 05857e66c0
commit 0ef695ef9b
3 changed files with 4 additions and 102 deletions

View File

@@ -120,7 +120,6 @@ wxGTK:
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert). - Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
- Apply wxTextCtrl::SetDefaultStyle() to user-entered text (Andreas Falkenhahn). - 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. - Support background colour in wxDataViewCtrl attributes.
- Improve wxSpinCtrl best size calculation. - Improve wxSpinCtrl best size calculation.
- Implement support for icon locations in wxMimeTypesManager (Hanmac). - Implement support for icon locations in wxMimeTypesManager (Hanmac).

View File

@@ -13,12 +13,6 @@
#include "wx/generic/hyperlink.h" #include "wx/generic/hyperlink.h"
#include "wx/scopedptr.h"
#ifdef __WXGTK3__
class wxHyperlinkCtrlColData;
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxHyperlinkCtrl // wxHyperlinkCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -27,8 +21,6 @@ class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
{ {
typedef wxGenericHyperlinkCtrl base_type; typedef wxGenericHyperlinkCtrl base_type;
public: public:
// Constructors (notice that they can't be defined inline for this class
// because of m_colData which uses incomplete wxHyperlinkCtrlColData).
wxHyperlinkCtrl(); wxHyperlinkCtrl();
wxHyperlinkCtrl(wxWindow *parent, wxHyperlinkCtrl(wxWindow *parent,
wxWindowID id, wxWindowID id,
@@ -74,19 +66,6 @@ protected:
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE;
private:
enum LinkKind
{
Link_Normal,
Link_Visited
};
void DoSetLinkColour(LinkKind linkKind, const wxColour& colour);
#ifdef __WXGTK3__
wxScopedPtr<wxHyperlinkCtrlColData> m_colData;
#endif
wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl); wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl);
}; };

View File

@@ -32,10 +32,6 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#ifdef __WXGTK3__
#include "wx/gtk/private/object.h"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// local functions // local functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -89,23 +85,6 @@ static void clicked_hook(GtkLinkButton* button, const char*, void*)
} }
#endif #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<GtkCssProvider> m_normalLinkCssProvider;
wxGtkObject<GtkCssProvider> m_visitedLinkCssProvider;
};
#endif // __WXGTK3__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxHyperlinkCtrl // wxHyperlinkCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -234,45 +213,12 @@ wxString wxHyperlinkCtrl::GetURL() const
return wxGenericHyperlinkCtrl::GetURL(); 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) void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour)
{ {
if ( UseNative() ) if ( UseNative() )
DoSetLinkColour(Link_Normal, colour); {
// simply do nothing: GTK+ does not allow us to change it :(
}
else else
wxGenericHyperlinkCtrl::SetNormalColour(colour); wxGenericHyperlinkCtrl::SetNormalColour(colour);
} }
@@ -282,16 +228,6 @@ wxColour wxHyperlinkCtrl::GetNormalColour() const
wxColour ret; wxColour ret;
if ( UseNative() ) 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* link_color;
GdkColor color = { 0, 0, 0, 0xeeee }; GdkColor color = { 0, 0, 0, 0xeeee };
@@ -306,7 +242,6 @@ wxColour wxHyperlinkCtrl::GetNormalColour() const
} }
wxGCC_WARNING_RESTORE() wxGCC_WARNING_RESTORE()
ret = wxColour(color); ret = wxColour(color);
#endif // __WXGTK3__/!__WXGTK3__
} }
else else
ret = wxGenericHyperlinkCtrl::GetNormalColour(); ret = wxGenericHyperlinkCtrl::GetNormalColour();
@@ -318,7 +253,7 @@ void wxHyperlinkCtrl::SetVisitedColour(const wxColour &colour)
{ {
if ( UseNative() ) if ( UseNative() )
{ {
DoSetLinkColour(Link_Visited, colour); // simply do nothing: GTK+ does not allow us to change it :(
} }
else else
wxGenericHyperlinkCtrl::SetVisitedColour(colour); wxGenericHyperlinkCtrl::SetVisitedColour(colour);
@@ -329,16 +264,6 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const
wxColour ret; wxColour ret;
if ( UseNative() ) 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* link_color;
GdkColor color = { 0, 0x5555, 0x1a1a, 0x8b8b }; GdkColor color = { 0, 0x5555, 0x1a1a, 0x8b8b };
@@ -353,7 +278,6 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const
} }
wxGCC_WARNING_RESTORE() wxGCC_WARNING_RESTORE()
ret = wxColour(color); ret = wxColour(color);
#endif // __WXGTK3__/!__WXGTK3__
} }
else else
ret = base_type::GetVisitedColour(); ret = base_type::GetVisitedColour();