1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIGgable Event classes for wxPython
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/spinbutt.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
31 //---------------------------------------------------------------------------
36 class wxEvent : public wxObject {
41 wxObject* GetEventObject();
42 wxEventType GetEventType();
46 void SetEventObject(wxObject* object);
47 void SetEventType(wxEventType typ);
49 void SetTimestamp(long timeStamp);
50 void Skip(bool skip = TRUE);
53 //---------------------------------------------------------------------------
55 class wxSizeEvent : public wxEvent {
57 wxSizeEvent(const wxSize& sz, int id = 0);
61 //---------------------------------------------------------------------------
63 class wxCloseEvent : public wxEvent {
65 wxCloseEvent(int commandEventType = 0, int id = 0);
67 void SetLoggingOff(bool loggingOff);
69 void Veto(bool veto = TRUE);
72 void SetCanVeto(bool canVeto);
75 //---------------------------------------------------------------------------
77 class wxCommandEvent : public wxEvent {
79 wxCommandEvent(int commandEventType = 0, int id = 0);
82 %name(Checked)bool IsChecked();
88 void SetString(const wxString& s);
89 void SetExtraLong(long extraLong);
95 //---------------------------------------------------------------------------
97 class wxScrollEvent: public wxCommandEvent {
99 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
100 int orientation = 0);
102 int GetOrientation();
106 //---------------------------------------------------------------------------
108 class wxScrollWinEvent: public wxEvent {
110 wxScrollWinEvent(int commandType = 0, int pos = 0,
111 int orientation = 0);
113 int GetOrientation();
117 //---------------------------------------------------------------------------
119 class wxSpinEvent : public wxScrollEvent {
121 wxSpinEvent(int commandType = 0, int id = 0);
125 //---------------------------------------------------------------------------
127 class wxMouseEvent: public wxEvent {
129 wxMouseEvent(int mouseEventType = 0);
132 bool ButtonDown(int but = -1);
133 bool ButtonDClick(int but = -1);
134 bool ButtonUp(int but = -1);
135 bool Button(int but);
136 bool ButtonIsDown(int but);
157 wxPoint GetPosition();
158 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
159 wxPoint GetLogicalPosition(const wxDC& dc);
163 int GetWheelRotation() const { return m_wheelRotation; }
164 int GetWheelDelta() const { return m_wheelDelta; }
165 int GetLinesPerAction() const { return m_linesPerAction; }
177 int m_linesPerAction;
180 //---------------------------------------------------------------------------
182 class wxKeyEvent: public wxEvent {
184 wxKeyEvent(int keyEventType);
197 wxPoint GetPosition();
198 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
210 //---------------------------------------------------------------------------
212 class wxNavigationKeyEvent : public wxEvent {
214 wxNavigationKeyEvent();
217 void SetDirection(bool bForward);
218 bool IsWindowChange();
219 void SetWindowChange(bool bIs);
220 wxWindow* GetCurrentFocus();
221 void SetCurrentFocus(wxWindow *win);
225 //---------------------------------------------------------------------------
227 class wxMoveEvent: public wxEvent {
229 wxMoveEvent(const wxPoint& pt, int id = 0);
231 wxPoint GetPosition();
234 //---------------------------------------------------------------------------
236 class wxPaintEvent: public wxEvent {
238 wxPaintEvent(int id = 0);
242 //---------------------------------------------------------------------------
244 class wxEraseEvent: public wxEvent {
246 wxEraseEvent(int id = 0, wxDC* dc = NULL);
251 //---------------------------------------------------------------------------
253 class wxFocusEvent: public wxEvent {
255 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
258 //---------------------------------------------------------------------------
260 class wxActivateEvent: public wxEvent{
262 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
266 //---------------------------------------------------------------------------
268 class wxInitDialogEvent: public wxEvent {
270 wxInitDialogEvent(int id = 0);
273 //---------------------------------------------------------------------------
275 class wxMenuEvent: public wxEvent {
277 wxMenuEvent(WXTYPE id = 0, int id = 0);
281 //---------------------------------------------------------------------------
283 class wxShowEvent: public wxEvent {
285 wxShowEvent(int id = 0, int show = FALSE);
286 void SetShow(bool show);
290 //---------------------------------------------------------------------------
292 class wxIconizeEvent: public wxEvent {
294 wxIconizeEvent(int id = 0, bool iconized = TRUE);
298 //---------------------------------------------------------------------------
300 class wxMaximizeEvent: public wxEvent {
302 wxMaximizeEvent(int id = 0);
305 //---------------------------------------------------------------------------
307 class wxJoystickEvent: public wxEvent {
309 wxJoystickEvent(int type = wxEVT_NULL,
311 int joystick = wxJOYSTICK1,
313 wxPoint GetPosition();
315 int GetButtonState();
316 int GetButtonChange();
318 void SetJoystick(int stick);
319 void SetButtonState(int state);
320 void SetButtonChange(int change);
321 void SetPosition(const wxPoint& pos);
322 void SetZPosition(int zPos);
326 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
327 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
328 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
331 //---------------------------------------------------------------------------
333 class wxDropFilesEvent: public wxEvent {
335 wxPoint GetPosition();
336 int GetNumberOfFiles();
339 PyObject* GetFiles() {
340 int count = self->GetNumberOfFiles();
341 wxString* files = self->GetFiles();
342 PyObject* list = PyList_New(count);
345 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
349 for (int i=0; i<count; i++) {
350 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
357 //---------------------------------------------------------------------------
359 class wxIdleEvent: public wxEvent {
362 void RequestMore(bool needMore = TRUE);
363 bool MoreRequested();
366 //---------------------------------------------------------------------------
368 class wxUpdateUIEvent: public wxEvent {
370 wxUpdateUIEvent(wxWindowID commandId = 0);
375 bool GetSetChecked();
376 bool GetSetEnabled();
378 void Check(bool check);
379 void Enable(bool enable);
380 void SetText(const wxString& text);
383 //---------------------------------------------------------------------------
385 class wxSysColourChangedEvent: public wxEvent {
387 wxSysColourChangedEvent();
390 //---------------------------------------------------------------------------
393 class wxNotifyEvent : public wxCommandEvent {
395 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
402 //---------------------------------------------------------------------------
404 class wxPaletteChangedEvent : public wxEvent {
406 wxPaletteChangedEvent(wxWindowID id = 0);
408 void SetChangedWindow(wxWindow* win);
409 wxWindow* GetChangedWindow();
413 //---------------------------------------------------------------------------
415 class wxQueryNewPaletteEvent : public wxEvent {
417 wxQueryNewPaletteEvent(wxWindowID id = 0);
419 void SetPaletteRealized(bool realized);
420 bool GetPaletteRealized();
424 //---------------------------------------------------------------------------
426 class wxWindowCreateEvent : public wxCommandEvent {
428 wxWindowCreateEvent(wxWindow *win = NULL);
430 wxWindow *GetWindow();
433 class wxWindowDestroyEvent : public wxCommandEvent {
435 wxWindowDestroyEvent(wxWindow *win = NULL);
437 wxWindow *GetWindow();
440 //---------------------------------------------------------------------------
442 class wxTimerEvent : public wxEvent
445 wxTimerEvent(int id = 0, int interval = 0);
450 //---------------------------------------------------------------------------
451 //---------------------------------------------------------------------------
452 // These classes can be derived from in Python and passed through the event
453 // system without loosing anything. They do this by keeping a reference to
454 // themselves and some special case handling in wxPyCallback::EventThunker.
456 class wxPyEvent : public wxEvent {
461 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
463 void SetSelf(PyObject* self);
468 class wxPyCommandEvent : public wxCommandEvent {
470 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
473 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
475 void SetSelf(PyObject* self);
482 //---------------------------------------------------------------------------
483 //---------------------------------------------------------------------------