Example #1
0
LearnMoreLink::LearnMoreLink(wxWindow *parent, const wxString& url, wxString label)
{
    if (label.empty())
    {
#ifdef __WXMSW__
        label = _("Learn more");
#else
        label = _("Learn More");
#endif
    }

    wxHyperlinkCtrl::Create(parent, wxID_ANY, label, url);
    SetNormalColour("#2F79BE");
    SetVisitedColour("#2F79BE");
    SetHoverColour("#3D8DD5");

#ifdef __WXOSX__
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
    SetFont(GetFont().Underlined());
#endif
}
gcHyperlinkCtrl::gcHyperlinkCtrl(wxWindow *parent, wxWindowID id, const wxString& label, const wxString& url, const wxPoint& pos, const wxSize& size, long style) : wxHyperlinkCtrl(parent, id, label, url, pos, size, wxHL_ALIGN_LEFT|wxHL_CONTEXTMENU|wxNO_BORDER)
{
	wxColor visited = wxColor( GetGCThemeManager()->getColor("hyperlink", "visted-fg") );
	wxColor hover = wxColor( GetGCThemeManager()->getColor("hyperlink", "hov-fg") );

	SetHoverColour( hover );
	SetNormalColour( wxColour(255, 0, 0, 0));
	SetVisitedColour( visited );

	SetBackgroundStyle(wxBG_STYLE_COLOUR);

	Bind(wxEVT_KILL_FOCUS, &gcHyperlinkCtrl::onBlur, this);
	Bind(wxEVT_SET_FOCUS, &gcHyperlinkCtrl::onFocus, this);
	Bind(wxEVT_PAINT, &gcHyperlinkCtrl::onPaint, this);
	Bind(wxEVT_CHAR, &gcHyperlinkCtrl::onChar, this);

#ifdef WIN32
	Bind(wxEVT_ERASE_BACKGROUND, &gcHyperlinkCtrl::onEraseBackGround, this);
#endif

	m_bUnderlined = true;
}