]> git.saurik.com Git - wxWidgets.git/blame - src/common/webview.cpp
fixing osx_carbon
[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 31
cddf4541
SL
32wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl);
33wxIMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent);
61b98a2d
SL
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 );
853b6cd0 39wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
153530af 40wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
61b98a2d
SL
41
42// static
43wxWebView* wxWebView::New(wxWebViewBackend backend)
44{
45 switch (backend)
46 {
9df97be2
SL
47 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
48 (defined(__WXGTK__) || defined(__WXOSX__))
49 case wxWEB_VIEW_BACKEND_WEBKIT:
50 return new wxWebViewWebKit();
61b98a2d
SL
51 #endif
52
ea179539 53 #if wxUSE_WEBVIEW_IE
9df97be2
SL
54 case wxWEB_VIEW_BACKEND_IE:
55 return new wxWebViewIE();
61b98a2d
SL
56 #endif
57
58 case wxWEB_VIEW_BACKEND_DEFAULT:
59
9df97be2
SL
60 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
61 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 62 return new wxWebViewWebKit();
61b98a2d
SL
63 #endif
64
ea179539 65 #if wxUSE_WEBVIEW_IE
97ad1425 66 return new wxWebViewIE();
61b98a2d
SL
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 {
9df97be2
SL
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);
61b98a2d
SL
91 #endif
92
ea179539 93 #if wxUSE_WEBVIEW_IE
9df97be2
SL
94 case wxWEB_VIEW_BACKEND_IE:
95 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
96 #endif
97
98 case wxWEB_VIEW_BACKEND_DEFAULT:
99
9df97be2
SL
100 #if defined(wxUSE_WEBVIEW_WEBKIT) && \
101 (defined(__WXGTK__) || defined(__WXOSX__))
b64b4e70 102 return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
61b98a2d
SL
103 #endif
104
ea179539 105 #if wxUSE_WEBVIEW_IE
97ad1425 106 return new wxWebViewIE(parent, id, url, pos, size, style, name);
61b98a2d
SL
107 #endif
108
109 // fall-through intended
110 default:
111 return NULL;
112 }
113}
9c805dec
SL
114
115#endif // wxUSE_WEB