1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common interface and events for web view component
4 // Author: Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
15 #if defined(__BORLANDC__)
19 #include "wx/webview.h"
21 #include "wx/osx/webview_webkit.h"
22 #include "wx/gtk/webview_webkit.h"
23 #include "wx/msw/webview_ie.h"
25 // DLL options compatibility check:
27 WX_CHECK_BUILD_OPTIONS("wxWEB")
29 extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr
[] = "wxWebView";
30 extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr
[] = "about:blank";
32 IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent
, wxCommandEvent
)
34 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING
, wxWebNavigationEvent
);
35 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED
, wxWebNavigationEvent
);
36 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED
, wxWebNavigationEvent
);
37 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR
, wxWebNavigationEvent
);
38 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
, wxWebNavigationEvent
);
39 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED
, wxWebNavigationEvent
);
42 wxWebView
* wxWebView
::New(wxWebViewBackend backend
)
46 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
47 (defined(__WXGTK__) || defined(__WXOSX__))
48 case wxWEB_VIEW_BACKEND_WEBKIT
:
49 return new wxWebViewWebKit();
53 case wxWEB_VIEW_BACKEND_IE
:
54 return new wxWebViewIE();
57 case wxWEB_VIEW_BACKEND_DEFAULT
:
59 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
60 (defined(__WXGTK__) || defined(__WXOSX__))
61 return new wxWebViewWebKit();
65 return new wxWebViewIE();
68 // fall-through intended
75 wxWebView
* wxWebView
::New(wxWindow
* parent
,
80 wxWebViewBackend backend
,
86 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
87 (defined(__WXGTK__) || defined(__WXOSX__))
88 case wxWEB_VIEW_BACKEND_WEBKIT
:
89 return new wxWebViewWebKit(parent
, id
, url
, pos
, size
, style
, name
);
93 case wxWEB_VIEW_BACKEND_IE
:
94 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
97 case wxWEB_VIEW_BACKEND_DEFAULT
:
99 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
100 (defined(__WXGTK__) || defined(__WXOSX__))
101 return new wxWebViewWebKit(parent
, id
, url
, pos
, size
, style
, name
);
105 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
108 // fall-through intended