-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebview.cpp
106 lines (86 loc) · 6.3 KB
/
webview.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/////////////////////////////////////////////////////////////////////////////
// Name: webview.cpp
// Purpose: Common interface and events for web view component
// Author: Marianne Gagnon
// Id: $Id$
// Copyright: (c) 2010 Marianne Gagnon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "webview.h"
#include "wxiepanel.h"
IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent)
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
// static
wxWebView* wxWebView::GetNew(wxWebViewBackend backend)
{
switch (backend)
{
#if wxHAVE_WEB_BACKEND_OSX_WEBKIT
case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
return new wxOSXWebKitCtrl();
#endif
#if wxHAVE_WEB_BACKEND_GTK_WEBKIT
case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
return new wxGtkWebKitCtrl();
#endif
#if wxHAVE_WEB_BACKEND_IE
case wxWEB_VIEW_BACKEND_IE:
return new wxIEPanel();
#endif
case wxWEB_VIEW_BACKEND_DEFAULT:
#if wxHAVE_WEB_BACKEND_OSX_WEBKIT
return new wxOSXWebKitCtrl();
#endif
#if wxHAVE_WEB_BACKEND_GTK_WEBKIT
return new wxGtkWebKitCtrl();
#endif
#if wxHAVE_WEB_BACKEND_IE
return new wxIEPanel();
#endif
// fall-through intended
default:
return NULL;
}
}
// static
wxWebView* wxWebView::GetNew(wxWindow* parent,
wxWindowID id,
const wxString& url,
const wxPoint& pos,
const wxSize& size,
wxWebViewBackend backend,
long style,
const wxString& name)
{
switch (backend)
{
#if wxHAVE_WEB_BACKEND_OSX_WEBKIT
case wxWEB_VIEW_BACKEND_OSX_WEBKIT:
return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
#endif
#if wxHAVE_WEB_BACKEND_GTK_WEBKIT
case wxWEB_VIEW_BACKEND_GTK_WEBKIT:
return new wxGtkWebKitCtrl(parent, id, url, pos, size, style, name);
#endif
#if wxHAVE_WEB_BACKEND_IE
case wxWEB_VIEW_BACKEND_IE:
return new wxIEPanel(parent, id, url, pos, size, style, name);
#endif
case wxWEB_VIEW_BACKEND_DEFAULT:
#if wxHAVE_WEB_BACKEND_OSX_WEBKIT
return new wxOSXWebKitCtrl(parent, id, url, pos, size, style, name);
#endif
#if wxHAVE_WEB_BACKEND_GTK_WEBKIT
return new wxGtkWebKitCtrl(parent, id, url, pos, size, style, name);
#endif
#if wxHAVE_WEB_BACKEND_IE
return new wxIEPanel(parent, id, url, pos, size, style, name);
#endif
// fall-through intended
default:
return NULL;
}
}