From 4ebde54d417749344e7e54a202a2abccc449ed97 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 16 Jan 2020 10:46:19 +0100 Subject: [PATCH] Only show IE specific menus in webview sample when using IE --- samples/webview/webview.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/samples/webview/webview.cpp b/samples/webview/webview.cpp index 99ca20e5dd..ace08e8a97 100644 --- a/samples/webview/webview.cpp +++ b/samples/webview/webview.cpp @@ -451,9 +451,12 @@ WebFrame::WebFrame(const wxString& url) : m_script_null = script_menu->Append(wxID_ANY, "Return null"); m_script_date = script_menu->Append(wxID_ANY, "Return Date"); #if wxUSE_WEBVIEW_IE - m_script_object_el = script_menu->Append(wxID_ANY, "Return JSON object changing emulation level"); - m_script_date_el = script_menu->Append(wxID_ANY, "Return Date changing emulation level"); - m_script_array_el = script_menu->Append(wxID_ANY, "Return array changing emulation level"); + if (!wxWebView::IsBackendAvailable(wxWebViewBackendEdge)) + { + m_script_object_el = script_menu->Append(wxID_ANY, "Return JSON object changing emulation level"); + m_script_date_el = script_menu->Append(wxID_ANY, "Return Date changing emulation level"); + m_script_array_el = script_menu->Append(wxID_ANY, "Return array changing emulation level"); + } #endif m_script_custom = script_menu->Append(wxID_ANY, "Custom script"); m_tools_menu->AppendSubMenu(script_menu, _("Run Script")); @@ -540,9 +543,12 @@ WebFrame::WebFrame(const wxString& url) : Bind(wxEVT_MENU, &WebFrame::OnRunScriptNull, this, m_script_null->GetId()); Bind(wxEVT_MENU, &WebFrame::OnRunScriptDate, this, m_script_date->GetId()); #if wxUSE_WEBVIEW_IE - Bind(wxEVT_MENU, &WebFrame::OnRunScriptObjectWithEmulationLevel, this, m_script_object_el->GetId()); - Bind(wxEVT_MENU, &WebFrame::OnRunScriptDateWithEmulationLevel, this, m_script_date_el->GetId()); - Bind(wxEVT_MENU, &WebFrame::OnRunScriptArrayWithEmulationLevel, this, m_script_array_el->GetId()); + if (!wxWebView::IsBackendAvailable(wxWebViewBackendEdge)) + { + Bind(wxEVT_MENU, &WebFrame::OnRunScriptObjectWithEmulationLevel, this, m_script_object_el->GetId()); + Bind(wxEVT_MENU, &WebFrame::OnRunScriptDateWithEmulationLevel, this, m_script_date_el->GetId()); + Bind(wxEVT_MENU, &WebFrame::OnRunScriptArrayWithEmulationLevel, this, m_script_array_el->GetId()); + } #endif Bind(wxEVT_MENU, &WebFrame::OnRunScriptCustom, this, m_script_custom->GetId()); Bind(wxEVT_MENU, &WebFrame::OnClearSelection, this, m_selection_clear->GetId());