void CConfigurationDialog::OnTextURLEvent(wxTextUrlEvent& event) { if(event.GetMouseEvent().LeftIsDown()) { wxTextCtrl* pTextCtrl = (wxTextCtrl*)event.GetEventObject(); wxLaunchDefaultBrowser(pTextCtrl->GetRange(event.GetURLStart(), event.GetURLEnd())); } }
void ChatPanel::OnLinkEvent(wxTextUrlEvent& event) { if (!event.GetMouseEvent().LeftDown()) return; wxString url = m_chatlog_text->GetRange(event.GetURLStart(), event.GetURLEnd()); OpenWebBrowser(url); }
void ChangeLogPage::OnURL(wxTextUrlEvent& event) { // we respond only for LeftDown event if(event.GetMouseEvent().LeftDown()) { int start = event.GetURLStart(); int end = event.GetURLEnd(); wxString url = m_textCtrl->GetRange(start, end); wxLaunchDefaultBrowser(url); } }
void szAboutDlg::OnLink(wxTextUrlEvent& event) { if (!event.GetMouseEvent().LeftUp()) { return; } wxString link = m_textCtrl->GetValue().Mid(event.GetURLStart(), event.GetURLEnd() - event.GetURLStart()); #if __WXMSW__ if (wxLaunchDefaultBrowser(link) == false) #else if (wxExecute(wxString::Format(_T("xdg-open %s"), link.c_str())) == 0) #endif wxMessageBox(_("I was not able to start default browser"), _("Error"), wxICON_ERROR | wxOK); }
// wxTextCtrl doesn't provide a handler for urls, so we use an almost // undocumented event handler provided by wx void dlgAbout::OnTxtCtrlUrlClick(wxTextUrlEvent &event) { wxString URL; wxTextCtrl *Control; wxMouseEvent MouseEvent; MouseEvent = event.GetMouseEvent(); if (MouseEvent.LeftDown()) { Control = wxDynamicCast(event.GetEventObject(), wxTextCtrl); URL = Control->GetRange(event.GetURLStart(), event.GetURLEnd()); wxLaunchDefaultBrowser(URL); event.Skip(); } }