diff --git a/include/wx/webview.h b/include/wx/webview.h index 9975325392..4ae7c8c616 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -151,6 +151,7 @@ public: static void RegisterFactory(const wxString& backend, wxSharedPtr factory); + static bool IsBackendAvailable(const wxString& backend); // General methods virtual void EnableContextMenu(bool enable = true) diff --git a/interface/wx/webview.h b/interface/wx/webview.h index 685760d60b..cc7cce47af 100644 --- a/interface/wx/webview.h +++ b/interface/wx/webview.h @@ -427,6 +427,14 @@ public: static void RegisterFactory(const wxString& backend, wxSharedPtr factory); + /** + Allows to check if a specific backend is currently available + + @since 3.1.4 + */ + static bool IsBackendAvailable(const wxString& backend); + + /** Get the title of the current web page, or its URL/path if title is not available. diff --git a/src/common/webview.cpp b/src/common/webview.cpp index 5121e385eb..214d82ab5d 100644 --- a/src/common/webview.cpp +++ b/src/common/webview.cpp @@ -86,6 +86,13 @@ void wxWebView::RegisterFactory(const wxString& backend, } // static +bool wxWebView::IsBackendAvailable(const wxString& backend) +{ + wxStringWebViewFactoryMap::iterator iter = FindFactory(backend); + return (iter != m_factoryMap.end()); +} + +// static wxStringWebViewFactoryMap::iterator wxWebView::FindFactory(const wxString &backend) { // Initialise the map, it checks internally for existing factories