void gcHyperlinkCtrl::onPaint(wxPaintEvent& WXUNUSED(event)) { wxRect rect = GetLabelRect(); rect.Offset(1,0); wxPaintDC dc(this); wxFont font = GetFont(); font.SetUnderlined(m_bUnderlined); dc.SetFont(font); dc.SetTextForeground(GetForegroundColour()); dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), rect.GetTopLeft()); if (HasFocus()) { wxColor rectColor(GetGCThemeManager()->getColor("checkbox", "focus-fg")); wxRect rect = GetRect(); rect.SetPosition(wxPoint(0,0)); dc.SetBrush(wxBrush(*wxRED, wxTRANSPARENT)); dc.SetPen(wxPen(rectColor)); dc.DrawRectangle(rect); } }
void wxHyperlinkCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); dc.SetFont(GetFont()); dc.SetTextForeground(GetForegroundColour()); dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), GetLabelRect().GetTopLeft()); }
void wxGenericHyperlinkCtrl::OnLeftUp(wxMouseEvent& event) { // the click must be started and ended in the hyperlink rect if (!m_clicking || !GetLabelRect().Contains(event.GetPosition())) return; SetForegroundColour(m_visitedColour); m_visited = true; m_clicking = false; // send the event SendEvent(); }
void wxGenericHyperlinkCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); dc.SetFont(GetFont()); dc.SetTextForeground(GetForegroundColour()); dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), GetLabelRect().GetTopLeft()); if (HasFocus()) { wxRendererNative::Get().DrawFocusRect(this, dc, GetClientRect(), wxCONTROL_SELECTED); } }
void wxHyperlinkCtrl::OnLeftUp(wxMouseEvent& event) { // the click must be started and ended in the hyperlink rect if (!m_clicking || !GetLabelRect().Contains(event.GetPosition())) return; SetForegroundColour(m_visitedColour); m_visited = true; m_clicking = false; // send the event wxHyperlinkEvent linkEvent(this, GetId(), m_url); if (!GetEventHandler()->ProcessEvent(linkEvent)) // was the event skipped ? if (!wxLaunchDefaultBrowser(m_url)) wxLogWarning(wxT("Could not launch the default browser with url '%s' !"), m_url.c_str()); }
void wxGenericHyperlinkCtrl::OnMotion(wxMouseEvent& event) { wxRect textrc = GetLabelRect(); if (textrc.Contains(event.GetPosition())) { SetCursor(wxCursor(wxCURSOR_HAND)); SetForegroundColour(m_hoverColour); m_rollover = true; Refresh(); } else if (m_rollover) { SetCursor(*wxSTANDARD_CURSOR); SetForegroundColour(!m_visited ? m_normalColour : m_visitedColour); m_rollover = false; Refresh(); } }
void wxGenericHyperlinkCtrl::OnRightUp(wxMouseEvent& event) { if( GetWindowStyle() & wxHL_CONTEXTMENU ) if ( GetLabelRect().Contains(event.GetPosition()) ) DoContextMenu(wxPoint(event.m_x, event.m_y)); }
void wxGenericHyperlinkCtrl::OnLeftDown(wxMouseEvent& event) { // the left click must start from the hyperlink rect m_clicking = GetLabelRect().Contains(event.GetPosition()); }