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 #if defined(__WXOSX_COCOA__) || defined(__WXOSX_CARBON__)
22 #include "wx/osx/webview_webkit.h"
23 #elif defined(__WXGTK__)
24 #include "wx/gtk/webview_webkit.h"
25 #elif defined(__WXMSW__)
26 #include "wx/msw/webview_ie.h"
29 // DLL options compatibility check:
31 WX_CHECK_BUILD_OPTIONS("wxWEBVIEW")
33 extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr
[] = "wxWebView";
34 extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr
[] = "about:blank";
36 wxIMPLEMENT_ABSTRACT_CLASS(wxWebView
, wxControl
);
37 wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewEvent
, wxCommandEvent
);
39 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING
, wxWebViewEvent
);
40 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED
, wxWebViewEvent
);
41 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED
, wxWebViewEvent
);
42 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR
, wxWebViewEvent
);
43 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
, wxWebViewEvent
);
44 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED
, wxWebViewEvent
);
47 wxWebView
* wxWebView::New(wxWebViewBackend backend
)
51 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
52 (defined(__WXGTK__) || defined(__WXOSX__))
53 case wxWEB_VIEW_BACKEND_WEBKIT
:
54 return new wxWebViewWebKit();
58 case wxWEB_VIEW_BACKEND_IE
:
59 return new wxWebViewIE();
62 case wxWEB_VIEW_BACKEND_DEFAULT
:
64 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
65 (defined(__WXGTK__) || defined(__WXOSX__))
66 return new wxWebViewWebKit();
70 return new wxWebViewIE();
73 // fall-through intended
80 wxWebView
* wxWebView::New(wxWindow
* parent
,
85 wxWebViewBackend backend
,
91 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
92 (defined(__WXGTK__) || defined(__WXOSX__))
93 case wxWEB_VIEW_BACKEND_WEBKIT
:
94 return new wxWebViewWebKit(parent
, id
, url
, pos
, size
, style
, name
);
98 case wxWEB_VIEW_BACKEND_IE
:
99 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
102 case wxWEB_VIEW_BACKEND_DEFAULT
:
104 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
105 (defined(__WXGTK__) || defined(__WXOSX__))
106 return new wxWebViewWebKit(parent
, id
, url
, pos
, size
, style
, name
);
110 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
113 // fall-through intended
119 #endif // wxUSE_WEBVIEW