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);
173 //---------------------------------------------------------------------------
175 class wxKeyEvent: public wxEvent {
177 wxKeyEvent(int keyEventType);
190 wxPoint GetPosition();
191 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
203 //---------------------------------------------------------------------------
205 class wxNavigationKeyEvent : public wxEvent {
207 wxNavigationKeyEvent();
210 void SetDirection(bool bForward);
211 bool IsWindowChange();
212 void SetWindowChange(bool bIs);
213 wxWindow* GetCurrentFocus();
214 void SetCurrentFocus(wxWindow *win);
218 //---------------------------------------------------------------------------
220 class wxMoveEvent: public wxEvent {
222 wxMoveEvent(const wxPoint& pt, int id = 0);
224 wxPoint GetPosition();
227 //---------------------------------------------------------------------------
229 class wxPaintEvent: public wxEvent {
231 wxPaintEvent(int id = 0);
235 //---------------------------------------------------------------------------
237 class wxEraseEvent: public wxEvent {
239 wxEraseEvent(int id = 0, wxDC* dc = NULL);
244 //---------------------------------------------------------------------------
246 class wxFocusEvent: public wxEvent {
248 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
251 //---------------------------------------------------------------------------
253 class wxActivateEvent: public wxEvent{
255 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
259 //---------------------------------------------------------------------------
261 class wxInitDialogEvent: public wxEvent {
263 wxInitDialogEvent(int id = 0);
266 //---------------------------------------------------------------------------
268 class wxMenuEvent: public wxEvent {
270 wxMenuEvent(WXTYPE id = 0, int id = 0);
274 //---------------------------------------------------------------------------
276 class wxShowEvent: public wxEvent {
278 wxShowEvent(int id = 0, int show = FALSE);
279 void SetShow(bool show);
283 //---------------------------------------------------------------------------
285 class wxIconizeEvent: public wxEvent {
287 wxIconizeEvent(int id = 0);
290 //---------------------------------------------------------------------------
292 class wxMaximizeEvent: public wxEvent {
294 wxMaximizeEvent(int id = 0);
297 //---------------------------------------------------------------------------
299 class wxJoystickEvent: public wxEvent {
301 wxJoystickEvent(int type = wxEVT_NULL,
303 int joystick = wxJOYSTICK1,
305 wxPoint GetPosition();
307 int GetButtonState();
308 int GetButtonChange();
310 void SetJoystick(int stick);
311 void SetButtonState(int state);
312 void SetButtonChange(int change);
313 void SetPosition(const wxPoint& pos);
314 void SetZPosition(int zPos);
318 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
319 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
320 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
323 //---------------------------------------------------------------------------
325 class wxDropFilesEvent: public wxEvent {
327 wxPoint GetPosition();
328 int GetNumberOfFiles();
331 PyObject* GetFiles() {
332 int count = self->GetNumberOfFiles();
333 wxString* files = self->GetFiles();
334 PyObject* list = PyList_New(count);
337 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
341 for (int i=0; i<count; i++) {
342 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
349 //---------------------------------------------------------------------------
351 class wxIdleEvent: public wxEvent {
354 void RequestMore(bool needMore = TRUE);
355 bool MoreRequested();
358 //---------------------------------------------------------------------------
360 class wxUpdateUIEvent: public wxEvent {
362 wxUpdateUIEvent(wxWindowID commandId = 0);
367 bool GetSetChecked();
368 bool GetSetEnabled();
370 void Check(bool check);
371 void Enable(bool enable);
372 void SetText(const wxString& text);
375 //---------------------------------------------------------------------------
377 class wxSysColourChangedEvent: public wxEvent {
379 wxSysColourChangedEvent();
382 //---------------------------------------------------------------------------
385 class wxNotifyEvent : public wxCommandEvent {
387 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
394 //---------------------------------------------------------------------------
396 class wxPaletteChangedEvent : public wxEvent {
398 wxPaletteChangedEvent(wxWindowID id = 0);
400 void SetChangedWindow(wxWindow* win);
401 wxWindow* GetChangedWindow();
405 //---------------------------------------------------------------------------
407 class wxQueryNewPaletteEvent : public wxEvent {
409 wxQueryNewPaletteEvent(wxWindowID id = 0);
411 void SetPaletteRealized(bool realized);
412 bool GetPaletteRealized();
416 //---------------------------------------------------------------------------
418 class wxWindowCreateEvent : public wxCommandEvent {
420 wxWindowCreateEvent(wxWindow *win = NULL);
422 wxWindow *GetWindow();
425 class wxWindowDestroyEvent : public wxCommandEvent {
427 wxWindowDestroyEvent(wxWindow *win = NULL);
429 wxWindow *GetWindow();
432 //---------------------------------------------------------------------------
434 class wxTimerEvent : public wxEvent
437 wxTimerEvent(int id = 0, int interval = 0);
442 //---------------------------------------------------------------------------
443 //---------------------------------------------------------------------------
444 // These classes can be derived from in Python and passed through the event
445 // system without loosing anything. They do this by keeping a reference to
446 // themselves and some special case handling in wxPyCallback::EventThunker.
448 class wxPyEvent : public wxEvent {
453 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
455 void SetSelf(PyObject* self);
460 class wxPyCommandEvent : public wxCommandEvent {
462 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
465 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
467 void SetSelf(PyObject* self);
474 //---------------------------------------------------------------------------
475 //---------------------------------------------------------------------------