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 //---------------------------------------------------------------------------
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);
297 //---------------------------------------------------------------------------
299 class wxMaximizeEvent: public wxEvent {
301 wxMaximizeEvent(int id = 0);
304 //---------------------------------------------------------------------------
306 class wxJoystickEvent: public wxEvent {
308 wxJoystickEvent(int type = wxEVT_NULL,
310 int joystick = wxJOYSTICK1,
312 wxPoint GetPosition();
314 int GetButtonState();
315 int GetButtonChange();
317 void SetJoystick(int stick);
318 void SetButtonState(int state);
319 void SetButtonChange(int change);
320 void SetPosition(const wxPoint& pos);
321 void SetZPosition(int zPos);
325 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
326 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
327 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
330 //---------------------------------------------------------------------------
332 class wxDropFilesEvent: public wxEvent {
334 wxPoint GetPosition();
335 int GetNumberOfFiles();
338 PyObject* GetFiles() {
339 int count = self->GetNumberOfFiles();
340 wxString* files = self->GetFiles();
341 PyObject* list = PyList_New(count);
344 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
348 for (int i=0; i<count; i++) {
349 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
356 //---------------------------------------------------------------------------
358 class wxIdleEvent: public wxEvent {
361 void RequestMore(bool needMore = TRUE);
362 bool MoreRequested();
365 //---------------------------------------------------------------------------
367 class wxUpdateUIEvent: public wxEvent {
369 wxUpdateUIEvent(wxWindowID commandId = 0);
374 bool GetSetChecked();
375 bool GetSetEnabled();
377 void Check(bool check);
378 void Enable(bool enable);
379 void SetText(const wxString& text);
382 //---------------------------------------------------------------------------
384 class wxSysColourChangedEvent: public wxEvent {
386 wxSysColourChangedEvent();
389 //---------------------------------------------------------------------------
392 class wxNotifyEvent : public wxCommandEvent {
394 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
401 //---------------------------------------------------------------------------
403 class wxPaletteChangedEvent : public wxEvent {
405 wxPaletteChangedEvent(wxWindowID id = 0);
407 void SetChangedWindow(wxWindow* win);
408 wxWindow* GetChangedWindow();
412 //---------------------------------------------------------------------------
414 class wxQueryNewPaletteEvent : public wxEvent {
416 wxQueryNewPaletteEvent(wxWindowID id = 0);
418 void SetPaletteRealized(bool realized);
419 bool GetPaletteRealized();
423 //---------------------------------------------------------------------------
425 class wxWindowCreateEvent : public wxCommandEvent {
427 wxWindowCreateEvent(wxWindow *win = NULL);
429 wxWindow *GetWindow();
432 class wxWindowDestroyEvent : public wxCommandEvent {
434 wxWindowDestroyEvent(wxWindow *win = NULL);
436 wxWindow *GetWindow();
439 //---------------------------------------------------------------------------
441 class wxTimerEvent : public wxEvent
444 wxTimerEvent(int id = 0, int interval = 0);
449 //---------------------------------------------------------------------------
450 //---------------------------------------------------------------------------
451 // These classes can be derived from in Python and passed through the event
452 // system without loosing anything. They do this by keeping a reference to
453 // themselves and some special case handling in wxPyCallback::EventThunker.
455 class wxPyEvent : public wxEvent {
460 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
462 void SetSelf(PyObject* self);
467 class wxPyCommandEvent : public wxCommandEvent {
469 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
472 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
474 void SetSelf(PyObject* self);
481 //---------------------------------------------------------------------------
482 //---------------------------------------------------------------------------