Various typos fixes and minor build system changes. After a rebake wxMSW should now...
[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 defined(__BORLANDC__)
14 #pragma hdrstop
15 #endif
16
17 #include "wx/webview.h"
18
19 #include "wx/osx/webview.h"
20 #include "wx/gtk/webview.h"
21 #include "wx/msw/webviewie.h"
22
23 extern WXDLLEXPORT_DATA(const char) wxWebViewNameStr[] = "wxWebView";
24 extern WXDLLEXPORT_DATA(const char) wxWebViewDefaultURLStr[] = "about:blank";
25
26 IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent)
27
28 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
29 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
30 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
31 wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
32
33 // static
34 wxWebView* wxWebView::New(wxWebViewBackend backend)
35 {
36 switch (backend)
37 {
38 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
39 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
40 return new wxOSXWebKitCtrl();
41 #endif
42
43 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
44 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
45 return new wxGtkWebKitCtrl();
46 #endif
47
48 #if wxHAVE_WEB_BACKEND_IE
49 case wxWEB_VIEW_BACKEND_IE:
50 return new wxIEPanel();
51 #endif
52
53 case wxWEB_VIEW_BACKEND_DEFAULT:
54
55 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
56 return new wxOSXWebKitCtrl();
57 #endif
58
59 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
60 return new wxGtkWebKitCtrl();
61 #endif
62
63 #if wxHAVE_WEB_BACKEND_IE
64 return new wxIEPanel();
65 #endif
66
67 // fall-through intended
68 default:
69 return NULL;
70 }
71 }
72
73 // static
74 wxWebView* wxWebView::New(wxWindow* parent,
75 wxWindowID id,
76 const wxString& url,
77 const wxPoint& pos,
78 const wxSize& size,
79 wxWebViewBackend backend,
80 long style,
81 const wxString& name)
82 {
83 switch (backend)
84 {
85 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
86 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
87 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style,
88 name);
89 #endif
90
91 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
92 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
93 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style,
94 name);
95 #endif
96
97 #if wxHAVE_WEB_BACKEND_IE
98 case wxWEB_VIEW_BACKEND_IE:
99 return new wxIEPanel(parent, id, url, pos, size, style, name);
100 #endif
101
102 case wxWEB_VIEW_BACKEND_DEFAULT:
103
104 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
105 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
106 #endif
107
108 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
109 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style, name);
110 #endif
111
112 #if wxHAVE_WEB_BACKEND_IE
113 return new wxIEPanel(parent, id, url, pos, size, style, name);
114 #endif
115
116 // fall-through intended
117 default:
118 return NULL;
119 }
120 }