1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common interface and events for web view component
4 // Author: Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon
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.h"
22 #include "wx/gtk/webview.h"
23 #include "wx/msw/webviewie.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
);
40 wxWebView
* wxWebView::New(wxWebViewBackend backend
)
44 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
45 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
46 return new wxOSXWebKitCtrl();
49 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
50 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
51 return new wxGtkWebKitCtrl();
54 #if wxHAVE_WEB_BACKEND_IE
55 case wxWEB_VIEW_BACKEND_IE
:
56 return new wxWebViewIE();
59 case wxWEB_VIEW_BACKEND_DEFAULT
:
61 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
62 return new wxOSXWebKitCtrl();
65 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
66 return new wxGtkWebKitCtrl();
69 #if wxHAVE_WEB_BACKEND_IE
70 return new wxWebViewIE();
73 // fall-through intended
80 wxWebView
* wxWebView::New(wxWindow
* parent
,
85 wxWebViewBackend backend
,
91 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
92 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
93 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
97 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
98 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
99 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
103 #if wxHAVE_WEB_BACKEND_IE
104 case wxWEB_VIEW_BACKEND_IE
:
105 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
108 case wxWEB_VIEW_BACKEND_DEFAULT
:
110 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
111 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
114 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
115 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
118 #if wxHAVE_WEB_BACKEND_IE
119 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
122 // fall-through intended