1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Embedding Apple's WebKit in wxWidgets
5 // Author: Robin Dunn / Kevin Ollivier
7 // Created: 18-Oct-2004
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 "wx.webkit.WebKitCtrl for Mac OSX."
17 %module(package="wx", docstring=DOCSTRING) webkit
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23 #include "wx/wxPython/pyistream.h"
25 #ifdef __WXMAC__ // avoid a bug in Carbon headers
30 #include "wx/html/webkit.h"
34 //---------------------------------------------------------------------------
37 %pythoncode { wx = _core }
38 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
41 //---------------------------------------------------------------------------
43 // Put some wx default wxChar* values into wxStrings.
44 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
45 MAKE_CONST_WXSTRING2(WebKitNameStr, wxT("webkitctrl"))
52 // a dummy class for ports that don't have wxWebKitCtrl
53 class wxWebKitCtrl : public wxControl
56 wxWebKitCtrl(wxWindow *parent,
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(); }
65 wxWebKitCtrl() { wxPyRaiseNotImplemented(); }
67 bool Create(wxWindow *parent,
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)
76 void LoadURL(const wxString &url) {}
78 bool CanGoBack() { return false; }
79 bool CanGoForward() { return false; }
80 bool GoBack() { return false; }
81 bool GoForward() { return false; }
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; }
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,
100 wxEVT_WEBKIT_STATE_CHANGED = 0
103 class wxWebKitStateChangedEvent : public wxCommandEvent
106 wxWebKitStateChangedEvent( wxWindow* win = NULL )
107 { wxPyRaiseNotImplemented(); }
109 int GetState() { return 0; }
110 void SetState(const int state) {}
111 wxString GetURL() { return wxEmptyString; }
112 void SetURL(const wxString& url) {}
119 // Now define it for SWIG, using either the real class or the dummy above.
121 MustHaveApp(wxWebKitCtrl);
123 class wxWebKitCtrl : public wxControl
126 %pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
127 %pythonAppend wxWebKitCtrl() ""
129 wxWebKitCtrl(wxWindow *parent,
130 wxWindowID winID = -1,
131 const wxString& strURL = wxPyEmptyString,
132 const wxPoint& pos = wxDefaultPosition,
133 const wxSize& size = wxDefaultSize, long style = 0,
134 const wxValidator& validator = wxDefaultValidator,
135 const wxString& name = wxPyWebKitNameStr);
137 %RenameCtor(PreWebKitCtrl, wxWebKitCtrl());
140 bool Create(wxWindow *parent,
141 wxWindowID winID = -1,
142 const wxString& strURL = wxPyEmptyString,
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize, long style = 0,
145 const wxValidator& validator = wxDefaultValidator,
146 const wxString& name = wxPyWebKitNameStr);
148 void LoadURL(const wxString &url);
156 bool CanGetPageSource();
157 wxString GetPageSource();
158 void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
159 wxString GetPageURL();
160 wxString GetPageTitle();
164 //---------------------------------------------------------------------------
168 wxWEBKIT_STATE_START,
169 wxWEBKIT_STATE_NEGOTIATING,
170 wxWEBKIT_STATE_REDIRECTING,
171 wxWEBKIT_STATE_TRANSFERRING,
173 wxWEBKIT_STATE_FAILED,
177 %constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
180 class wxWebKitStateChangedEvent : public wxCommandEvent
183 wxWebKitStateChangedEvent( wxWindow* win = NULL );
186 void SetState(const int state);
188 void SetURL(const wxString& url);
193 EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
197 //---------------------------------------------------------------------------
203 //---------------------------------------------------------------------------