]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/webkit.i
reSWIGged for WebKitCtrl
[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 %include _webkit_rename.i
42
43 //---------------------------------------------------------------------------
44
45 // Put some wx default wxChar* values into wxStrings.
46 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
47 MAKE_CONST_WXSTRING2(WebKitNameStr, wxT("webkitctrl"))
48
49
50
51
52 %{
53 #if !wxUSE_WEBKIT
54 // a dummy class for ports that don't have wxWebKitCtrl
55 class wxWebKitCtrl : public wxControl
56 {
57 public:
58 wxWebKitCtrl(wxWindow *parent,
59 wxWindowID winID,
60 const wxString& strURL,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize, long style = 0,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxPyWebKitNameStr)
65 { wxPyRaiseNotImplemented(); }
66
67 wxWebKitCtrl() { wxPyRaiseNotImplemented(); }
68
69 bool Create(wxWindow *parent,
70 wxWindowID winID,
71 const wxString& strURL,
72 const wxPoint& pos = wxDefaultPosition,
73 const wxSize& size = wxDefaultSize, long style = 0,
74 const wxValidator& validator = wxDefaultValidator,
75 const wxString& name = wxPyWebKitNameStr)
76 { return false; }
77
78 void LoadURL(const wxString &url) {}
79
80 bool CanGoBack() { return false; }
81 bool CanGoForward() { return false; }
82 bool GoBack() { return false; }
83 bool GoForward() { return false; }
84 void Reload() {}
85 void Stop() {}
86 bool CanGetPageSource() { return false; }
87 wxString GetPageSource() { return wxEmptyString; }
88 void SetPageSource(wxString& source, const wxString& baseUrl = wxEmptyString) {}
89 };
90
91
92 enum {
93 wxWEBKIT_STATE_START = 0,
94 wxWEBKIT_STATE_NEGOTIATING = 0,
95 wxWEBKIT_STATE_REDIRECTING = 0,
96 wxWEBKIT_STATE_TRANSFERRING = 0,
97 wxWEBKIT_STATE_STOP = 0,
98 wxWEBKIT_STATE_FAILED = 0,
99 };
100
101 class wxWebKitStateChangedEvent : public wxCommandEvent
102 {
103 public:
104 wxWebKitStateChangedEvent( wxWindow* win = NULL )
105 { wxPyRaiseNotImplemented(); }
106
107 int GetState() { return 0 }
108 void SetState(const int state) {}
109 wxString GetURL() { return wxEmptyString; }
110 void SetURL(const wxString& url) {}
111 };
112
113
114 #endif
115 %}
116
117 // Now define it for SWIG, usign either the real class or the dummy above.
118
119 MustHaveApp(wxWebKitCtrl);
120
121 class wxWebKitCtrl : public wxControl
122 {
123 public:
124 %pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
125 %pythonAppend wxWebKitCtrl() ""
126
127 wxWebKitCtrl(wxWindow *parent,
128 wxWindowID winID = -1,
129 const wxString& strURL = wxPyEmptyString,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize, long style = 0,
132 const wxValidator& validator = wxDefaultValidator,
133 const wxString& name = wxPyWebKitNameStr);
134
135 %name(PreWebKitCtrl)wxWebKitCtrl();
136
137
138 bool Create(wxWindow *parent,
139 wxWindowID winID = -1,
140 const wxString& strURL = wxPyEmptyString,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize, long style = 0,
143 const wxValidator& validator = wxDefaultValidator,
144 const wxString& name = wxPyWebKitNameStr);
145
146 void LoadURL(const wxString &url);
147
148 bool CanGoBack();
149 bool CanGoForward();
150 bool GoBack();
151 bool GoForward();
152 void Reload();
153 void Stop();
154 bool CanGetPageSource();
155 wxString GetPageSource();
156 void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
157 };
158
159
160 //---------------------------------------------------------------------------
161
162
163 enum {
164 wxWEBKIT_STATE_START,
165 wxWEBKIT_STATE_NEGOTIATING,
166 wxWEBKIT_STATE_REDIRECTING,
167 wxWEBKIT_STATE_TRANSFERRING,
168 wxWEBKIT_STATE_STOP,
169 wxWEBKIT_STATE_FAILED,
170 };
171
172
173 %constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
174
175
176 class wxWebKitStateChangedEvent : public wxCommandEvent
177 {
178 public:
179 wxWebKitStateChangedEvent( wxWindow* win = NULL );
180
181 int GetState();
182 void SetState(const int state);
183 wxString GetURL();
184 void SetURL(const wxString& url);
185 };
186
187
188 %pythoncode %{
189 EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
190 %}
191
192
193 //---------------------------------------------------------------------------
194
195 %init %{
196
197 %}
198
199 //---------------------------------------------------------------------------