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);
93 PyObject* GetClientData() {
94 wxPyClientData* data = (wxPyClientData*)self->GetClientObject();
96 Py_INCREF(data->m_obj);
107 //---------------------------------------------------------------------------
109 class wxScrollEvent: public wxCommandEvent {
111 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
112 int orientation = 0);
114 int GetOrientation();
118 //---------------------------------------------------------------------------
120 class wxScrollWinEvent: public wxEvent {
122 wxScrollWinEvent(int commandType = 0, int pos = 0,
123 int orientation = 0);
125 int GetOrientation();
129 //---------------------------------------------------------------------------
131 class wxSpinEvent : public wxScrollEvent {
133 wxSpinEvent(int commandType = 0, int id = 0);
137 //---------------------------------------------------------------------------
139 class wxMouseEvent: public wxEvent {
141 wxMouseEvent(int mouseEventType = 0);
144 bool ButtonDown(int but = -1);
145 bool ButtonDClick(int but = -1);
146 bool ButtonUp(int but = -1);
147 bool Button(int but);
148 bool ButtonIsDown(int but);
169 wxPoint GetPosition();
170 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
171 wxPoint GetLogicalPosition(const wxDC& dc);
175 int GetWheelRotation() const { return m_wheelRotation; }
176 int GetWheelDelta() const { return m_wheelDelta; }
177 int GetLinesPerAction() const { return m_linesPerAction; }
189 int m_linesPerAction;
192 //---------------------------------------------------------------------------
194 class wxKeyEvent: public wxEvent {
196 wxKeyEvent(int keyEventType);
209 wxPoint GetPosition();
210 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
222 //---------------------------------------------------------------------------
224 class wxNavigationKeyEvent : public wxEvent {
226 wxNavigationKeyEvent();
229 void SetDirection(bool bForward);
230 bool IsWindowChange();
231 void SetWindowChange(bool bIs);
232 wxWindow* GetCurrentFocus();
233 void SetCurrentFocus(wxWindow *win);
237 //---------------------------------------------------------------------------
239 class wxMoveEvent: public wxEvent {
241 wxMoveEvent(const wxPoint& pt, int id = 0);
243 wxPoint GetPosition();
246 //---------------------------------------------------------------------------
248 class wxPaintEvent: public wxEvent {
250 wxPaintEvent(int id = 0);
254 //---------------------------------------------------------------------------
256 class wxEraseEvent: public wxEvent {
258 wxEraseEvent(int id = 0, wxDC* dc = NULL);
263 //---------------------------------------------------------------------------
265 class wxFocusEvent: public wxEvent {
267 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
270 //---------------------------------------------------------------------------
272 class wxActivateEvent: public wxEvent{
274 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
278 //---------------------------------------------------------------------------
280 class wxInitDialogEvent: public wxEvent {
282 wxInitDialogEvent(int id = 0);
285 //---------------------------------------------------------------------------
287 class wxMenuEvent: public wxEvent {
289 wxMenuEvent(WXTYPE id = 0, int id = 0);
293 //---------------------------------------------------------------------------
295 class wxShowEvent: public wxEvent {
297 wxShowEvent(int id = 0, int show = FALSE);
298 void SetShow(bool show);
302 //---------------------------------------------------------------------------
304 class wxIconizeEvent: public wxEvent {
306 wxIconizeEvent(int id = 0, bool iconized = TRUE);
310 //---------------------------------------------------------------------------
312 class wxMaximizeEvent: public wxEvent {
314 wxMaximizeEvent(int id = 0);
317 //---------------------------------------------------------------------------
319 class wxJoystickEvent: public wxEvent {
321 wxJoystickEvent(int type = wxEVT_NULL,
323 int joystick = wxJOYSTICK1,
325 wxPoint GetPosition();
327 int GetButtonState();
328 int GetButtonChange();
330 void SetJoystick(int stick);
331 void SetButtonState(int state);
332 void SetButtonChange(int change);
333 void SetPosition(const wxPoint& pos);
334 void SetZPosition(int zPos);
338 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
339 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
340 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
343 //---------------------------------------------------------------------------
345 class wxDropFilesEvent: public wxEvent {
347 wxPoint GetPosition();
348 int GetNumberOfFiles();
351 PyObject* GetFiles() {
352 int count = self->GetNumberOfFiles();
353 wxString* files = self->GetFiles();
354 PyObject* list = PyList_New(count);
357 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
361 for (int i=0; i<count; i++) {
362 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
369 //---------------------------------------------------------------------------
371 class wxIdleEvent: public wxEvent {
374 void RequestMore(bool needMore = TRUE);
375 bool MoreRequested();
378 //---------------------------------------------------------------------------
380 class wxUpdateUIEvent: public wxEvent {
382 wxUpdateUIEvent(wxWindowID commandId = 0);
387 bool GetSetChecked();
388 bool GetSetEnabled();
390 void Check(bool check);
391 void Enable(bool enable);
392 void SetText(const wxString& text);
395 //---------------------------------------------------------------------------
397 class wxSysColourChangedEvent: public wxEvent {
399 wxSysColourChangedEvent();
402 //---------------------------------------------------------------------------
405 class wxNotifyEvent : public wxCommandEvent {
407 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
414 //---------------------------------------------------------------------------
416 class wxPaletteChangedEvent : public wxEvent {
418 wxPaletteChangedEvent(wxWindowID id = 0);
420 void SetChangedWindow(wxWindow* win);
421 wxWindow* GetChangedWindow();
425 //---------------------------------------------------------------------------
427 class wxQueryNewPaletteEvent : public wxEvent {
429 wxQueryNewPaletteEvent(wxWindowID id = 0);
431 void SetPaletteRealized(bool realized);
432 bool GetPaletteRealized();
436 //---------------------------------------------------------------------------
438 class wxWindowCreateEvent : public wxCommandEvent {
440 wxWindowCreateEvent(wxWindow *win = NULL);
442 wxWindow *GetWindow();
445 class wxWindowDestroyEvent : public wxCommandEvent {
447 wxWindowDestroyEvent(wxWindow *win = NULL);
449 wxWindow *GetWindow();
452 //---------------------------------------------------------------------------
454 class wxTimerEvent : public wxEvent
457 wxTimerEvent(int id = 0, int interval = 0);
461 //---------------------------------------------------------------------------
463 class wxTextUrlEvent : public wxCommandEvent
466 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
467 long start, long end);
468 const wxMouseEvent& GetMouseEvent();
473 //---------------------------------------------------------------------------
474 //---------------------------------------------------------------------------
475 // These classes can be derived from in Python and passed through the event
476 // system without loosing anything. They do this by keeping a reference to
477 // themselves and some special case handling in wxPyCallback::EventThunker.
479 class wxPyEvent : public wxEvent {
484 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
486 void SetSelf(PyObject* self);
491 class wxPyCommandEvent : public wxCommandEvent {
493 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
496 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
498 void SetSelf(PyObject* self);
505 //---------------------------------------------------------------------------
506 //---------------------------------------------------------------------------