]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/webkit.i
Add GetDateOnly
[wxWidgets.git] / wxPython / src / webkit.i
CommitLineData
5ed68428
KO
1/////////////////////////////////////////////////////////////////////////////
2// Name: webkit.i
3// Purpose: Embedding Apple's WebKit in wxWidgets
4//
5// Author: Robin Dunn / Kevin Ollivier
6//
f6f1e19f 7// Created: 18-Oct-2004
5ed68428 8// RCS-ID: $Id$
f6f1e19f 9// Copyright: (c) 2004 by Total Control Software
5ed68428
KO
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
9d9cbcdd
RD
13%define DOCSTRING
14"wx.webkit.WebKitCtrl for Mac OSX."
15%enddef
16
17%module(package="wx", docstring=DOCSTRING) webkit
5ed68428
KO
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
f6f1e19f 29#if wxUSE_WEBKIT
5ed68428 30#include "wx/html/webkit.h"
f6f1e19f 31#endif
5ed68428
KO
32%}
33
34//---------------------------------------------------------------------------
35
5ed68428 36%import core.i
f6f1e19f
RD
37%pythoncode { wx = _core }
38%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
5ed68428 39
5ed68428 40
5ed68428
KO
41//---------------------------------------------------------------------------
42
f6f1e19f
RD
43// Put some wx default wxChar* values into wxStrings.
44MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
45MAKE_CONST_WXSTRING2(WebKitNameStr, wxT("webkitctrl"))
46
47
5ed68428 48
f6f1e19f 49
5ed68428
KO
50%{
51#if !wxUSE_WEBKIT
f6f1e19f 52// a dummy class for ports that don't have wxWebKitCtrl
5ed68428
KO
53class wxWebKitCtrl : public wxControl
54{
55public:
56 wxWebKitCtrl(wxWindow *parent,
f6f1e19f
RD
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
5ed68428
KO
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,
f6f1e19f
RD
73 const wxString& name = wxPyWebKitNameStr)
74 { return false; }
5ed68428
KO
75
76 void LoadURL(const wxString &url) {}
77
f6f1e19f
RD
78 bool CanGoBack() { return false; }
79 bool CanGoForward() { return false; }
80 bool GoBack() { return false; }
81 bool GoForward() { return false; }
5ed68428 82 void Reload() {}
f6f1e19f
RD
83 void Stop() {}
84 bool CanGetPageSource() { return false; }
85 wxString GetPageSource() { return wxEmptyString; }
86 void SetPageSource(wxString& source, const wxString& baseUrl = wxEmptyString) {}
f18ba20c
RD
87 wxString GetPageURL() { return wxEmptyString; }
88 wxString GetPageTitle() { return wxEmptyString; }
448f8f12
KO
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
5ed68428 107};
9d9cbcdd
RD
108
109
110enum {
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,
4d00d250 117
7aa69ab2
RD
118 wxEVT_WEBKIT_STATE_CHANGED = 0,
119 wxEVT_WEBKIT_BEFORE_LOAD = 0
9d9cbcdd
RD
120};
121
448f8f12
KO
122enum {
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
9d9cbcdd
RD
132class wxWebKitStateChangedEvent : public wxCommandEvent
133{
134public:
135 wxWebKitStateChangedEvent( wxWindow* win = NULL )
136 { wxPyRaiseNotImplemented(); }
137
4d00d250 138 int GetState() { return 0; }
9d9cbcdd
RD
139 void SetState(const int state) {}
140 wxString GetURL() { return wxEmptyString; }
141 void SetURL(const wxString& url) {}
142};
143
448f8f12
KO
144class wxWebKitBeforeLoadEvent : public wxCommandEvent
145{
146public:
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
7aa69ab2 154 wxWebKitBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ) { wxPyRaiseNotImplemented(); }
448f8f12 155};
9d9cbcdd 156
5ed68428
KO
157#endif
158%}
159
b7a2ebe6 160// Now define it for SWIG, using either the real class or the dummy above.
9d9cbcdd
RD
161
162MustHaveApp(wxWebKitCtrl);
163
5ed68428
KO
164class wxWebKitCtrl : public wxControl
165{
166public:
9d9cbcdd
RD
167 %pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
168 %pythonAppend wxWebKitCtrl() ""
169
5ed68428 170 wxWebKitCtrl(wxWindow *parent,
9d9cbcdd
RD
171 wxWindowID winID = -1,
172 const wxString& strURL = wxPyEmptyString,
5ed68428
KO
173 const wxPoint& pos = wxDefaultPosition,
174 const wxSize& size = wxDefaultSize, long style = 0,
175 const wxValidator& validator = wxDefaultValidator,
f6f1e19f
RD
176 const wxString& name = wxPyWebKitNameStr);
177
1b8c7ba6 178 %RenameCtor(PreWebKitCtrl, wxWebKitCtrl());
f6f1e19f
RD
179
180
5ed68428 181 bool Create(wxWindow *parent,
9d9cbcdd
RD
182 wxWindowID winID = -1,
183 const wxString& strURL = wxPyEmptyString,
5ed68428
KO
184 const wxPoint& pos = wxDefaultPosition,
185 const wxSize& size = wxDefaultSize, long style = 0,
186 const wxValidator& validator = wxDefaultValidator,
f6f1e19f 187 const wxString& name = wxPyWebKitNameStr);
5ed68428
KO
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();
f6f1e19f 199 void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
f18ba20c
RD
200 wxString GetPageURL();
201 wxString GetPageTitle();
e70b4d2d 202
448f8f12
KO
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
e70b4d2d
RD
221 %property(PageSource, GetPageSource, SetPageSource, doc="See `GetPageSource` and `SetPageSource`");
222 %property(PageTitle, GetPageTitle, doc="See `GetPageTitle`");
223 %property(PageURL, GetPageURL, doc="See `GetPageURL`");
448f8f12
KO
224 %property(ScrollPos, GetScrollPos, SetScrollPos, doc="See `GetScrollPos and SetScrollPos`");
225 %property(Selection, GetSelection, doc="See `GetSelection`");
5ed68428
KO
226};
227
f6f1e19f 228
9d9cbcdd
RD
229//---------------------------------------------------------------------------
230
231
232enum {
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
448f8f12
KO
241enum {
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};
9d9cbcdd
RD
250
251%constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
448f8f12
KO
252%constant wxEventType wxEVT_WEBKIT_BEFORE_LOAD;
253
254class wxWebKitBeforeLoadEvent : public wxCommandEvent
255{
256public:
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};
9d9cbcdd
RD
269
270
271class wxWebKitStateChangedEvent : public wxCommandEvent
272{
273public:
274 wxWebKitStateChangedEvent( wxWindow* win = NULL );
275
276 int GetState();
277 void SetState(const int state);
278 wxString GetURL();
279 void SetURL(const wxString& url);
e70b4d2d
RD
280
281 %property(State, GetState, SetState, doc="See `GetState` and `SetState`");
282 %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`");
9d9cbcdd
RD
283};
284
285
286%pythoncode %{
287 EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
448f8f12 288 EVT_WEBKIT_BEFORE_LOAD = wx.PyEventBinder(wxEVT_WEBKIT_BEFORE_LOAD)
9d9cbcdd
RD
289%}
290
291
292//---------------------------------------------------------------------------
293
5ed68428
KO
294%init %{
295
296%}
9d9cbcdd
RD
297
298//---------------------------------------------------------------------------