void ChatPanel::OnMouseDown( wxMouseEvent& event ) { wxLogDebugFunc( _T( "" ) ); wxTextCoord row; wxTextCoord col; wxTextCtrlHitTestResult ht = m_chatlog_text->HitTest( event.GetPosition(), &col, &row); if ( ht != wxTE_HT_UNKNOWN ) { long pos = m_chatlog_text->XYToPosition( col, row ); m_url_at_pos = FindUrl( pos ); } CreatePopup(); if ( m_popup_menu != 0 ) PopupMenu( m_popup_menu->GetMenu() ); else event.Skip(); }
void CUrlRichEditCtrl::OnLButtonUp(UINT nHitTest, CPoint point) { CRichEditBaseCtrl::OnLButtonUp(nHitTest, point); BOOL bShift = Misc::IsKeyPressed(VK_SHIFT); if (bShift || FindUrl(point) != m_nContextUrl) m_nContextUrl = -1; if (GoToUrl(m_nContextUrl)) { m_nContextUrl = -1; } }
void CUrlRichEditCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_APPS) { m_ptContextMenu = GetCaretPos(); // does this location lie on a url? m_nContextUrl = FindUrl(m_ptContextMenu); // convert point to screen coords ClientToScreen(&m_ptContextMenu); } CRichEditBaseCtrl::OnKeyUp(nChar, nRepCnt, nFlags); }
void CUrlRichEditCtrl::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_F10 && GetKeyState(VK_SHIFT)) { m_ptContextMenu = GetCaretPos(); // does this location lie on a url? m_nContextUrl = FindUrl(m_ptContextMenu); // convert point to screen coords ClientToScreen(&m_ptContextMenu); // eat message else we'll get a WM_KEYUP with VK_APPS } CRichEditBaseCtrl::OnSysKeyDown(nChar, nRepCnt, nFlags); }
BOOL CUrlRichEditCtrl::OnNotifyLink(NMHDR* pNMHDR, LRESULT* pResult) { BOOL bShift = Misc::IsKeyPressed(VK_SHIFT); ENLINK* pENL = (ENLINK*)pNMHDR; switch (pENL->msg) { case WM_SETCURSOR: if (bShift) { // because we're overriding the default behaviour we need to // handle the cursor being over a selected block CHARRANGE crSel; GetSel(crSel); CPoint ptCursor(GetMessagePos()); ScreenToClient(&ptCursor); LPCTSTR nCursor = IDC_ARROW; int nChar = CharFromPoint(ptCursor); if (nChar < crSel.cpMin || nChar > crSel.cpMax) nCursor = IDC_IBEAM; SetCursor(AfxGetApp()->LoadStandardCursor(nCursor)); *pResult = TRUE; return TRUE; } break; case WM_LBUTTONDOWN: if (!bShift) { m_nContextUrl = FindUrl(pENL->chrg); // might be a hidden link if (m_nContextUrl == -1) { //CString sUrl = GetTextRange(pENL->chrg); } } break; case WM_LBUTTONUP: // handle tasklinks in OnLButtonUp if (m_nContextUrl == -1) { CString sUrl = GetTextRange(pENL->chrg); if (sUrl.IsEmpty()) { if (FileMisc::Run(*this, sUrl) > 32) return TRUE; } } break; case WM_RBUTTONUP: m_nContextUrl = FindUrl(pENL->chrg); break; } return FALSE; }