]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: events.i | |
3 | // Purpose: SWIGgable Event classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 5/24/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
03e9bead RD |
14 | %module events |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
62bd0874 | 18 | #include <wx/spinbutt.h> |
7bf85405 RD |
19 | %} |
20 | ||
21 | //---------------------------------------------------------------------- | |
22 | ||
23 | %include typemaps.i | |
24 | %include my_typemaps.i | |
25 | ||
26 | // Import some definitions of other classes, etc. | |
27 | %import _defs.i | |
28 | %import misc.i | |
29 | ||
30 | //--------------------------------------------------------------------------- | |
31 | ||
32 | class wxEvent { | |
33 | public: | |
34 | wxObject* GetEventObject(); | |
35 | wxEventType GetEventType(); | |
36 | int GetId(); | |
37 | bool GetSkipped(); | |
38 | long GetTimestamp(); | |
39 | void SetEventObject(wxObject* object); | |
40 | void SetEventType(wxEventType typ); | |
41 | void SetId(int id); | |
42 | void SetTimestamp(long timeStamp); | |
43 | void Skip(bool skip = TRUE); | |
44 | }; | |
45 | ||
46 | //--------------------------------------------------------------------------- | |
47 | ||
48 | class wxSizeEvent : public wxEvent { | |
49 | public: | |
50 | wxSize GetSize(); | |
51 | }; | |
52 | ||
53 | //--------------------------------------------------------------------------- | |
54 | ||
55 | class wxCloseEvent : public wxEvent { | |
56 | public: | |
e980740a | 57 | void SetLoggingOff(bool loggingOff); |
7bf85405 RD |
58 | bool GetLoggingOff(); |
59 | void Veto(bool veto = TRUE); | |
e980740a | 60 | bool CanVeto(); |
7bf85405 | 61 | bool GetVeto(); |
b8b8dda7 | 62 | void SetCanVeto(bool canVeto); |
7bf85405 RD |
63 | }; |
64 | ||
65 | //--------------------------------------------------------------------------- | |
66 | ||
67 | class wxCommandEvent : public wxEvent { | |
68 | public: | |
69 | bool Checked(); | |
70 | long GetExtraLong(); | |
71 | int GetInt(); | |
72 | int GetSelection(); | |
cf694132 | 73 | wxString GetString(); |
7bf85405 | 74 | bool IsSelection(); |
7bf85405 RD |
75 | }; |
76 | ||
77 | ||
78 | //--------------------------------------------------------------------------- | |
79 | ||
80 | class wxScrollEvent: public wxCommandEvent { | |
81 | public: | |
82 | int GetOrientation(); | |
83 | int GetPosition(); | |
84 | }; | |
85 | ||
86 | //--------------------------------------------------------------------------- | |
87 | ||
62bd0874 RD |
88 | class wxSpinEvent : public wxScrollEvent { |
89 | public: | |
90 | ||
91 | }; | |
92 | ||
93 | //--------------------------------------------------------------------------- | |
94 | ||
7bf85405 RD |
95 | class wxMouseEvent: public wxEvent { |
96 | public: | |
97 | bool IsButton(); | |
98 | bool ButtonDown(int but = -1); | |
99 | bool ButtonDClick(int but = -1); | |
100 | bool ButtonUp(int but = -1); | |
101 | bool Button(int but); | |
102 | bool ButtonIsDown(int but); | |
103 | bool ControlDown(); | |
104 | bool MetaDown(); | |
105 | bool AltDown(); | |
106 | bool ShiftDown(); | |
107 | bool LeftDown(); | |
108 | bool MiddleDown(); | |
109 | bool RightDown(); | |
110 | bool LeftUp(); | |
111 | bool MiddleUp(); | |
112 | bool RightUp(); | |
113 | bool LeftDClick(); | |
114 | bool MiddleDClick(); | |
115 | bool RightDClick(); | |
116 | bool LeftIsDown(); | |
117 | bool MiddleIsDown(); | |
118 | bool RightIsDown(); | |
119 | bool Dragging(); | |
120 | bool Moving(); | |
121 | bool Entering(); | |
122 | bool Leaving(); | |
123 | void Position(long *OUTPUT, long *OUTPUT); | |
124 | wxPoint GetPosition(); | |
125 | wxPoint GetLogicalPosition(const wxDC& dc); | |
126 | long GetX(); | |
127 | long GetY(); | |
128 | }; | |
129 | ||
130 | //--------------------------------------------------------------------------- | |
131 | ||
132 | class wxKeyEvent: public wxEvent { | |
133 | public: | |
134 | bool ControlDown(); | |
135 | bool MetaDown(); | |
136 | bool AltDown(); | |
137 | bool ShiftDown(); | |
138 | long KeyCode(); | |
e980740a | 139 | |
7bf85405 RD |
140 | }; |
141 | ||
142 | //--------------------------------------------------------------------------- | |
143 | ||
144 | class wxMoveEvent: public wxEvent { | |
145 | public: | |
146 | wxPoint GetPosition(); | |
147 | }; | |
148 | ||
149 | //--------------------------------------------------------------------------- | |
150 | ||
151 | class wxPaintEvent: public wxEvent { | |
152 | public: | |
153 | ||
154 | }; | |
155 | ||
156 | //--------------------------------------------------------------------------- | |
157 | ||
158 | class wxEraseEvent: public wxEvent { | |
159 | public: | |
160 | wxDC *GetDC(); | |
161 | }; | |
162 | ||
163 | //--------------------------------------------------------------------------- | |
164 | ||
165 | class wxFocusEvent: public wxEvent { | |
166 | public: | |
167 | ||
168 | }; | |
169 | ||
170 | //--------------------------------------------------------------------------- | |
171 | ||
172 | class wxActivateEvent: public wxEvent{ | |
173 | public: | |
174 | bool GetActive(); | |
175 | }; | |
176 | ||
177 | //--------------------------------------------------------------------------- | |
178 | ||
179 | class wxInitDialogEvent: public wxEvent { | |
180 | public: | |
181 | ||
182 | }; | |
183 | ||
184 | //--------------------------------------------------------------------------- | |
185 | ||
186 | class wxMenuEvent: public wxEvent { | |
187 | public: | |
188 | int GetMenuId(); | |
189 | }; | |
190 | ||
191 | //--------------------------------------------------------------------------- | |
192 | ||
193 | class wxShowEvent: public wxEvent { | |
194 | public: | |
195 | void SetShow(bool show); | |
196 | bool GetShow(); | |
197 | }; | |
198 | ||
199 | //--------------------------------------------------------------------------- | |
200 | ||
201 | class wxIconizeEvent: public wxEvent { | |
202 | public: | |
203 | }; | |
204 | ||
205 | //--------------------------------------------------------------------------- | |
206 | ||
207 | class wxMaximizeEvent: public wxEvent { | |
208 | public: | |
209 | ||
210 | }; | |
211 | ||
212 | //--------------------------------------------------------------------------- | |
213 | ||
214 | class wxJoystickEvent: public wxEvent { | |
215 | public: | |
216 | wxPoint GetPosition(); | |
217 | int GetZPosition(); | |
218 | int GetButtonState(); | |
219 | int GetButtonChange(); | |
220 | int GetJoystick(); | |
221 | void SetJoystick(int stick); | |
222 | void SetButtonState(int state); | |
223 | void SetButtonChange(int change); | |
224 | void SetPosition(const wxPoint& pos); | |
225 | void SetZPosition(int zPos); | |
226 | bool IsButton(); | |
227 | bool IsMove(); | |
228 | bool IsZMove(); | |
229 | bool ButtonDown(int but = wxJOY_BUTTON_ANY); | |
230 | bool ButtonUp(int but = wxJOY_BUTTON_ANY); | |
231 | bool ButtonIsDown(int but = wxJOY_BUTTON_ANY); | |
232 | }; | |
233 | ||
234 | //--------------------------------------------------------------------------- | |
235 | ||
236 | class wxDropFilesEvent: public wxEvent { | |
237 | public: | |
238 | wxPoint GetPosition(); | |
239 | int GetNumberOfFiles(); | |
240 | ||
241 | %addmethods { | |
242 | PyObject* GetFiles() { | |
243 | int count = self->GetNumberOfFiles(); | |
244 | wxString* files = self->GetFiles(); | |
245 | PyObject* list = PyList_New(count); | |
246 | ||
247 | if (!list) { | |
248 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
249 | return NULL; | |
250 | } | |
251 | ||
252 | for (int i=0; i<count; i++) { | |
253 | PyList_SetItem(list, i, PyString_FromString((const char*)files[i])); | |
254 | } | |
255 | return list; | |
256 | } | |
257 | } | |
258 | }; | |
259 | ||
260 | //--------------------------------------------------------------------------- | |
261 | ||
262 | class wxIdleEvent: public wxEvent { | |
263 | public: | |
264 | void RequestMore(bool needMore = TRUE); | |
265 | bool MoreRequested(); | |
266 | }; | |
267 | ||
268 | //--------------------------------------------------------------------------- | |
269 | ||
270 | class wxUpdateUIEvent: public wxEvent { | |
271 | public: | |
272 | bool GetChecked(); | |
273 | bool GetEnabled(); | |
274 | wxString GetText(); | |
275 | bool GetSetText(); | |
276 | bool GetSetChecked(); | |
277 | bool GetSetEnabled(); | |
278 | ||
279 | void Check(bool check); | |
280 | void Enable(bool enable); | |
281 | void SetText(const wxString& text); | |
282 | }; | |
283 | ||
284 | //--------------------------------------------------------------------------- | |
285 | ||
286 | class wxSysColourChangedEvent: public wxEvent { | |
287 | public: | |
288 | ||
289 | }; | |
290 | ||
291 | //--------------------------------------------------------------------------- | |
292 | ||
cf694132 RD |
293 | class wxPyEvent : public wxCommandEvent { |
294 | public: | |
295 | wxPyEvent(wxEventType commandType = wxEVT_NULL, PyObject* userData = Py_None); | |
296 | ~wxPyEvent(); | |
297 | ||
298 | void SetUserData(PyObject* userData); | |
299 | PyObject* GetUserData(); | |
300 | }; | |
301 | ||
7bf85405 | 302 | |
cf694132 RD |
303 | |
304 | //--------------------------------------------------------------------------- | |
7bf85405 RD |
305 | ///////////////////////////////////////////////////////////////////////////// |
306 | // | |
307 | // $Log$ | |
cf694132 RD |
308 | // Revision 1.8 1999/04/30 03:29:18 RD |
309 | // wxPython 2.0b9, first phase (win32) | |
310 | // Added gobs of stuff, see wxPython/README.txt for details | |
311 | // | |
312 | // Revision 1.7.4.1 1999/03/27 23:29:14 RD | |
313 | // | |
314 | // wxPython 2.0b8 | |
315 | // Python thread support | |
316 | // various minor additions | |
317 | // various minor fixes | |
318 | // | |
af309447 RD |
319 | // Revision 1.7 1999/02/20 09:02:57 RD |
320 | // Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a | |
321 | // window handle. If you can get the window handle into the python code, | |
322 | // it should just work... More news on this later. | |
323 | // | |
324 | // Added wxImageList, wxToolTip. | |
325 | // | |
326 | // Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the | |
327 | // wxRegConfig class. | |
328 | // | |
329 | // As usual, some bug fixes, tweaks, etc. | |
330 | // | |
e980740a | 331 | // Revision 1.6 1999/02/06 22:55:00 RD |
af309447 | 332 | // |
e980740a RD |
333 | // Follow up for changes in wxWindows to various event classes |
334 | // | |
b8b8dda7 RD |
335 | // Revision 1.5 1998/12/15 20:41:17 RD |
336 | // Changed the import semantics from "from wxPython import *" to "from | |
337 | // wxPython.wx import *" This is for people who are worried about | |
338 | // namespace pollution, they can use "from wxPython import wx" and then | |
339 | // prefix all the wxPython identifiers with "wx." | |
340 | // | |
341 | // Added wxTaskbarIcon for wxMSW. | |
342 | // | |
343 | // Made the events work for wxGrid. | |
344 | // | |
345 | // Added wxConfig. | |
346 | // | |
347 | // Added wxMiniFrame for wxGTK, (untested.) | |
348 | // | |
349 | // Changed many of the args and return values that were pointers to gdi | |
350 | // objects to references to reflect changes in the wxWindows API. | |
351 | // | |
352 | // Other assorted fixes and additions. | |
353 | // | |
62bd0874 RD |
354 | // Revision 1.4 1998/11/16 00:00:55 RD |
355 | // Generic treectrl for wxPython/GTK compiles... | |
356 | // | |
d5c9047a RD |
357 | // Revision 1.3 1998/10/20 06:43:56 RD |
358 | // New wxTreeCtrl wrappers (untested) | |
359 | // some changes in helpers | |
360 | // etc. | |
361 | // | |
03e9bead RD |
362 | // Revision 1.2 1998/08/15 07:36:33 RD |
363 | // - Moved the header in the .i files out of the code that gets put into | |
364 | // the .cpp files. It caused CVS conflicts because of the RCS ID being | |
365 | // different each time. | |
366 | // | |
367 | // - A few minor fixes. | |
368 | // | |
7bf85405 RD |
369 | // Revision 1.1 1998/08/09 08:25:50 RD |
370 | // Initial version | |
371 | // | |
372 | // | |
373 |