]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/webview.cpp
Get the page title from the IHtmlDocument rather than the bowser as it actually retur...
[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
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
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 );
38wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
39
40// static
41wxWebView* wxWebView::New(wxWebViewBackend backend)
42{
43 switch (backend)
44 {
45 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXOSX__)
46 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
47 return new wxOSXWebKitCtrl();
48 #endif
49
50 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXGTK__)
51 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
52 return new wxWebViewWebKit();
53 #endif
54
55 #if wxUSE_WEBVIEW_IE
56 case wxWEB_VIEW_BACKEND_IE:
57 return new wxWebViewIE();
58 #endif
59
60 case wxWEB_VIEW_BACKEND_DEFAULT:
61
62 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXOSX__)
63 return new wxOSXWebKitCtrl();
64 #endif
65
66 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXGTK__)
67 return new wxWebViewWebKit();
68 #endif
69
70 #if wxUSE_WEBVIEW_IE
71 return new wxWebViewIE();
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 defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXOSX__)
93 case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
94 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style,
95 name);
96 #endif
97
98 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXGTK__)
99 case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
100 return new wxWebViewWebKit(parent, id, url, pos, size, style,
101 name);
102 #endif
103
104 #if wxUSE_WEBVIEW_IE
105 case wxWEB_VIEW_BACKEND_IE:
106 return new wxWebViewIE(parent, id, url, pos, size, style, name);
107 #endif
108
109 case wxWEB_VIEW_BACKEND_DEFAULT:
110
111 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXOSX__)
112 return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
113 #endif
114
115 #if defined(wxUSE_WEBVIEW_WEBKIT) && defined(__WXGTK__)
116 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
117 #endif
118
119 #if wxUSE_WEBVIEW_IE
120 return new wxWebViewIE(parent, id, url, pos, size, style, name);
121 #endif
122
123 // fall-through intended
124 default:
125 return NULL;
126 }
127}
128
129#endif // wxUSE_WEB