Version: 3.3.1
Loading...
Searching...
No Matches
wxDelegatingCefClient Class Reference

#include <wx/webview_chromium_impl.h>

+ Inheritance diagram for wxDelegatingCefClient:

Detailed Description

Helper class to simplify creating custom CefClient subclasses.

Please note that the application including this header must set up the compiler options to include the CEF directory as one of the include paths, as this header – unlike wx/webview_chromium.h – includes CEF headers.

Here is a simple example of using this class to customize processing the messages received from the other CEF processes:

struct CustomClient : wxDelegatingCefClient
{
using wxDelegatingCefClient::wxDelegatingCefClient;
static CefClient* Create(CefClient* client, void* WXUNUSED(data)
{
return new CustomClient(client);
}
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) override
{
// Handle the message here.
return true; // or false if not handled
}
};
void MyFunction()
{
wxWebViewConfiguration config = wxWebView::NewConfiguration(wxWebViewBackendChromium);
auto configChrome =
static_cast<wxWebViewConfigurationChromium*>(config.GetNativeConfiguration());
configChrome->m_clientCreate = &CustomClient::Create;
auto webview = new wxWebViewChromium(config);
if ( !webview->Create(this, wxID_ANY, url) )
{
// Handle error.
}
}
Helper class to simplify creating custom CefClient subclasses.
Definition webview_chromium_impl.h:63
virtual void * GetNativeConfiguration() const
Returns the pointer to the native configuration used during creation of a wxWebView.
static wxWebViewConfiguration NewConfiguration(const wxString &backend=wxWebViewBackendDefault)
Create a new wxWebViewConfiguration object.
@ wxID_ANY
Any id: means that we don't care about the id, whether when installing an event handler or when creat...
Definition defs.h:591
Since
3.3.0
Category:  WebView