Allow distinguishing user- from script-opened wxWebView windows
Add wxWebViewEvent::GetNavigationAction() returning a value that can be either wxWEBVIEW_NAV_ACTION_USER for the links opened by the user, or wxWEBVIEW_NAV_ACTION_OTHER for the other ones (e.g. opened from JavaScript code on the page). Closes #15402.
This commit is contained in:
committed by
Vadim Zeitlin
parent
91aa6ba36e
commit
b61123cd7d
@@ -78,6 +78,13 @@ enum wxWebViewFindFlags
|
||||
wxWEBVIEW_FIND_DEFAULT = 0
|
||||
};
|
||||
|
||||
enum wxWebViewNavigationActionFlags
|
||||
{
|
||||
wxWEBVIEW_NAV_ACTION_NONE,
|
||||
wxWEBVIEW_NAV_ACTION_USER,
|
||||
wxWEBVIEW_NAV_ACTION_OTHER
|
||||
};
|
||||
|
||||
//Base class for custom scheme handlers
|
||||
class WXDLLIMPEXP_WEBVIEW wxWebViewHandler
|
||||
{
|
||||
@@ -243,18 +250,23 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent
|
||||
public:
|
||||
wxWebViewEvent() {}
|
||||
wxWebViewEvent(wxEventType type, int id, const wxString& url,
|
||||
const wxString& target)
|
||||
: wxNotifyEvent(type, id), m_url(url), m_target(target)
|
||||
const wxString target,
|
||||
wxWebViewNavigationActionFlags flags = wxWEBVIEW_NAV_ACTION_NONE)
|
||||
: wxNotifyEvent(type, id), m_url(url), m_target(target),
|
||||
m_actionFlags(flags)
|
||||
{}
|
||||
|
||||
|
||||
const wxString& GetURL() const { return m_url; }
|
||||
const wxString& GetTarget() const { return m_target; }
|
||||
|
||||
wxWebViewNavigationActionFlags GetNavigationAction() const { return m_actionFlags; }
|
||||
|
||||
virtual wxEvent* Clone() const wxOVERRIDE { return new wxWebViewEvent(*this); }
|
||||
private:
|
||||
wxString m_url;
|
||||
wxString m_target;
|
||||
wxWebViewNavigationActionFlags m_actionFlags;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebViewEvent);
|
||||
};
|
||||
|
Reference in New Issue
Block a user