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