]> git.saurik.com Git - wxWidgets.git/blame - src/common/webview.cpp
Rework the GTK WebKit backend history to remove the need for the map between wxWebHis...
[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
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 );
153530af 39wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
61b98a2d
SL
40
41// static
42wxWebView* wxWebView::New(wxWebViewBackend backend)
43{
44 switch (backend)
45 {
9df97be2
SL
46 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
47 (defined(__WXGTK__) || defined(__WXOSX__))
48 case wxWEB_VIEW_BACKEND_WEBKIT:
49 return new wxWebViewWebKit();
61b98a2d
SL
50 #endif
51
ea179539 52 #if wxUSE_WEBVIEW_IE
9df97be2
SL
53 case wxWEB_VIEW_BACKEND_IE:
54 return new wxWebViewIE();
61b98a2d
SL
55 #endif
56
57 case wxWEB_VIEW_BACKEND_DEFAULT:
58
9df97be2
SL
59 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
60 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 61 return new wxWebViewWebKit();
61b98a2d
SL
62 #endif
63
ea179539 64 #if wxUSE_WEBVIEW_IE
97ad1425 65 return new wxWebViewIE();
61b98a2d
SL
66 #endif
67
68 // fall-through intended
69 default:
70 return NULL;
71 }
72}
73
74// static
75wxWebView* wxWebView::New(wxWindow* parent,
76 wxWindowID id,
77 const wxString& url,
78 const wxPoint& pos,
79 const wxSize& size,
80 wxWebViewBackend backend,
81 long style,
82 const wxString& name)
83{
84 switch (backend)
85 {
9df97be2
SL
86 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
87 (defined(__WXGTK__) || defined(__WXOSX__))
88 case wxWEB_VIEW_BACKEND_WEBKIT:
89 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
61b98a2d
SL
90 #endif
91
ea179539 92 #if wxUSE_WEBVIEW_IE
9df97be2
SL
93 case wxWEB_VIEW_BACKEND_IE:
94 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
95 #endif
96
97 case wxWEB_VIEW_BACKEND_DEFAULT:
98
9df97be2
SL
99 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
100 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 101 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
61b98a2d
SL
102 #endif
103
ea179539 104 #if wxUSE_WEBVIEW_IE
97ad1425 105 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
106 #endif
107
108 // fall-through intended
109 default:
110 return NULL;
111 }
112}
9c805dec
SL
113
114#endif // wxUSE_WEB