]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/events.i
applied patch to uncover cells next to 0 automatically
[wxWidgets.git] / wxPython / src / events.i
... / ...
CommitLineData
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%import gdi.i
30
31//---------------------------------------------------------------------------
32
33class wxEvent {
34public:
35 wxEvent(int id = 0);
36 ~wxEvent();
37
38 wxObject* GetEventObject();
39 wxEventType GetEventType();
40 int GetId();
41 bool GetSkipped();
42 long GetTimestamp();
43 void SetEventObject(wxObject* object);
44 void SetEventType(wxEventType typ);
45 void SetId(int id);
46 void SetTimestamp(long timeStamp);
47 void Skip(bool skip = TRUE);
48};
49
50//---------------------------------------------------------------------------
51
52class wxSizeEvent : public wxEvent {
53public:
54 wxSizeEvent(const wxSize& sz, int id = 0);
55 wxSize GetSize();
56};
57
58//---------------------------------------------------------------------------
59
60class wxCloseEvent : public wxEvent {
61public:
62 wxCloseEvent(int commandEventType = 0, int id = 0);
63
64 void SetLoggingOff(bool loggingOff);
65 bool GetLoggingOff();
66 void Veto(bool veto = TRUE);
67 bool CanVeto();
68 bool GetVeto();
69 void SetCanVeto(bool canVeto);
70};
71
72//---------------------------------------------------------------------------
73
74class wxCommandEvent : public wxEvent {
75public:
76 wxCommandEvent(int commandEventType = 0, int id = 0);
77
78 bool IsChecked();
79 %name(Checked)bool IsChecked();
80 long GetExtraLong();
81 int GetInt();
82 int GetSelection();
83 wxString GetString();
84 bool IsSelection();
85 void SetString(const wxString& s);
86 void SetExtraLong(long extraLong);
87 void SetInt(int i);
88
89};
90
91
92//---------------------------------------------------------------------------
93
94class wxScrollEvent: public wxCommandEvent {
95public:
96 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
97 int orientation = 0);
98
99 int GetOrientation();
100 int GetPosition();
101};
102
103//---------------------------------------------------------------------------
104
105class wxScrollWinEvent: public wxEvent {
106public:
107 wxScrollWinEvent(int commandType = 0, int pos = 0,
108 int orientation = 0);
109
110 int GetOrientation();
111 int GetPosition();
112};
113
114//---------------------------------------------------------------------------
115
116class wxSpinEvent : public wxScrollEvent {
117public:
118 wxSpinEvent(int commandType = 0, int id = 0);
119
120};
121
122//---------------------------------------------------------------------------
123
124class wxMouseEvent: public wxEvent {
125public:
126 wxMouseEvent(int mouseEventType = 0);
127
128 bool IsButton();
129 bool ButtonDown(int but = -1);
130 bool ButtonDClick(int but = -1);
131 bool ButtonUp(int but = -1);
132 bool Button(int but);
133 bool ButtonIsDown(int but);
134 bool ControlDown();
135 bool MetaDown();
136 bool AltDown();
137 bool ShiftDown();
138 bool LeftDown();
139 bool MiddleDown();
140 bool RightDown();
141 bool LeftUp();
142 bool MiddleUp();
143 bool RightUp();
144 bool LeftDClick();
145 bool MiddleDClick();
146 bool RightDClick();
147 bool LeftIsDown();
148 bool MiddleIsDown();
149 bool RightIsDown();
150 bool Dragging();
151 bool Moving();
152 bool Entering();
153 bool Leaving();
154 wxPoint GetPosition();
155 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
156 wxPoint GetLogicalPosition(const wxDC& dc);
157 long GetX();
158 long GetY();
159};
160
161//---------------------------------------------------------------------------
162
163class wxKeyEvent: public wxEvent {
164public:
165 wxKeyEvent(int keyEventType);
166
167 bool ControlDown();
168 bool MetaDown();
169 bool AltDown();
170 bool ShiftDown();
171 long KeyCode();
172
173 long GetKeyCode();
174 bool HasModifiers();
175
176 long GetX();
177 long GetY();
178 wxPoint GetPosition();
179 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
180};
181
182//---------------------------------------------------------------------------
183
184class wxNavigationKeyEvent : public wxEvent {
185public:
186 wxNavigationKeyEvent();
187
188 bool GetDirection();
189 void SetDirection(bool bForward);
190 bool IsWindowChange();
191 void SetWindowChange(bool bIs);
192 wxWindow* GetCurrentFocus();
193 void SetCurrentFocus(wxWindow *win);
194};
195
196
197//---------------------------------------------------------------------------
198
199class wxMoveEvent: public wxEvent {
200public:
201 wxMoveEvent(const wxPoint& pt, int id = 0);
202
203 wxPoint GetPosition();
204};
205
206//---------------------------------------------------------------------------
207
208class wxPaintEvent: public wxEvent {
209public:
210 wxPaintEvent(int id = 0);
211
212};
213
214//---------------------------------------------------------------------------
215
216class wxEraseEvent: public wxEvent {
217public:
218 wxEraseEvent(int id = 0, wxDC* dc = NULL);
219
220 wxDC *GetDC();
221};
222
223//---------------------------------------------------------------------------
224
225class wxFocusEvent: public wxEvent {
226public:
227 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
228};
229
230//---------------------------------------------------------------------------
231
232class wxActivateEvent: public wxEvent{
233public:
234 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
235 bool GetActive();
236};
237
238//---------------------------------------------------------------------------
239
240class wxInitDialogEvent: public wxEvent {
241public:
242 wxInitDialogEvent(int id = 0);
243};
244
245//---------------------------------------------------------------------------
246
247class wxMenuEvent: public wxEvent {
248public:
249 wxMenuEvent(WXTYPE id = 0, int id = 0);
250 int GetMenuId();
251};
252
253//---------------------------------------------------------------------------
254
255class wxShowEvent: public wxEvent {
256public:
257 wxShowEvent(int id = 0, int show = FALSE);
258 void SetShow(bool show);
259 bool GetShow();
260};
261
262//---------------------------------------------------------------------------
263
264class wxIconizeEvent: public wxEvent {
265public:
266 wxIconizeEvent(int id = 0);
267};
268
269//---------------------------------------------------------------------------
270
271class wxMaximizeEvent: public wxEvent {
272public:
273 wxMaximizeEvent(int id = 0);
274};
275
276//---------------------------------------------------------------------------
277
278class wxJoystickEvent: public wxEvent {
279public:
280 wxJoystickEvent(int type = wxEVT_NULL,
281 int state = 0,
282 int joystick = wxJOYSTICK1,
283 int change = 0);
284 wxPoint GetPosition();
285 int GetZPosition();
286 int GetButtonState();
287 int GetButtonChange();
288 int GetJoystick();
289 void SetJoystick(int stick);
290 void SetButtonState(int state);
291 void SetButtonChange(int change);
292 void SetPosition(const wxPoint& pos);
293 void SetZPosition(int zPos);
294 bool IsButton();
295 bool IsMove();
296 bool IsZMove();
297 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
298 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
299 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
300};
301
302//---------------------------------------------------------------------------
303
304class wxDropFilesEvent: public wxEvent {
305public:
306 wxPoint GetPosition();
307 int GetNumberOfFiles();
308
309 %addmethods {
310 PyObject* GetFiles() {
311 int count = self->GetNumberOfFiles();
312 wxString* files = self->GetFiles();
313 PyObject* list = PyList_New(count);
314
315 if (!list) {
316 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
317 return NULL;
318 }
319
320 for (int i=0; i<count; i++) {
321 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
322 }
323 return list;
324 }
325 }
326};
327
328//---------------------------------------------------------------------------
329
330class wxIdleEvent: public wxEvent {
331public:
332 wxIdleEvent();
333 void RequestMore(bool needMore = TRUE);
334 bool MoreRequested();
335};
336
337//---------------------------------------------------------------------------
338
339class wxUpdateUIEvent: public wxEvent {
340public:
341 wxUpdateUIEvent(wxWindowID commandId = 0);
342 bool GetChecked();
343 bool GetEnabled();
344 wxString GetText();
345 bool GetSetText();
346 bool GetSetChecked();
347 bool GetSetEnabled();
348
349 void Check(bool check);
350 void Enable(bool enable);
351 void SetText(const wxString& text);
352};
353
354//---------------------------------------------------------------------------
355
356class wxSysColourChangedEvent: public wxEvent {
357public:
358 wxSysColourChangedEvent();
359};
360
361//---------------------------------------------------------------------------
362
363
364class wxNotifyEvent : public wxCommandEvent {
365public:
366 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
367 bool IsAllowed();
368 void Veto();
369};
370
371
372//---------------------------------------------------------------------------
373
374class wxPaletteChangedEvent : public wxEvent {
375public:
376 wxPaletteChangedEvent(wxWindowID id = 0);
377
378 void SetChangedWindow(wxWindow* win);
379 wxWindow* GetChangedWindow();
380
381};
382
383//---------------------------------------------------------------------------
384
385class wxQueryNewPaletteEvent : public wxEvent {
386public:
387 wxQueryNewPaletteEvent(wxWindowID id = 0);
388
389 void SetPaletteRealized(bool realized);
390 bool GetPaletteRealized();
391};
392
393
394//---------------------------------------------------------------------------
395
396class wxWindowCreateEvent : public wxCommandEvent {
397public:
398 wxWindowCreateEvent(wxWindow *win = NULL);
399
400 wxWindow *GetWindow();
401};
402
403class wxWindowDestroyEvent : public wxCommandEvent {
404public:
405 wxWindowDestroyEvent(wxWindow *win = NULL);
406
407 wxWindow *GetWindow();
408};
409
410//---------------------------------------------------------------------------
411
412class wxTimerEvent : public wxEvent
413{
414public:
415 wxTimerEvent(int id = 0, int interval = 0);
416 int GetInterval();
417};
418
419
420//---------------------------------------------------------------------------
421//---------------------------------------------------------------------------
422// These classes can be derived from in Python and passed through the event
423// system without loosing anything. They do this by keeping a reference to
424// themselves and some special case handling in wxPyCallback::EventThunker.
425
426class wxPyEvent : public wxEvent {
427public:
428 wxPyEvent(int id=0);
429 ~wxPyEvent();
430
431 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
432
433 void SetSelf(PyObject* self);
434 PyObject* GetSelf();
435};
436
437
438class wxPyCommandEvent : public wxCommandEvent {
439public:
440 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
441 ~wxPyCommandEvent();
442
443 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
444
445 void SetSelf(PyObject* self);
446 PyObject* GetSelf();
447};
448
449
450
451
452//---------------------------------------------------------------------------
453//---------------------------------------------------------------------------
454