]>
Commit | Line | Data |
---|---|---|
61b98a2d SL |
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 | ||
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" | |
27 | WX_CHECK_BUILD_OPTIONS("wxWEB") | |
28 | ||
9c805dec SL |
29 | extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView"; |
30 | extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank"; | |
61b98a2d SL |
31 | |
32 | IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent) | |
33 | ||
34 | wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent ); | |
35 | wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent ); | |
36 | wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent ); | |
37 | wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent ); | |
853b6cd0 | 38 | wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent ); |
61b98a2d SL |
39 | |
40 | // static | |
41 | wxWebView* wxWebView::New(wxWebViewBackend backend) | |
42 | { | |
43 | switch (backend) | |
44 | { | |
9df97be2 SL |
45 | #if defined(wxUSE_WEBVIEW_WEBKIT) && \ |
46 | (defined(__WXGTK__) || defined(__WXOSX__)) | |
47 | case wxWEB_VIEW_BACKEND_WEBKIT: | |
48 | return new wxWebViewWebKit(); | |
61b98a2d SL |
49 | #endif |
50 | ||
ea179539 | 51 | #if wxUSE_WEBVIEW_IE |
9df97be2 SL |
52 | case wxWEB_VIEW_BACKEND_IE: |
53 | return new wxWebViewIE(); | |
61b98a2d SL |
54 | #endif |
55 | ||
56 | case wxWEB_VIEW_BACKEND_DEFAULT: | |
57 | ||
9df97be2 SL |
58 | #if defined(wxUSE_WEBVIEW_WEBKIT) && \ |
59 | (defined(__WXGTK__) || defined(__WXOSX__)) | |
b64b4e70 | 60 | return new wxWebViewWebKit(); |
61b98a2d SL |
61 | #endif |
62 | ||
ea179539 | 63 | #if wxUSE_WEBVIEW_IE |
97ad1425 | 64 | return new wxWebViewIE(); |
61b98a2d SL |
65 | #endif |
66 | ||
67 | // fall-through intended | |
68 | default: | |
69 | return NULL; | |
70 | } | |
71 | } | |
72 | ||
73 | // static | |
74 | wxWebView* wxWebView::New(wxWindow* parent, | |
75 | wxWindowID id, | |
76 | const wxString& url, | |
77 | const wxPoint& pos, | |
78 | const wxSize& size, | |
79 | wxWebViewBackend backend, | |
80 | long style, | |
81 | const wxString& name) | |
82 | { | |
83 | switch (backend) | |
84 | { | |
9df97be2 SL |
85 | #if defined(wxUSE_WEBVIEW_WEBKIT) && \ |
86 | (defined(__WXGTK__) || defined(__WXOSX__)) | |
87 | case wxWEB_VIEW_BACKEND_WEBKIT: | |
88 | return new wxWebViewWebKit(parent, id, url, pos, size, style, name); | |
61b98a2d SL |
89 | #endif |
90 | ||
ea179539 | 91 | #if wxUSE_WEBVIEW_IE |
9df97be2 SL |
92 | case wxWEB_VIEW_BACKEND_IE: |
93 | return new wxWebViewIE(parent, id, url, pos, size, style, name); | |
61b98a2d SL |
94 | #endif |
95 | ||
96 | case wxWEB_VIEW_BACKEND_DEFAULT: | |
97 | ||
9df97be2 SL |
98 | #if defined(wxUSE_WEBVIEW_WEBKIT) && \ |
99 | (defined(__WXGTK__) || defined(__WXOSX__)) | |
b64b4e70 | 100 | return new wxWebViewWebKit(parent, id, url, pos, size, style, name); |
61b98a2d SL |
101 | #endif |
102 | ||
ea179539 | 103 | #if wxUSE_WEBVIEW_IE |
97ad1425 | 104 | return new wxWebViewIE(parent, id, url, pos, size, style, name); |
61b98a2d SL |
105 | #endif |
106 | ||
107 | // fall-through intended | |
108 | default: | |
109 | return NULL; | |
110 | } | |
111 | } | |
9c805dec SL |
112 | |
113 | #endif // wxUSE_WEB |