void ZLauncherFrame::OnClickLink(wxWebViewEvent& evt) { // Open the link on the default browser wxLaunchDefaultBrowser(evt.GetURL()); // Stop navigation evt.Veto(); }
void ViewFrame::OnNavigating(wxWebViewEvent& evt) { if(!frozen) { return; } // veto event, to prohibit in-page links evt.Veto(); // instead, load the default web-browser openBrowser(evt.GetURL()); }
/** * Callback invoked when there is a request to load a new page (for instance * when the user clicks a link) */ void WebFrame::OnNavigationRequest(wxWebViewEvent& evt) { if(m_info->IsShown()) { m_info->Dismiss(); } wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "' (target='" + evt.GetTarget() + "')"); wxASSERT(m_browser->IsBusy()); //If we don't want to handle navigation then veto the event and navigation //will not take place, we also need to stop the loading animation if(!m_tools_handle_navigation->IsChecked()) { evt.Veto(); m_toolbar->EnableTool( m_toolbar_stop->GetId(), false ); } else { UpdateState(); } }
void mmHomePagePanel::OnLinkClicked(wxWebViewEvent& event) { const wxString& url = event.GetURL(); if (url.StartsWith("http://www.moneymanagerex.org")) { wxLaunchDefaultBrowser(url); event.Veto(); } else if (url.Contains("#")) { wxString name = url.AfterLast('#'); wxLogDebug("%s", name); //Read data from ini DB as JSON then convert it to json::Object wxString str = Model_Infotable::instance().GetStringInfo("NAV_TREE_STATUS", ""); if (!(str.StartsWith("{") && str.EndsWith("}"))) str = "{}"; std::wstringstream ss; ss << str.ToStdWstring(); json::Object o; json::Reader::Read(o, ss); wxLogDebug("%s", str); if (name == "TOP_CATEGORIES") { bool entry = !json::Boolean(o[L"TOP_CATEGORIES"]); o[L"TOP_CATEGORIES"] = json::Boolean(entry); } std::wstringstream wss; json::Writer::Write(o, wss); wxLogDebug("%s", wss.str()); wxLogDebug("=========================================="); Model_Infotable::instance().Set("NAV_TREE_STATUS", wss.str()); } }
void Viewer::OnNavigationStart(wxWebViewEvent& event) { wxLaunchDefaultBrowser(event.GetURL()); event.Veto(); }