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.
30 //---------------------------------------------------------------------------
37 wxObject* GetEventObject();
38 wxEventType GetEventType();
42 void SetEventObject(wxObject* object);
43 void SetEventType(wxEventType typ);
45 void SetTimestamp(long timeStamp);
46 void Skip(bool skip = TRUE);
49 //---------------------------------------------------------------------------
51 class wxSizeEvent : public wxEvent {
53 wxSizeEvent(const wxSize& sz, int id = 0);
57 //---------------------------------------------------------------------------
59 class wxCloseEvent : public wxEvent {
61 wxCloseEvent(int commandEventType = 0, int id = 0);
63 void SetLoggingOff(bool loggingOff);
65 void Veto(bool veto = TRUE);
68 void SetCanVeto(bool canVeto);
71 //---------------------------------------------------------------------------
73 class wxCommandEvent : public wxEvent {
75 wxCommandEvent(int commandEventType = 0, int id = 0);
83 void SetString(const wxString& s);
84 void SetExtraLong(long extraLong);
90 //---------------------------------------------------------------------------
92 class wxScrollEvent: public wxCommandEvent {
94 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
101 //---------------------------------------------------------------------------
103 class wxScrollWinEvent: public wxEvent {
105 wxScrollWinEvent(int commandType = 0, int pos = 0,
106 int orientation = 0);
108 int GetOrientation();
112 //---------------------------------------------------------------------------
114 class wxSpinEvent : public wxScrollEvent {
116 wxSpinEvent(int commandType = 0, int id = 0);
120 //---------------------------------------------------------------------------
122 class wxMouseEvent: public wxEvent {
124 wxMouseEvent(int mouseEventType = 0);
127 bool ButtonDown(int but = -1);
128 bool ButtonDClick(int but = -1);
129 bool ButtonUp(int but = -1);
130 bool Button(int but);
131 bool ButtonIsDown(int but);
152 wxPoint GetPosition();
153 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
154 wxPoint GetLogicalPosition(const wxDC& dc);
159 //---------------------------------------------------------------------------
161 class wxKeyEvent: public wxEvent {
163 wxKeyEvent(int keyEventType);
173 wxPoint GetPosition();
174 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
177 //---------------------------------------------------------------------------
179 class wxNavigationKeyEvent : public wxCommandEvent {
181 wxNavigationKeyEvent();
184 void SetDirection(bool bForward);
185 bool IsWindowChange();
186 void SetWindowChange(bool bIs);
187 wxWindow* GetCurrentFocus();
188 void SetCurrentFocus(wxWindow *win);
192 //---------------------------------------------------------------------------
194 class wxMoveEvent: public wxEvent {
196 wxMoveEvent(const wxPoint& pt, int id = 0);
198 wxPoint GetPosition();
201 //---------------------------------------------------------------------------
203 class wxPaintEvent: public wxEvent {
205 wxPaintEvent(int id = 0);
209 //---------------------------------------------------------------------------
211 class wxEraseEvent: public wxEvent {
213 wxEraseEvent(int id = 0, wxDC* dc = NULL);
218 //---------------------------------------------------------------------------
220 class wxFocusEvent: public wxEvent {
222 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
225 //---------------------------------------------------------------------------
227 class wxActivateEvent: public wxEvent{
229 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
233 //---------------------------------------------------------------------------
235 class wxInitDialogEvent: public wxEvent {
237 wxInitDialogEvent(int id = 0);
240 //---------------------------------------------------------------------------
242 class wxMenuEvent: public wxEvent {
244 wxMenuEvent(WXTYPE id = 0, int id = 0);
248 //---------------------------------------------------------------------------
250 class wxShowEvent: public wxEvent {
252 wxShowEvent(int id = 0, int show = FALSE);
253 void SetShow(bool show);
257 //---------------------------------------------------------------------------
259 class wxIconizeEvent: public wxEvent {
261 wxIconizeEvent(int id = 0);
264 //---------------------------------------------------------------------------
266 class wxMaximizeEvent: public wxEvent {
268 wxMaximizeEvent(int id = 0);
271 //---------------------------------------------------------------------------
273 class wxJoystickEvent: public wxEvent {
275 wxJoystickEvent(int type = wxEVT_NULL,
277 int joystick = wxJOYSTICK1,
279 wxPoint GetPosition();
281 int GetButtonState();
282 int GetButtonChange();
284 void SetJoystick(int stick);
285 void SetButtonState(int state);
286 void SetButtonChange(int change);
287 void SetPosition(const wxPoint& pos);
288 void SetZPosition(int zPos);
292 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
293 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
294 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
297 //---------------------------------------------------------------------------
299 class wxDropFilesEvent: public wxEvent {
301 wxPoint GetPosition();
302 int GetNumberOfFiles();
305 PyObject* GetFiles() {
306 int count = self->GetNumberOfFiles();
307 wxString* files = self->GetFiles();
308 PyObject* list = PyList_New(count);
311 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
315 for (int i=0; i<count; i++) {
316 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
323 //---------------------------------------------------------------------------
325 class wxIdleEvent: public wxEvent {
328 void RequestMore(bool needMore = TRUE);
329 bool MoreRequested();
332 //---------------------------------------------------------------------------
334 class wxUpdateUIEvent: public wxEvent {
336 wxUpdateUIEvent(wxWindowID commandId = 0);
341 bool GetSetChecked();
342 bool GetSetEnabled();
344 void Check(bool check);
345 void Enable(bool enable);
346 void SetText(const wxString& text);
349 //---------------------------------------------------------------------------
351 class wxSysColourChangedEvent: public wxEvent {
353 wxSysColourChangedEvent();
356 //---------------------------------------------------------------------------
359 class wxNotifyEvent : public wxCommandEvent {
361 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
367 //---------------------------------------------------------------------------
369 class wxPaletteChangedEvent : public wxEvent {
371 wxPaletteChangedEvent(wxWindowID id = 0);
373 void SetChangedWindow(wxWindow* win);
374 wxWindow* GetChangedWindow();
378 //---------------------------------------------------------------------------
380 class wxQueryNewPaletteEvent : public wxEvent {
382 wxQueryNewPaletteEvent(wxWindowID id = 0);
384 void SetPaletteRealized(bool realized);
385 bool GetPaletteRealized();
389 //---------------------------------------------------------------------------
391 class wxWindowCreateEvent : public wxEvent {
393 wxWindowCreateEvent(wxWindow *win = NULL);
395 wxWindow *GetWindow();
398 class wxWindowDestroyEvent : public wxEvent {
400 wxWindowDestroyEvent(wxWindow *win = NULL);
402 wxWindow *GetWindow();
406 //---------------------------------------------------------------------------
407 //---------------------------------------------------------------------------
408 // These classes can be derived from in Python and passed through the event
409 // system without loosing anything. They do this by keeping a reference to
410 // themselves and some special case handling in wxPyCallback::EventThunker.
412 class wxPyEvent : public wxEvent {
417 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
419 void SetSelf(PyObject* self);
424 class wxPyCommandEvent : public wxCommandEvent {
426 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
429 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
431 void SetSelf(PyObject* self);
438 //---------------------------------------------------------------------------
439 //---------------------------------------------------------------------------