Enable IE backend in msw builds unconditionally until the backend flags work properly...
[wxWidgets.git] / src / common / webview.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: webview.cpp
3 // Purpose: Common interface and events for web view component
4 // Author: Marianne Gagnon
5 // Id: $Id$
6 // Copyright: (c) 2010 Marianne Gagnon
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #if wxUSE_WEB
14
15 #if defined(__BORLANDC__)
16 #pragma hdrstop
17 #endif
18
19 #include "wx/webview.h"
20
21 #include "wx/osx/webview.h"
22 #include "wx/gtk/webview.h"
23 #include "wx/msw/webviewie.h"
24
25 // DLL options compatibility check:
26 #include "wx/app.h"
27 WX_CHECK_BUILD_OPTIONS("wxWEB")
28
29 extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
30 extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
31
32 IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent)
33
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
39 // static
40 wxWebView* wxWebView::New(wxWebViewBackend backend)
41 {
42 switch (backend)
43 {
44 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
45 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
46 return new wxOSXWebKitCtrl();
47 #endif
48
49 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
50 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
51 return new wxGtkWebKitCtrl();
52 #endif
53
54 #if wxHAVE_WEB_BACKEND_IE
55 case wxWEB_VIEW_BACKEND_IE:
56 return new wxWebViewIE();
57 #endif
58
59 case wxWEB_VIEW_BACKEND_DEFAULT:
60
61 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
62 return new wxOSXWebKitCtrl();
63 #endif
64
65 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
66 return new wxGtkWebKitCtrl();
67 #endif
68
69 #if wxHAVE_WEB_BACKEND_IE
70 return new wxWebViewIE();
71 #endif
72
73 // fall-through intended
74 default:
75 return NULL;
76 }
77 }
78
79 // static
80 wxWebView* wxWebView::New(wxWindow* parent,
81 wxWindowID id,
82 const wxString& url,
83 const wxPoint& pos,
84 const wxSize& size,
85 wxWebViewBackend backend,
86 long style,
87 const wxString& name)
88 {
89 switch (backend)
90 {
91 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
92 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
93 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style,
94 name);
95 #endif
96
97 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
98 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
99 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style,
100 name);
101 #endif
102
103 #if wxHAVE_WEB_BACKEND_IE
104 case wxWEB_VIEW_BACKEND_IE:
105 return new wxWebViewIE(parent, id, url, pos, size, style, name);
106 #endif
107
108 case wxWEB_VIEW_BACKEND_DEFAULT:
109
110 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
111 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
112 #endif
113
114 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
115 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style, name);
116 #endif
117
118 #if wxHAVE_WEB_BACKEND_IE
119 return new wxWebViewIE(parent, id, url, pos, size, style, name);
120 #endif
121
122 // fall-through intended
123 default:
124 return NULL;
125 }
126 }
127
128 #endif // wxUSE_WEB