]> git.saurik.com Git - wxWidgets.git/blame - src/common/webview.cpp
Update version to 2.9.4 in version.bkl too and rebake everything.
[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$
153530af 6// Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
61b98a2d
SL
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
384b8d9f
SL
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
88cc66f7 13#if wxUSE_WEBVIEW
9c805dec 14
384b8d9f
SL
15#if defined(__BORLANDC__)
16 #pragma hdrstop
17#endif
18
61b98a2d
SL
19#include "wx/webview.h"
20
91614f1a 21#if defined(__WXOSX_COCOA__) || defined(__WXOSX_CARBON__)
8290e3cd 22#include "wx/osx/webview_webkit.h"
91614f1a 23#elif defined(__WXGTK__)
8290e3cd 24#include "wx/gtk/webview_webkit.h"
91614f1a 25#elif defined(__WXMSW__)
8290e3cd 26#include "wx/msw/webview_ie.h"
91614f1a 27#endif
61b98a2d 28
3544f421
SL
29// DLL options compatibility check:
30#include "wx/app.h"
467d261e 31WX_CHECK_BUILD_OPTIONS("wxWEBVIEW")
3544f421 32
467d261e
SL
33extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewNameStr[] = "wxWebView";
34extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[] = "about:blank";
61b98a2d 35
cddf4541 36wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl);
04fa04d8
SL
37wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewEvent, wxCommandEvent);
38
39wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent );
40wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent );
41wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent );
42wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent );
43wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent );
44wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent );
61b98a2d
SL
45
46// static
47wxWebView* wxWebView::New(wxWebViewBackend backend)
48{
49 switch (backend)
50 {
9df97be2
SL
51 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
52 (defined(__WXGTK__) || defined(__WXOSX__))
53 case wxWEB_VIEW_BACKEND_WEBKIT:
54 return new wxWebViewWebKit();
61b98a2d
SL
55 #endif
56
ea179539 57 #if wxUSE_WEBVIEW_IE
9df97be2
SL
58 case wxWEB_VIEW_BACKEND_IE:
59 return new wxWebViewIE();
61b98a2d
SL
60 #endif
61
62 case wxWEB_VIEW_BACKEND_DEFAULT:
63
9df97be2
SL
64 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
65 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 66 return new wxWebViewWebKit();
61b98a2d
SL
67 #endif
68
ea179539 69 #if wxUSE_WEBVIEW_IE
97ad1425 70 return new wxWebViewIE();
61b98a2d
SL
71 #endif
72
73 // fall-through intended
74 default:
75 return NULL;
76 }
77}
78
79// static
80wxWebView* 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 {
9df97be2
SL
91 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
92 (defined(__WXGTK__) || defined(__WXOSX__))
93 case wxWEB_VIEW_BACKEND_WEBKIT:
94 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
61b98a2d
SL
95 #endif
96
ea179539 97 #if wxUSE_WEBVIEW_IE
9df97be2
SL
98 case wxWEB_VIEW_BACKEND_IE:
99 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
100 #endif
101
102 case wxWEB_VIEW_BACKEND_DEFAULT:
103
9df97be2
SL
104 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
105 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 106 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
61b98a2d
SL
107 #endif
108
ea179539 109 #if wxUSE_WEBVIEW_IE
97ad1425 110 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
111 #endif
112
113 // fall-through intended
114 default:
115 return NULL;
116 }
117}
9c805dec 118
88cc66f7 119#endif // wxUSE_WEBVIEW