Various small code fixups

This commit is contained in:
Tobias Taschner
2020-01-15 16:33:04 +01:00
parent bce0e65a80
commit bf6b51e702
2 changed files with 8 additions and 29 deletions

View File

@@ -128,8 +128,8 @@ protected:
virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE;
private: private:
bool m_initialized = false; bool m_initialized;
bool m_isBusy = false; bool m_isBusy;
wxString m_pendingURL; wxString m_pendingURL;
wxCOMPtr<IWebView2Environment3> m_webViewEnvironment; wxCOMPtr<IWebView2Environment3> m_webViewEnvironment;

View File

@@ -100,7 +100,6 @@ wxWebViewEdge::~wxWebViewEdge()
{ {
if (m_webView) if (m_webView)
{ {
// TOOD: Remove additional events
m_webView->remove_NavigationCompleted(m_navigationCompletedToken); m_webView->remove_NavigationCompleted(m_navigationCompletedToken);
m_webView->remove_NavigationStarting(m_navigationStartingToken); m_webView->remove_NavigationStarting(m_navigationStartingToken);
m_webView->remove_DocumentStateChanged(m_documentStateChangedToken); m_webView->remove_DocumentStateChanged(m_documentStateChangedToken);
@@ -123,15 +122,15 @@ bool wxWebViewEdge::Create(wxWindow* parent,
m_historyEnabled = true; m_historyEnabled = true;
m_historyPosition = -1; m_historyPosition = -1;
if (!IsAvailable())
return false;
if (!wxControl::Create(parent, id, pos, size, style, if (!wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name)) wxDefaultValidator, name))
{ {
return false; return false;
} }
if (!IsAvailable())
return false;
m_pendingURL = url; m_pendingURL = url;
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this); Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
@@ -360,14 +359,6 @@ bool wxWebViewEdge::CanGoForward() const
return m_historyPosition != static_cast<int>(m_historyList.size()) - 1; return m_historyPosition != static_cast<int>(m_historyList.size()) - 1;
else else
return false; return false;
/*
BOOL result = false;
if (m_webView && SUCCEEDED(m_webView->get_CanGoForward(&result)))
return result;
else
return false;
*/
} }
bool wxWebViewEdge::CanGoBack() const bool wxWebViewEdge::CanGoBack() const
@@ -376,28 +367,16 @@ bool wxWebViewEdge::CanGoBack() const
return m_historyPosition > 0; return m_historyPosition > 0;
else else
return false; return false;
/*
BOOL result = false;
if (m_webView && SUCCEEDED(m_webView->get_CanGoBack(&result)))
return result;
else
return false;
*/
} }
void wxWebViewEdge::GoBack() void wxWebViewEdge::GoBack()
{ {
LoadHistoryItem(m_historyList[m_historyPosition - 1]); LoadHistoryItem(m_historyList[m_historyPosition - 1]);
/* if (m_webView)
m_webView->GoBack(); */
} }
void wxWebViewEdge::GoForward() void wxWebViewEdge::GoForward()
{ {
LoadHistoryItem(m_historyList[m_historyPosition + 1]); LoadHistoryItem(m_historyList[m_historyPosition + 1]);
/* if (m_webView)
m_webView->GoForward(); */
} }
void wxWebViewEdge::ClearHistory() void wxWebViewEdge::ClearHistory()
@@ -451,9 +430,9 @@ wxString wxWebViewEdge::GetCurrentURL() const
wxString wxWebViewEdge::GetCurrentTitle() const wxString wxWebViewEdge::GetCurrentTitle() const
{ {
PWSTR _title; PWSTR title;
if (m_webView && SUCCEEDED(m_webView->get_DocumentTitle(&_title))) if (m_webView && SUCCEEDED(m_webView->get_DocumentTitle(&title)))
return wxString(_title); return wxString(title);
else else
return wxString(); return wxString();
} }