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_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
);
41 wxWebView
* wxWebView::New(wxWebViewBackend backend
)
45 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
46 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
47 return new wxOSXWebKitCtrl();
50 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
51 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
52 return new wxGtkWebKitCtrl();
55 #if wxHAVE_WEB_BACKEND_IE
56 case wxWEB_VIEW_BACKEND_IE
:
57 return new wxWebViewIE();
60 case wxWEB_VIEW_BACKEND_DEFAULT
:
62 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
63 return new wxOSXWebKitCtrl();
66 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
67 return new wxGtkWebKitCtrl();
70 #if wxHAVE_WEB_BACKEND_IE
71 return new wxWebViewIE();
74 // fall-through intended
81 wxWebView
* wxWebView::New(wxWindow
* parent
,
86 wxWebViewBackend backend
,
92 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
93 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
94 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
98 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
99 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
100 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
104 #if wxHAVE_WEB_BACKEND_IE
105 case wxWEB_VIEW_BACKEND_IE
:
106 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
109 case wxWEB_VIEW_BACKEND_DEFAULT
:
111 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
112 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
115 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
116 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
119 #if wxHAVE_WEB_BACKEND_IE
120 return new wxWebViewIE(parent
, id
, url
, pos
, size
, style
, name
);
123 // fall-through intended