| Version: 3.3.1

wxDelegatingCefClient Class Reference
Class List by Category » WebView

`#include <wx/webview_chromium_impl.h>`

Inheritance diagram for wxDelegatingCefClient:
[legend]

## 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:

#include <wx/webview_chromium_impl.h>
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.
}
}
wxDelegatingCefClient
Helper class to simplify creating custom CefClient subclasses.
Definition: webview_chromium_impl.h:63
wxWebViewChromium
wxWebViewChromium is a Chromium-based backend for wxWebView using the Chromium Embedded Framework (CE...
Definition: webview_chromium.h:280
wxWebViewConfigurationChromium
Chromium-specific configuration parameters.
Definition: webview_chromium.h:365
wxWebViewConfigurationChromium::m_clientCreate
CefClient *(* m_clientCreate)(CefClient *client, void *data)
Function to create the custom CefClient to use if non-null.
Definition: webview_chromium.h:416
wxWebViewConfiguration
This class allows access to web view configuration options and settings, that have to be specified be...
Definition: webview.h:297
wxWebViewConfiguration::GetNativeConfiguration
virtual void * GetNativeConfiguration() const
Returns the pointer to the native configuration used during creation of a wxWebView.
wxWebView::NewConfiguration
static wxWebViewConfiguration NewConfiguration(const wxString &backend=wxWebViewBackendDefault)
Create a new wxWebViewConfiguration object.
wxID_ANY
@ 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
webview_chromium_impl.h

Since
  3.3.0

Category: WebView