Implement SetVisited()/GetVisited()
and set the visited state when the link is clicked
(backport of 2fbd2a7800
)
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
|
class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
|
||||||
{
|
{
|
||||||
|
typedef wxGenericHyperlinkCtrl base_type;
|
||||||
public:
|
public:
|
||||||
// Default constructor (for two-step construction).
|
// Default constructor (for two-step construction).
|
||||||
wxHyperlinkCtrl() { }
|
wxHyperlinkCtrl() { }
|
||||||
@@ -60,6 +61,9 @@ public:
|
|||||||
virtual wxString GetURL() const;
|
virtual wxString GetURL() const;
|
||||||
virtual void SetURL(const wxString &url);
|
virtual void SetURL(const wxString &url);
|
||||||
|
|
||||||
|
virtual void SetVisited(bool visited = true);
|
||||||
|
virtual bool GetVisited() const;
|
||||||
|
|
||||||
virtual void SetLabel(const wxString &label);
|
virtual void SetLabel(const wxString &label);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -58,6 +58,7 @@ static inline bool UseNative()
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static gboolean activate_link(GtkWidget*, wxHyperlinkCtrl* win)
|
static gboolean activate_link(GtkWidget*, wxHyperlinkCtrl* win)
|
||||||
{
|
{
|
||||||
|
win->SetVisited(true);
|
||||||
win->SendEvent();
|
win->SendEvent();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,6 +73,7 @@ static void clicked_hook(GtkLinkButton* button, const char*, void*)
|
|||||||
wxHyperlinkCtrl* win = static_cast<wxHyperlinkCtrl*>(p->data);
|
wxHyperlinkCtrl* win = static_cast<wxHyperlinkCtrl*>(p->data);
|
||||||
if (win->m_widget == (GtkWidget*)button)
|
if (win->m_widget == (GtkWidget*)button)
|
||||||
{
|
{
|
||||||
|
win->SetVisited(true);
|
||||||
win->SendEvent();
|
win->SendEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -250,6 +252,32 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const
|
|||||||
return ret;
|
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)
|
void wxHyperlinkCtrl::SetHoverColour(const wxColour &colour)
|
||||||
{
|
{
|
||||||
if ( UseNative() )
|
if ( UseNative() )
|
||||||
|
Reference in New Issue
Block a user