]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/webview.cpp
Use the data scheme to load resources in the WebKitGTK+ implementation, rather than...
[wxWidgets.git] / src / common / webview.cpp
... / ...
CommitLineData
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, 2011 Steven Lamerton
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_webkit.h"
22#include "wx/gtk/webview_webkit.h"
23#include "wx/msw/webview_ie.h"
24
25// DLL options compatibility check:
26#include "wx/app.h"
27WX_CHECK_BUILD_OPTIONS("wxWEB")
28
29extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
30extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
31
32wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl);
33wxIMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent);
34
35wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
36wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
37wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
38wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
39wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
40wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
41
42// static
43wxWebView* wxWebView::New(wxWebViewBackend backend)
44{
45 switch (backend)
46 {
47 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
48 (defined(__WXGTK__) || defined(__WXOSX__))
49 case wxWEB_VIEW_BACKEND_WEBKIT:
50 return new wxWebViewWebKit();
51 #endif
52
53 #if wxUSE_WEBVIEW_IE
54 case wxWEB_VIEW_BACKEND_IE:
55 return new wxWebViewIE();
56 #endif
57
58 case wxWEB_VIEW_BACKEND_DEFAULT:
59
60 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
61 (defined(__WXGTK__) || defined(__WXOSX__))
62 return new wxWebViewWebKit();
63 #endif
64
65 #if wxUSE_WEBVIEW_IE
66 return new wxWebViewIE();
67 #endif
68
69 // fall-through intended
70 default:
71 return NULL;
72 }
73}
74
75// static
76wxWebView* wxWebView::New(wxWindow* parent,
77 wxWindowID id,
78 const wxString& url,
79 const wxPoint& pos,
80 const wxSize& size,
81 wxWebViewBackend backend,
82 long style,
83 const wxString& name)
84{
85 switch (backend)
86 {
87 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
88 (defined(__WXGTK__) || defined(__WXOSX__))
89 case wxWEB_VIEW_BACKEND_WEBKIT:
90 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
91 #endif
92
93 #if wxUSE_WEBVIEW_IE
94 case wxWEB_VIEW_BACKEND_IE:
95 return new wxWebViewIE(parent, id, url, pos, size, style, name);
96 #endif
97
98 case wxWEB_VIEW_BACKEND_DEFAULT:
99
100 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
101 (defined(__WXGTK__) || defined(__WXOSX__))
102 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
103 #endif
104
105 #if wxUSE_WEBVIEW_IE
106 return new wxWebViewIE(parent, id, url, pos, size, style, name);
107 #endif
108
109 // fall-through intended
110 default:
111 return NULL;
112 }
113}
114
115#endif // wxUSE_WEB