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 #include "wx/webview.h"
12 #include "wx/osx/webkit.h"
13 #include "wx/gtk/webkit.h"
14 #include "wx/msw/webkitie.h"
16 extern WXDLLEXPORT_DATA(const char) wxWebViewNameStr
[] = "wxWebView";
17 extern WXDLLEXPORT_DATA(const char) wxWebViewDefaultURLStr
[] = "about:blank";
19 IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent
, wxCommandEvent
)
21 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING
, wxWebNavigationEvent
);
22 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED
, wxWebNavigationEvent
);
23 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED
, wxWebNavigationEvent
);
24 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR
, wxWebNavigationEvent
);
27 wxWebView
* wxWebView::New(wxWebViewBackend backend
)
31 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
32 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
33 return new wxOSXWebKitCtrl();
36 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
37 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
38 return new wxGtkWebKitCtrl();
41 #if wxHAVE_WEB_BACKEND_IE
42 case wxWEB_VIEW_BACKEND_IE
:
43 return new wxIEPanel();
46 case wxWEB_VIEW_BACKEND_DEFAULT
:
48 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
49 return new wxOSXWebKitCtrl();
52 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
53 return new wxGtkWebKitCtrl();
56 #if wxHAVE_WEB_BACKEND_IE
57 return new wxIEPanel();
60 // fall-through intended
67 wxWebView
* wxWebView::New(wxWindow
* parent
,
72 wxWebViewBackend backend
,
78 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
79 case wxWEB_VIEW_BACKEND_OSX_WEBKIT
:
80 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
84 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
85 case wxWEB_VIEW_BACKEND_GTK_WEBKIT
:
86 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
,
90 #if wxHAVE_WEB_BACKEND_IE
91 case wxWEB_VIEW_BACKEND_IE
:
92 return new wxIEPanel(parent
, id
, url
, pos
, size
, style
, name
);
95 case wxWEB_VIEW_BACKEND_DEFAULT
:
97 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
98 return new wxOSXWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
101 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
102 return new wxGtkWebKitCtrl(parent
, id
, url
, pos
, size
, style
, name
);
105 #if wxHAVE_WEB_BACKEND_IE
106 return new wxIEPanel(parent
, id
, url
, pos
, size
, style
, name
);
109 // fall-through intended