]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/webkit.i
add some properties
[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; }
5ed68428 89};
9d9cbcdd
RD
90
91
92enum {
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,
4d00d250
RD
99
100 wxEVT_WEBKIT_STATE_CHANGED = 0
9d9cbcdd
RD
101};
102
103class wxWebKitStateChangedEvent : public wxCommandEvent
104{
105public:
106 wxWebKitStateChangedEvent( wxWindow* win = NULL )
107 { wxPyRaiseNotImplemented(); }
108
4d00d250 109 int GetState() { return 0; }
9d9cbcdd
RD
110 void SetState(const int state) {}
111 wxString GetURL() { return wxEmptyString; }
112 void SetURL(const wxString& url) {}
113};
114
115
5ed68428
KO
116#endif
117%}
118
b7a2ebe6 119// Now define it for SWIG, using either the real class or the dummy above.
9d9cbcdd
RD
120
121MustHaveApp(wxWebKitCtrl);
122
5ed68428
KO
123class wxWebKitCtrl : public wxControl
124{
125public:
9d9cbcdd
RD
126 %pythonAppend wxWebKitCtrl "self._setOORInfo(self)"
127 %pythonAppend wxWebKitCtrl() ""
128
5ed68428 129 wxWebKitCtrl(wxWindow *parent,
9d9cbcdd
RD
130 wxWindowID winID = -1,
131 const wxString& strURL = wxPyEmptyString,
5ed68428
KO
132 const wxPoint& pos = wxDefaultPosition,
133 const wxSize& size = wxDefaultSize, long style = 0,
134 const wxValidator& validator = wxDefaultValidator,
f6f1e19f
RD
135 const wxString& name = wxPyWebKitNameStr);
136
1b8c7ba6 137 %RenameCtor(PreWebKitCtrl, wxWebKitCtrl());
f6f1e19f
RD
138
139
5ed68428 140 bool Create(wxWindow *parent,
9d9cbcdd
RD
141 wxWindowID winID = -1,
142 const wxString& strURL = wxPyEmptyString,
5ed68428
KO
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize, long style = 0,
145 const wxValidator& validator = wxDefaultValidator,
f6f1e19f 146 const wxString& name = wxPyWebKitNameStr);
5ed68428
KO
147
148 void LoadURL(const wxString &url);
149
150 bool CanGoBack();
151 bool CanGoForward();
152 bool GoBack();
153 bool GoForward();
154 void Reload();
155 void Stop();
156 bool CanGetPageSource();
157 wxString GetPageSource();
f6f1e19f 158 void SetPageSource(wxString& source, const wxString& baseUrl = wxPyEmptyString);
f18ba20c
RD
159 wxString GetPageURL();
160 wxString GetPageTitle();
5ed68428
KO
161};
162
f6f1e19f 163
9d9cbcdd
RD
164//---------------------------------------------------------------------------
165
166
167enum {
168 wxWEBKIT_STATE_START,
169 wxWEBKIT_STATE_NEGOTIATING,
170 wxWEBKIT_STATE_REDIRECTING,
171 wxWEBKIT_STATE_TRANSFERRING,
172 wxWEBKIT_STATE_STOP,
173 wxWEBKIT_STATE_FAILED,
174};
175
176
177%constant wxEventType wxEVT_WEBKIT_STATE_CHANGED;
178
179
180class wxWebKitStateChangedEvent : public wxCommandEvent
181{
182public:
183 wxWebKitStateChangedEvent( wxWindow* win = NULL );
184
185 int GetState();
186 void SetState(const int state);
187 wxString GetURL();
188 void SetURL(const wxString& url);
189};
190
191
192%pythoncode %{
193 EVT_WEBKIT_STATE_CHANGED = wx.PyEventBinder(wxEVT_WEBKIT_STATE_CHANGED)
194%}
195
196
197//---------------------------------------------------------------------------
198
5ed68428
KO
199%init %{
200
201%}
9d9cbcdd
RD
202
203//---------------------------------------------------------------------------