Merge branch 'webview_misc' of https://github.com/TcT2k/wxWidgets
More wxWebView miscellaneous improvements. See https://github.com/wxWidgets/wxWidgets/pull/2221
This commit is contained in:
@@ -105,7 +105,7 @@ private:
|
|||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
void OnShow(wxShowEvent& event);
|
void OnTopLevelParentIconized(wxIconizeEvent& event);
|
||||||
|
|
||||||
bool RunScriptSync(const wxString& javascript, wxString* output = NULL) const;
|
bool RunScriptSync(const wxString& javascript, wxString* output = NULL) const;
|
||||||
|
|
||||||
|
@@ -113,15 +113,16 @@ private:
|
|||||||
class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory
|
class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual wxWebView* Create() { return new wxWebViewWebKit; }
|
virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewWebKit; }
|
||||||
virtual wxWebView* Create(wxWindow* parent,
|
virtual wxWebView* Create(wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& url = wxWebViewDefaultURLStr,
|
const wxString& url = wxWebViewDefaultURLStr,
|
||||||
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 = wxASCII_STR(wxWebViewNameStr))
|
const wxString& name = wxASCII_STR(wxWebViewNameStr)) wxOVERRIDE
|
||||||
{ return new wxWebViewWebKit(parent, id, url, pos, size, style, name); }
|
{ return new wxWebViewWebKit(parent, id, url, pos, size, style, name); }
|
||||||
|
virtual wxVersionInfo GetVersionInfo() wxOVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT
|
#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT
|
||||||
|
@@ -296,6 +296,7 @@ HRESULT wxWebViewEdgeImpl::OnWebViewCreated(HRESULT result, ICoreWebView2Control
|
|||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
UpdateBounds();
|
UpdateBounds();
|
||||||
|
m_webViewController->put_IsVisible(true);
|
||||||
|
|
||||||
// Connect and handle the various WebView events
|
// Connect and handle the various WebView events
|
||||||
m_webView->add_NavigationStarting(
|
m_webView->add_NavigationStarting(
|
||||||
@@ -362,7 +363,9 @@ ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings()
|
|||||||
|
|
||||||
wxWebViewEdge::~wxWebViewEdge()
|
wxWebViewEdge::~wxWebViewEdge()
|
||||||
{
|
{
|
||||||
Unbind(wxEVT_SHOW, &wxWebViewEdge::OnShow, this);
|
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||||
|
if (topLevelParent)
|
||||||
|
topLevelParent->Unbind(wxEVT_ICONIZE, &wxWebViewEdge::OnTopLevelParentIconized, this);
|
||||||
delete m_impl;
|
delete m_impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +390,9 @@ bool wxWebViewEdge::Create(wxWindow* parent,
|
|||||||
if (!m_impl->Create())
|
if (!m_impl->Create())
|
||||||
return false;
|
return false;
|
||||||
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
||||||
Bind(wxEVT_SHOW, &wxWebViewEdge::OnShow, this);
|
wxWindow* topLevelParent = wxGetTopLevelParent(this);
|
||||||
|
if (topLevelParent)
|
||||||
|
topLevelParent->Bind(wxEVT_ICONIZE, &wxWebViewEdge::OnTopLevelParentIconized, this);
|
||||||
|
|
||||||
LoadURL(url);
|
LoadURL(url);
|
||||||
return true;
|
return true;
|
||||||
@@ -399,10 +404,10 @@ void wxWebViewEdge::OnSize(wxSizeEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWebViewEdge::OnShow(wxShowEvent& event)
|
void wxWebViewEdge::OnTopLevelParentIconized(wxIconizeEvent& event)
|
||||||
{
|
{
|
||||||
if (m_impl->m_webView)
|
if (m_impl && m_impl->m_webViewController)
|
||||||
m_impl->m_webViewController->put_IsVisible(event.IsShown());
|
m_impl->m_webViewController->put_IsVisible(!event.IsIconized());
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -87,6 +87,17 @@ wxEND_EVENT_TABLE()
|
|||||||
@end
|
@end
|
||||||
#endif // macOS 10.13+
|
#endif // macOS 10.13+
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxWebViewFactoryWebKit
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxVersionInfo wxWebViewFactoryWebKit::GetVersionInfo()
|
||||||
|
{
|
||||||
|
int verMaj, verMin, verMicro;
|
||||||
|
wxGetOsVersion(&verMaj, &verMin, &verMicro);
|
||||||
|
return wxVersionInfo("WKWebView", verMaj, verMin, verMicro);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// creation/destruction
|
// creation/destruction
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user