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