]> git.saurik.com Git - wxWidgets.git/blame - src/common/webview.cpp
Fix a number of mingw compile errors.
[wxWidgets.git] / src / common / webview.cpp
CommitLineData
61b98a2d
SL
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
384b8d9f
SL
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
9c805dec
SL
13#if wxUSE_WEB
14
384b8d9f
SL
15#if defined(__BORLANDC__)
16 #pragma hdrstop
17#endif
18
61b98a2d
SL
19#include "wx/webview.h"
20
8290e3cd
SL
21#include "wx/osx/webview_webkit.h"
22#include "wx/gtk/webview_webkit.h"
23#include "wx/msw/webview_ie.h"
61b98a2d 24
3544f421
SL
25// DLL options compatibility check:
26#include "wx/app.h"
27WX_CHECK_BUILD_OPTIONS("wxWEB")
28
9c805dec
SL
29extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
30extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
61b98a2d
SL
31
32IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent)
33
34wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
35wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
36wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
37wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
853b6cd0 38wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
61b98a2d
SL
39
40// static
41wxWebView* wxWebView::New(wxWebViewBackend backend)
42{
43 switch (backend)
44 {
45 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
46 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
47 return new wxOSXWebKitCtrl();
48 #endif
49
50 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
51 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
52 return new wxGtkWebKitCtrl();
53 #endif
54
55 #if wxHAVE_WEB_BACKEND_IE
56 case wxWEB_VIEW_BACKEND_IE:
97ad1425 57 return new wxWebViewIE();
61b98a2d
SL
58 #endif
59
60 case wxWEB_VIEW_BACKEND_DEFAULT:
61
62 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
63 return new wxOSXWebKitCtrl();
64 #endif
65
66 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
67 return new wxGtkWebKitCtrl();
68 #endif
69
70 #if wxHAVE_WEB_BACKEND_IE
97ad1425 71 return new wxWebViewIE();
61b98a2d
SL
72 #endif
73
74 // fall-through intended
75 default:
76 return NULL;
77 }
78}
79
80// static
81wxWebView* wxWebView::New(wxWindow* parent,
82 wxWindowID id,
83 const wxString& url,
84 const wxPoint& pos,
85 const wxSize& size,
86 wxWebViewBackend backend,
87 long style,
88 const wxString& name)
89{
90 switch (backend)
91 {
92 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
93 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
94 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style,
95 name);
96 #endif
97
98 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
99 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
100 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style,
101 name);
102 #endif
103
104 #if wxHAVE_WEB_BACKEND_IE
105 case wxWEB_VIEW_BACKEND_IE:
97ad1425 106 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
107 #endif
108
109 case wxWEB_VIEW_BACKEND_DEFAULT:
110
111 #if wxHAVE_WEB_BACKEND_OSX_WEBKIT
112 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
113 #endif
114
115 #if wxHAVE_WEB_BACKEND_GTK_WEBKIT
116 return new wxGtkWebKitCtrl(parent, id, url, pos, size, style, name);
117 #endif
118
119 #if wxHAVE_WEB_BACKEND_IE
97ad1425 120 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
121 #endif
122
123 // fall-through intended
124 default:
125 return NULL;
126 }
127}
9c805dec
SL
128
129#endif // wxUSE_WEB