From ef26cbfa33a0c1d5f05d8043ce0fd40b8b5e3080 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Wed, 29 Jan 2014 13:05:32 +0000 Subject: [PATCH] Fixed issue #91. --- src/gui/viewer.cpp | 7 +++++++ src/gui/viewer.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/gui/viewer.cpp b/src/gui/viewer.cpp index a449c46c..6e05b552 100644 --- a/src/gui/viewer.cpp +++ b/src/gui/viewer.cpp @@ -29,6 +29,8 @@ Viewer::Viewer(wxWindow *parent, const wxString& title, const std::string& path) : wxFrame(parent, wxID_ANY, title) { wxWebView * web = wxWebView::New(this, wxID_ANY, boss::ToFileURL(path)); + web->Bind(wxEVT_WEBVIEW_NAVIGATING, &Viewer::OnNavigationStart, this); + wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL); topsizer->Add(web, 1, wxEXPAND); @@ -37,3 +39,8 @@ Viewer::Viewer(wxWindow *parent, const wxString& title, const std::string& path) SetSize(800,600); SetIcon(wxIconLocation("BOSS.exe")); } + +void Viewer::OnNavigationStart(wxWebViewEvent& event) { + wxLaunchDefaultBrowser(event.GetURL()); + event.Veto(); +} diff --git a/src/gui/viewer.h b/src/gui/viewer.h index 14dd3635..49cb925b 100644 --- a/src/gui/viewer.h +++ b/src/gui/viewer.h @@ -26,9 +26,13 @@ #include "ids.h" +#include + class Viewer : public wxFrame { public: Viewer(wxWindow *parent, const wxString& title, const std::string& path); + + void OnNavigationStart(wxWebViewEvent& event); }; #endif