diff --git a/include/wx/gtk/hyperlink.h b/include/wx/gtk/hyperlink.h index c63d21e623..486c5b8bcb 100644 --- a/include/wx/gtk/hyperlink.h +++ b/include/wx/gtk/hyperlink.h @@ -19,6 +19,7 @@ class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl { + typedef wxGenericHyperlinkCtrl base_type; public: // Default constructor (for two-step construction). wxHyperlinkCtrl() { } @@ -60,6 +61,9 @@ public: virtual wxString GetURL() const wxOVERRIDE; virtual void SetURL(const wxString &url) wxOVERRIDE; + virtual void SetVisited(bool visited = true) wxOVERRIDE; + virtual bool GetVisited() const wxOVERRIDE; + virtual void SetLabel(const wxString &label) wxOVERRIDE; protected: diff --git a/src/gtk/hyperlink.cpp b/src/gtk/hyperlink.cpp index aee599faf5..9d05225288 100644 --- a/src/gtk/hyperlink.cpp +++ b/src/gtk/hyperlink.cpp @@ -58,6 +58,7 @@ static inline bool UseNative() extern "C" { static gboolean activate_link(GtkWidget*, wxHyperlinkCtrl* win) { + win->SetVisited(true); win->SendEvent(); return true; } @@ -72,6 +73,7 @@ static void clicked_hook(GtkLinkButton* button, const char*, void*) wxHyperlinkCtrl* win = static_cast(p->data); if (win->m_widget == (GtkWidget*)button) { + win->SetVisited(true); win->SendEvent(); return; } @@ -250,6 +252,32 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const return ret; } +void wxHyperlinkCtrl::SetVisited(bool visited) +{ + base_type::SetVisited(visited); +#if GTK_CHECK_VERSION(2,14,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,14,0) == NULL) +#endif + { + gtk_link_button_set_visited(GTK_LINK_BUTTON(m_widget), visited); + } +#endif +} + +bool wxHyperlinkCtrl::GetVisited() const +{ +#if GTK_CHECK_VERSION(2,14,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,14,0) == NULL) +#endif + { + return gtk_link_button_get_visited(GTK_LINK_BUTTON(m_widget)) != 0; + } +#endif + return base_type::GetVisited(); +} + void wxHyperlinkCtrl::SetHoverColour(const wxColour &colour) { if ( UseNative() )