Create wxWebViewEdge implementation in constructor
This helps with various potential error when using two step creation
This commit is contained in:
@@ -23,7 +23,7 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewEdge : public wxWebView
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxWebViewEdge() {}
|
wxWebViewEdge();
|
||||||
|
|
||||||
wxWebViewEdge(wxWindow* parent,
|
wxWebViewEdge(wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
@@ -31,10 +31,7 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxWebViewNameStr)
|
const wxString& name = wxWebViewNameStr);
|
||||||
{
|
|
||||||
Create(parent, id, url, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
~wxWebViewEdge();
|
~wxWebViewEdge();
|
||||||
|
|
||||||
|
@@ -476,6 +476,24 @@ ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxWebViewEdge::wxWebViewEdge():
|
||||||
|
m_impl(new wxWebViewEdgeImpl(this))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWebViewEdge::wxWebViewEdge(wxWindow* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& url,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name):
|
||||||
|
m_impl(new wxWebViewEdgeImpl(this))
|
||||||
|
{
|
||||||
|
Create(parent, id, url, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
wxWebViewEdge::~wxWebViewEdge()
|
wxWebViewEdge::~wxWebViewEdge()
|
||||||
{
|
{
|
||||||
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||||
@@ -501,7 +519,6 @@ bool wxWebViewEdge::Create(wxWindow* parent,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_impl = new wxWebViewEdgeImpl(this);
|
|
||||||
if (!m_impl->Create())
|
if (!m_impl->Create())
|
||||||
return false;
|
return false;
|
||||||
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
||||||
@@ -774,6 +791,8 @@ void wxWebViewEdge::MSWSetBrowserExecutableDir(const wxString & path)
|
|||||||
bool wxWebViewEdge::RunScriptSync(const wxString& javascript, wxString* output) const
|
bool wxWebViewEdge::RunScriptSync(const wxString& javascript, wxString* output) const
|
||||||
{
|
{
|
||||||
bool scriptExecuted = false;
|
bool scriptExecuted = false;
|
||||||
|
if (!m_impl->m_webView)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Start script execution
|
// Start script execution
|
||||||
HRESULT executionResult = m_impl->m_webView->ExecuteScript(javascript.wc_str(), Callback<ICoreWebView2ExecuteScriptCompletedHandler>(
|
HRESULT executionResult = m_impl->m_webView->ExecuteScript(javascript.wc_str(), Callback<ICoreWebView2ExecuteScriptCompletedHandler>(
|
||||||
|
Reference in New Issue
Block a user