]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/webkit.i
Add parent parameter to BusyInfo
[wxWidgets.git] / wxPython / src / webkit.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: webkit.i
3 // Purpose: Embedding Apple's WebKit in wxWidgets
4 //
5 // Author: Robin Dunn / Kevin Ollivier
6 //
7 // Created: 18-Oct-2004
8 // RCS-ID: $Id$
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %define DOCSTRING
14 "wx.webkit.WebKitCtrl for Mac OSX."
15 %enddef
16
17 %module(package="wx", docstring=DOCSTRING) webkit
18
19 %{
20
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23 #include "wx/wxPython/pyistream.h"
24
25 #ifdef __WXMAC__ // avoid a bug in Carbon headers
26 #define scalb scalbn
27 #endif
28
29 #if wxUSE_WEBKIT
30 #include "wx/html/webkit.h"
31 #endif
32 %}
33
34 //---------------------------------------------------------------------------
35
36 %import core.i
37 %pythoncode { wx = _core }
38 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
39
40
41 //---------------------------------------------------------------------------
42
43 // Put some wx default wxChar* values into wxStrings.
44 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
45 MAKE_CONST_WXSTRING2(WebKitNameStr, wxT("webkitctrl"))
46
47
48
49
50 %{
51 #if !wxUSE_WEBKIT
52 // a dummy class for ports that don't have wxWebKitCtrl
53 class wxWebKitCtrl : public wxControl
54 {
55 public:
56 wxWebKitCtrl(wxWindow *parent,
57 wxWindowID winID,
58 const wxString& strURL,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize, long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxPyWebKitNameStr)
63 { wxPyRaiseNotImplemented(); }
64
65 wxWebKitCtrl() { wxPyRaiseNotImplemented(); }
66
67 bool Create(wxWindow *parent,
68 wxWindowID winID,
69 const wxString& strURL,
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxDefaultSize, long style = 0,
72 const wxValidator& validator = wxDefaultValidator,
73 const wxString& name = wxPyWebKitNameStr)
74 { return false; }
75
76 void LoadURL(const wxString &url) {}
77
78 bool CanGoBack() { return false; }
79 bool CanGoForward() { return false; }
80 bool GoBack() { return false; }
81 bool GoForward() { return false; }
82 void Reload() {}
83 void Stop() {}
84 bool CanGetPageSource() { return false; }
85 wxString GetPageSource() { return wxEmptyString; }
86 void SetPageSource(wxString& source, const wxString& baseUrl = wxEmptyString) {}
87 wxString GetPageURL() { return wxEmptyString; }
88 wxString GetPageTitle() { return wxEmptyString; }
89
90 wxString GetSelection() { return wxEmptyString; }
91
92 bool CanIncreaseTextSize() { return false; }
93 void IncreaseTextSize() { }
94 bool CanDecreaseTextSize() { return false; }
95 void DecreaseTextSize() { }
96
97 void Print(bool showPrompt=false) { }
98
99 void MakeEditable(bool enable=true) { }
100 bool IsEditable() { return false; }
101
102 wxString RunScript(const wxString& javascript) { return wxEmptyString; }
103
104 void SetScrollPos(int pos) { }
105 int GetScrollPos() { return 0; }
106
107 };
108
109
110 enum {
111 wxWEBKIT_STATE_START = 0,
112 wxWEBKIT_STATE_NEGOTIATING = 0,
113 wxWEBKIT_STATE_REDIRECTING = 0,
114 wxWEBKIT_STATE_TRANSFERRING = 0,
115 wxWEBKIT_STATE_STOP = 0,
116 wxWEBKIT_STATE_FAILED = 0,
117
118 wxEVT_WEBKIT_STATE_CHANGED = 0,
119 wxEVT_WEBKIT_BEFORE_LOAD = 0
120 };
121
122 enum {
123 wxWEBKIT_NAV_LINK_CLICKED = 0,
124 wxWEBKIT_NAV_BACK_NEXT = 0,
125 wxWEBKIT_NAV_FORM_SUBMITTED = 0,
126 wxWEBKIT_NAV_RELOAD = 0,
127 wxWEBKIT_NAV_FORM_RESUBMITTED = 0,
128 wxWEBKIT_NAV_OTHER = 0
129
130 };
131
132 class wxWebKitStateChangedEvent : public wxCommandEvent
133 {
134 public:
135 wxWebKitStateChangedEvent( wxWindow* win = NULL )
136 { wxPyRaiseNotImplemented(); }
137
138 int GetState() { return 0; }
139 void SetState(const int state) {}
140 wxString GetURL() { return wxEmptyString; }
141 void SetURL(const wxString& url) {}
142 };
143
144 class wxWebKitBeforeLoadEvent : public wxCommandEvent
145 {
146 public:
147 bool IsCancelled() { return false; }
148 void Cancel(bool cancel = true) { }
149 wxString GetURL() { return wxEmptyString; }
150 void SetURL(const wxString& url) { }
151 void SetNavigationType(int navType) { }
152 int GetNavigationType() { return 0; }
153
154 wxWebKitBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ) { wxPyRaiseNotImplemented(); }
155 };
156
157 #endif
158 %}
159
160 // Now define it for SWIG, using either the real class or the dummy above.
161
162 MustHaveApp(wxWebKitCtrl);
163
164 class wxWebKitCtrl : public wxControl
165 {
166 public:
167 %pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
168 %pythonAppend wxWebKitCtrl() ""
169
170 wxWebKitCtrl(wxWindow *parent,
171 wxWindowID winID = -1,
172 const wxString& strURL = wxPyEmptyString,
173 const wxPoint& pos = wxDefaultPosition,
174 const wxSize& size = wxDefaultSize, long style = 0,
175 const wxValidator& validator = wxDefaultValidator,
176 const wxString& name = wxPyWebKitNameStr);
177
178 %RenameCtor(PreWebKitCtrl, wxWebKitCtrl());
179
180
181 bool Create(wxWindow *parent,
182 wxWindowID winID = -1,
183 const wxString& strURL = wxPyEmptyString,
184 const wxPoint& pos = wxDefaultPosition,
185 const wxSize& size = wxDefaultSize, long style = 0,
186 const wxValidator& validator = wxDefaultValidator,
187 const wxString& name = wxPyWebKitNameStr);
188
189 void LoadURL(const wxString &url);
190
191 bool CanGoBack();
192 bool CanGoForward();
193 bool GoBack();
194 bool GoForward();
195 void Reload();
196 void Stop();
197 bool CanGetPageSource();
198 wxString GetPageSource();
199 void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
200 wxString GetPageURL();
201 wxString GetPageTitle();
202
203 wxString GetSelection();
204
205 bool CanIncreaseTextSize();
206 void IncreaseTextSize();
207 bool CanDecreaseTextSize();
208 void DecreaseTextSize();
209
210 void Print(bool showPrompt=false);
211
212 void MakeEditable(bool enable=true);
213 bool IsEditable();
214
215 wxString RunScript(const wxString& javascript);
216
217 void SetScrollPos(int pos);
218 int GetScrollPos();
219
220
221 %property(PageSource, GetPageSource, SetPageSource, doc="See `GetPageSource` and `SetPageSource`");
222 %property(PageTitle, GetPageTitle, doc="See `GetPageTitle`");
223 %property(PageURL, GetPageURL, doc="See `GetPageURL`");
224 %property(ScrollPos, GetScrollPos, SetScrollPos, doc="See `GetScrollPos and SetScrollPos`");
225 %property(Selection, GetSelection, doc="See `GetSelection`");
226 };
227
228
229 //---------------------------------------------------------------------------
230
231
232 enum {
233 wxWEBKIT_STATE_START,
234 wxWEBKIT_STATE_NEGOTIATING,
235 wxWEBKIT_STATE_REDIRECTING,
236 wxWEBKIT_STATE_TRANSFERRING,
237 wxWEBKIT_STATE_STOP,
238 wxWEBKIT_STATE_FAILED,
239 };
240
241 enum {
242 wxWEBKIT_NAV_LINK_CLICKED,
243 wxWEBKIT_NAV_BACK_NEXT,
244 wxWEBKIT_NAV_FORM_SUBMITTED,
245 wxWEBKIT_NAV_RELOAD,
246 wxWEBKIT_NAV_FORM_RESUBMITTED,
247 wxWEBKIT_NAV_OTHER
248
249 };
250
251 %constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
252 %constant wxEventType wxEVT_WEBKIT_BEFORE_LOAD;
253
254 class wxWebKitBeforeLoadEvent : public wxCommandEvent
255 {
256 public:
257 bool IsCancelled();
258 void Cancel(bool cancel = true);
259 wxString GetURL();
260 void SetURL(const wxString& url);
261 void SetNavigationType(int navType);
262 int GetNavigationType();
263
264 wxWebKitBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL );
265
266 %property(NavigationType, GetNavigationType, SetNavigationType, doc="See `GetNavigationType` and `SetNavigationType`");
267 %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`");
268 };
269
270
271 class wxWebKitStateChangedEvent : public wxCommandEvent
272 {
273 public:
274 wxWebKitStateChangedEvent( wxWindow* win = NULL );
275
276 int GetState();
277 void SetState(const int state);
278 wxString GetURL();
279 void SetURL(const wxString& url);
280
281 %property(State, GetState, SetState, doc="See `GetState` and `SetState`");
282 %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`");
283 };
284
285
286 %pythoncode %{
287 EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
288 EVT_WEBKIT_BEFORE_LOAD = wx.PyEventBinder(wxEVT_WEBKIT_BEFORE_LOAD)
289 %}
290
291
292 //---------------------------------------------------------------------------
293
294 %init %{
295
296 %}
297
298 //---------------------------------------------------------------------------