1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for common event classes and event binders
7 // Created: 24-May-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
17 // Include some extra python code here
18 %pythoncode "_event_ex.py"
20 //---------------------------------------------------------------------------
23 // the predefined constants for the number of times we propagate event
24 // upwards window child-parent chain
25 enum Propagation_state
27 // don't propagate it at all
28 wxEVENT_PROPAGATE_NONE = 0,
30 // propagate it until it is processed
31 wxEVENT_PROPAGATE_MAX = INT_MAX
35 //---------------------------------------------------------------------------
38 wxEventType wxNewEventType();
41 %constant wxEventType wxEVT_NULL;
42 %constant wxEventType wxEVT_FIRST;
43 %constant wxEventType wxEVT_USER_FIRST;
45 %constant wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
46 %constant wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
47 %constant wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
48 %constant wxEventType wxEVT_COMMAND_LISTBOX_SELECTED;
49 %constant wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
50 %constant wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
52 %constant wxEventType wxEVT_COMMAND_MENU_SELECTED;
53 %constant wxEventType wxEVT_COMMAND_TOOL_CLICKED;
54 %constant wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
55 %constant wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
56 %constant wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
58 %constant wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED;
59 %constant wxEventType wxEVT_COMMAND_VLBOX_SELECTED;
60 %constant wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED;
61 %constant wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
62 %constant wxEventType wxEVT_COMMAND_TOOL_ENTER;
65 %constant wxEventType wxEVT_LEFT_DOWN;
66 %constant wxEventType wxEVT_LEFT_UP;
67 %constant wxEventType wxEVT_MIDDLE_DOWN;
68 %constant wxEventType wxEVT_MIDDLE_UP;
69 %constant wxEventType wxEVT_RIGHT_DOWN;
70 %constant wxEventType wxEVT_RIGHT_UP;
71 %constant wxEventType wxEVT_MOTION;
72 %constant wxEventType wxEVT_ENTER_WINDOW;
73 %constant wxEventType wxEVT_LEAVE_WINDOW;
74 %constant wxEventType wxEVT_LEFT_DCLICK;
75 %constant wxEventType wxEVT_MIDDLE_DCLICK;
76 %constant wxEventType wxEVT_RIGHT_DCLICK;
77 %constant wxEventType wxEVT_SET_FOCUS;
78 %constant wxEventType wxEVT_KILL_FOCUS;
79 %constant wxEventType wxEVT_CHILD_FOCUS;
80 %constant wxEventType wxEVT_MOUSEWHEEL;
82 // Non-client mouse events
83 %constant wxEventType wxEVT_NC_LEFT_DOWN;
84 %constant wxEventType wxEVT_NC_LEFT_UP;
85 %constant wxEventType wxEVT_NC_MIDDLE_DOWN;
86 %constant wxEventType wxEVT_NC_MIDDLE_UP;
87 %constant wxEventType wxEVT_NC_RIGHT_DOWN;
88 %constant wxEventType wxEVT_NC_RIGHT_UP;
89 %constant wxEventType wxEVT_NC_MOTION;
90 %constant wxEventType wxEVT_NC_ENTER_WINDOW;
91 %constant wxEventType wxEVT_NC_LEAVE_WINDOW;
92 %constant wxEventType wxEVT_NC_LEFT_DCLICK;
93 %constant wxEventType wxEVT_NC_MIDDLE_DCLICK;
94 %constant wxEventType wxEVT_NC_RIGHT_DCLICK;
96 // Character input event type
97 %constant wxEventType wxEVT_CHAR;
98 %constant wxEventType wxEVT_CHAR_HOOK;
99 %constant wxEventType wxEVT_NAVIGATION_KEY;
100 %constant wxEventType wxEVT_KEY_DOWN;
101 %constant wxEventType wxEVT_KEY_UP;
102 %constant wxEventType wxEVT_HOTKEY;
105 %constant wxEventType wxEVT_SET_CURSOR;
107 // wxScrollBar and wxSlider event identifiers
108 %constant wxEventType wxEVT_SCROLL_TOP;
109 %constant wxEventType wxEVT_SCROLL_BOTTOM;
110 %constant wxEventType wxEVT_SCROLL_LINEUP;
111 %constant wxEventType wxEVT_SCROLL_LINEDOWN;
112 %constant wxEventType wxEVT_SCROLL_PAGEUP;
113 %constant wxEventType wxEVT_SCROLL_PAGEDOWN;
114 %constant wxEventType wxEVT_SCROLL_THUMBTRACK;
115 %constant wxEventType wxEVT_SCROLL_THUMBRELEASE;
116 %constant wxEventType wxEVT_SCROLL_ENDSCROLL;
118 // Scroll events from wxWindow
119 %constant wxEventType wxEVT_SCROLLWIN_TOP;
120 %constant wxEventType wxEVT_SCROLLWIN_BOTTOM;
121 %constant wxEventType wxEVT_SCROLLWIN_LINEUP;
122 %constant wxEventType wxEVT_SCROLLWIN_LINEDOWN;
123 %constant wxEventType wxEVT_SCROLLWIN_PAGEUP;
124 %constant wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
125 %constant wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
126 %constant wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
129 %constant wxEventType wxEVT_SIZE;
130 %constant wxEventType wxEVT_MOVE;
131 %constant wxEventType wxEVT_CLOSE_WINDOW;
132 %constant wxEventType wxEVT_END_SESSION;
133 %constant wxEventType wxEVT_QUERY_END_SESSION;
134 %constant wxEventType wxEVT_ACTIVATE_APP;
135 %constant wxEventType wxEVT_POWER;
136 %constant wxEventType wxEVT_ACTIVATE;
137 %constant wxEventType wxEVT_CREATE;
138 %constant wxEventType wxEVT_DESTROY;
139 %constant wxEventType wxEVT_SHOW;
140 %constant wxEventType wxEVT_ICONIZE;
141 %constant wxEventType wxEVT_MAXIMIZE;
142 %constant wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
143 %constant wxEventType wxEVT_PAINT;
144 %constant wxEventType wxEVT_ERASE_BACKGROUND;
145 %constant wxEventType wxEVT_NC_PAINT;
146 %constant wxEventType wxEVT_PAINT_ICON;
147 %constant wxEventType wxEVT_MENU_OPEN;
148 %constant wxEventType wxEVT_MENU_CLOSE;
149 %constant wxEventType wxEVT_MENU_HIGHLIGHT;
151 %constant wxEventType wxEVT_CONTEXT_MENU;
152 %constant wxEventType wxEVT_SYS_COLOUR_CHANGED;
153 %constant wxEventType wxEVT_DISPLAY_CHANGED;
154 %constant wxEventType wxEVT_SETTING_CHANGED;
155 %constant wxEventType wxEVT_QUERY_NEW_PALETTE;
156 %constant wxEventType wxEVT_PALETTE_CHANGED;
157 %constant wxEventType wxEVT_DROP_FILES;
158 %constant wxEventType wxEVT_DRAW_ITEM;
159 %constant wxEventType wxEVT_MEASURE_ITEM;
160 %constant wxEventType wxEVT_COMPARE_ITEM;
161 %constant wxEventType wxEVT_INIT_DIALOG;
162 %constant wxEventType wxEVT_IDLE;
163 %constant wxEventType wxEVT_UPDATE_UI;
164 %constant wxEventType wxEVT_SIZING;
165 %constant wxEventType wxEVT_MOVING;
167 // Generic command events
168 // Note: a click is a higher-level event than button down/up
169 %constant wxEventType wxEVT_COMMAND_LEFT_CLICK;
170 %constant wxEventType wxEVT_COMMAND_LEFT_DCLICK;
171 %constant wxEventType wxEVT_COMMAND_RIGHT_CLICK;
172 %constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
173 %constant wxEventType wxEVT_COMMAND_SET_FOCUS;
174 %constant wxEventType wxEVT_COMMAND_KILL_FOCUS;
175 %constant wxEventType wxEVT_COMMAND_ENTER;
181 %# Create some event binders
182 EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
183 EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
184 EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
185 EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
186 EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
187 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
188 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
189 EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
190 EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
191 EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
192 EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
193 EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
194 EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
195 EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
196 EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
197 EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
198 EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
199 EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
200 EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
201 EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
202 EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
203 EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
204 EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
205 EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
206 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
207 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
208 EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
209 EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
210 EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
211 EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
212 EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
213 EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
214 EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
215 EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
216 EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
217 EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
218 EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
219 EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
220 EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
221 EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
223 EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
224 EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
225 EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
226 EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
227 EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
228 EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
229 EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
230 EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
231 EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
232 EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
233 EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
234 EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
235 EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
237 EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN,
253 %# Scrolling from wxWindow (sent to wxScrolledWindow)
254 EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP,
255 wxEVT_SCROLLWIN_BOTTOM,
256 wxEVT_SCROLLWIN_LINEUP,
257 wxEVT_SCROLLWIN_LINEDOWN,
258 wxEVT_SCROLLWIN_PAGEUP,
259 wxEVT_SCROLLWIN_PAGEDOWN,
260 wxEVT_SCROLLWIN_THUMBTRACK,
261 wxEVT_SCROLLWIN_THUMBRELEASE,
264 EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
265 EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
266 EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
267 EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
268 EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
269 EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
270 EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
271 EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
273 %# Scrolling from wxSlider and wxScrollBar
274 EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
277 wxEVT_SCROLL_LINEDOWN,
279 wxEVT_SCROLL_PAGEDOWN,
280 wxEVT_SCROLL_THUMBTRACK,
281 wxEVT_SCROLL_THUMBRELEASE,
282 wxEVT_SCROLL_ENDSCROLL,
285 EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
286 EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
287 EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
288 EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
289 EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
290 EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
291 EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
292 EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
293 EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL )
295 %# Scrolling from wxSlider and wxScrollBar, with an id
296 EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
299 wxEVT_SCROLL_LINEDOWN,
301 wxEVT_SCROLL_PAGEDOWN,
302 wxEVT_SCROLL_THUMBTRACK,
303 wxEVT_SCROLL_THUMBRELEASE,
304 wxEVT_SCROLL_ENDSCROLL,
307 EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
308 EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
309 EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
310 EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
311 EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
312 EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
313 EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
314 EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
315 EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1)
317 EVT_SPIN_UP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
318 EVT_SPIN_DOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
319 EVT_SPIN = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
321 EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1)
322 EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1)
323 EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1)
324 EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1)
325 EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1)
326 EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1)
327 EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2)
328 EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1)
329 EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1)
330 EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1)
332 EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1)
333 EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1)
334 EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1)
335 EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1)
336 EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2)
337 EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1)
338 EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2)
339 EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1)
340 EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1)
343 EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
344 EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
345 EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
346 EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
347 EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
348 EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
349 EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
351 EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
353 EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
354 EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
356 EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
361 //---------------------------------------------------------------------------
364 class wxEvent : public wxObject {
366 // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC
369 void SetEventType(wxEventType typ);
370 wxEventType GetEventType() const;
371 wxObject *GetEventObject() const;
372 void SetEventObject(wxObject *obj);
373 long GetTimestamp() const;
374 void SetTimestamp(long ts = 0);
379 bool IsCommandEvent() const;
381 // Can instruct event processor that we wish to ignore this event
382 // (treat as if the event table entry had not been found): this must be done
383 // to allow the event processing by the base classes (calling event.Skip()
384 // is the analog of calling the base class verstion of a virtual function)
385 void Skip(bool skip = True);
386 bool GetSkipped() const;
388 // Determine if this event should be propagating to the parent window.
389 bool ShouldPropagate() const;
391 // Stop an event from propagating to its parent window, returns the old
392 // propagation level value
393 int StopPropagation();
395 // Resume the event propagation by restoring the propagation level
396 // (returned by StopPropagation())
397 void ResumePropagation(int propagationLevel);
399 // this function is used to create a copy of the event polymorphically and
400 // all derived classes must implement it because otherwise wxPostEvent()
401 // for them wouldn't work (it needs to do a copy of the event)
402 virtual wxEvent *Clone() /* =0*/;
406 //---------------------------------------------------------------------------
409 // Helper class to temporarily change an event not to propagate.
410 class wxPropagationDisabler
413 wxPropagationDisabler(wxEvent& event);
414 ~wxPropagationDisabler();
418 // Another one to temporarily lower propagation level.
419 class wxPropagateOnce
422 wxPropagateOnce(wxEvent& event);
426 //---------------------------------------------------------------------------
429 class wxCommandEvent : public wxEvent
432 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
435 // // Set/Get client data from controls
436 // void SetClientData(void* clientData) { m_clientData = clientData; }
437 // void *GetClientData() const { return m_clientData; }
439 // // Set/Get client object from controls
440 // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
441 // void *GetClientObject() const { return m_clientObject; }
444 // Get listbox selection if single-choice
445 int GetSelection() const;
447 // Set/Get listbox/choice selection string
448 void SetString(const wxString& s);
449 wxString GetString() const;
451 // Get checkbox value
452 bool IsChecked() const;
453 %pythoncode { Checked = IsChecked }
455 // True if the listbox event was a selection.
456 bool IsSelection() const;
458 void SetExtraLong(long extraLong);
459 long GetExtraLong() const;
464 virtual wxEvent *Clone() const;
468 //---------------------------------------------------------------------------
471 // this class adds a possibility to react (from the user) code to a control
472 // notification: allow or veto the operation being reported.
473 class wxNotifyEvent : public wxCommandEvent
476 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
478 // veto the operation (usually it's allowed by default)
481 // allow the operation if it was disabled by default
484 // for implementation code only: is the operation allowed?
489 //---------------------------------------------------------------------------
492 // Scroll event class, derived form wxCommandEvent. wxScrollEvents are
493 // sent by wxSlider and wxScrollBar.
494 class wxScrollEvent : public wxCommandEvent
497 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
498 int winid = 0, int pos = 0, int orient = 0);
500 int GetOrientation() const;
501 int GetPosition() const;
502 void SetOrientation(int orient);
503 void SetPosition(int pos);
507 //---------------------------------------------------------------------------
510 // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
511 // are sent by wxWindow.
512 class wxScrollWinEvent : public wxEvent
515 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
516 int pos = 0, int orient = 0);
518 int GetOrientation() const;
519 int GetPosition() const;
520 void SetOrientation(int orient);
521 void SetPosition(int pos);
524 //---------------------------------------------------------------------------
527 // the symbolic names for the mouse buttons
530 wxMOUSE_BTN_ANY = -1,
531 wxMOUSE_BTN_NONE = -1,
532 wxMOUSE_BTN_LEFT = 0,
533 wxMOUSE_BTN_MIDDLE = 1,
534 wxMOUSE_BTN_RIGHT = 2
539 class wxMouseEvent : public wxEvent
542 wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
544 // Was it a button event? (*doesn't* mean: is any button *down*?)
545 bool IsButton() const;
547 // Was it a down event from this (or any) button?
548 bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
550 // Was it a dclick event from this (or any) button?
551 bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
553 // Was it a up event from this (or any) button?
554 bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
556 // Was the given button changing state?
557 bool Button(int but) const;
559 // Was the given button in Down state?
560 bool ButtonIsDown(int but) const;
562 // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
563 int GetButton() const;
565 // Find state of shift/control keys
566 bool ControlDown() const;
567 bool MetaDown() const;
568 bool AltDown() const;
569 bool ShiftDown() const;
571 // Find which event was just generated
572 bool LeftDown() const;
573 bool MiddleDown() const;
574 bool RightDown() const;
577 bool MiddleUp() const;
578 bool RightUp() const;
580 bool LeftDClick() const;
581 bool MiddleDClick() const;
582 bool RightDClick() const;
584 // Find the current state of the mouse buttons (regardless
585 // of current event type)
590 // True if a button is down and the mouse is moving
591 bool Dragging() const;
593 // True if the mouse is moving, and no button is down
596 // True if the mouse is just entering the window
597 bool Entering() const;
599 // True if the mouse is just leaving the window
600 bool Leaving() const;
603 DocStr(GetPosition, // sets the docstring for both
604 "Returns the position of the mouse in window coordinates when the event happened.");
605 wxPoint GetPosition();
608 void, GetPosition(long *OUTPUT, long *OUTPUT),
609 "GetPositionTuple() -> (x,y)",
612 // Find the logical position of the event given the DC
613 wxPoint GetLogicalPosition(const wxDC& dc) const;
616 wxCoord GetX() const;
619 wxCoord GetY() const;
621 // Get wheel rotation, positive or negative indicates direction of
622 // rotation. Current devices all send an event when rotation is equal to
623 // +/-WheelDelta, but this allows for finer resolution devices to be
624 // created in the future. Because of this you shouldn't assume that one
625 // event is equal to 1 line or whatever, but you should be able to either
626 // do partial line scrolling or wait until +/-WheelDelta rotation values
627 // have been accumulated before scrolling.
628 int GetWheelRotation() const;
630 // Get wheel delta, normally 120. This is the threshold for action to be
631 // taken, and one such action (for example, scrolling one increment)
632 // should occur for each delta.
633 int GetWheelDelta() const;
635 // Returns the configured number of lines (or whatever) to be scrolled per
636 // wheel action. Defaults to one.
637 int GetLinesPerAction() const;
639 // Is the system set to do page scrolling?
640 bool IsPageScroll() const;
656 int m_linesPerAction;
659 //---------------------------------------------------------------------------
663 class wxSetCursorEvent : public wxEvent
666 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0);
668 wxCoord GetX() const;
669 wxCoord GetY() const;
671 void SetCursor(const wxCursor& cursor);
672 const wxCursor& GetCursor() const;
673 bool HasCursor() const;
676 //---------------------------------------------------------------------------
679 // Keyboard input event class
681 class wxKeyEvent : public wxEvent
684 wxKeyEvent(wxEventType keyType = wxEVT_NULL);
686 // Find state of shift/control keys
687 bool ControlDown() const;
688 bool MetaDown() const;
689 bool AltDown() const;
690 bool ShiftDown() const;
692 // exclude MetaDown() from HasModifiers() because NumLock under X is often
693 // configured as mod2 modifier, yet the key events even when it is pressed
694 // should be processed normally, not like Ctrl- or Alt-key
695 bool HasModifiers() const;
697 // get the key code: an ASCII7 char or an element of wxKeyCode enum
698 int GetKeyCode() const;
699 %pythoncode { KeyCode = GetKeyCode }
704 return self->m_uniChar;
711 // get the raw key code (platform-dependent)
712 wxUint32 GetRawKeyCode() const;
714 // get the raw key flags (platform-dependent)
715 wxUint32 GetRawKeyFlags() const;
718 DocStr(GetPosition, // sets the docstring for both
719 "Find the position of the event.");
720 wxPoint GetPosition();
723 void, GetPosition(long *OUTPUT, long *OUTPUT),
724 "GetPositionTuple() -> (x,y)",
728 wxCoord GetX() const;
731 wxCoord GetY() const;
744 // these fields contain the platform-specific information about
745 // key that was pressed
750 //---------------------------------------------------------------------------
754 class wxSizeEvent : public wxEvent
757 wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0);
759 wxSize GetSize() const;
760 wxRect GetRect() const;
761 void SetRect(wxRect rect);
763 void SetSize(wxSize size) {
770 wxRect m_rect; // Used for wxEVT_SIZING
774 //---------------------------------------------------------------------------
778 class wxMoveEvent : public wxEvent
781 wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0);
783 wxPoint GetPosition() const;
784 wxRect GetRect() const;
785 void SetRect(wxRect rect);
787 void SetPosition(wxPoint pos) {
796 //---------------------------------------------------------------------------
800 class wxPaintEvent : public wxEvent
803 wxPaintEvent(int Id = 0);
807 class wxNcPaintEvent : public wxEvent
810 wxNcPaintEvent(int winid = 0);
813 //---------------------------------------------------------------------------
816 class wxEraseEvent : public wxEvent
819 wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL);
825 //---------------------------------------------------------------------------
828 class wxFocusEvent : public wxEvent
831 wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0);
833 // The window associated with this event is the window which had focus
834 // before for SET event and the window which will have focus for the KILL
835 // one. NB: it may be NULL in both cases!
836 wxWindow *GetWindow() const;
837 void SetWindow(wxWindow *win);
840 //---------------------------------------------------------------------------
843 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
844 // wxFocusEvent it is propagated upwards the window chain
845 class wxChildFocusEvent : public wxCommandEvent
848 wxChildFocusEvent(wxWindow *win = NULL);
850 wxWindow *GetWindow() const;
853 //---------------------------------------------------------------------------
856 class wxActivateEvent : public wxEvent
859 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = True, int Id = 0);
860 bool GetActive() const;
864 //---------------------------------------------------------------------------
867 class wxInitDialogEvent : public wxEvent
870 wxInitDialogEvent(int Id = 0);
874 //---------------------------------------------------------------------------
877 class wxMenuEvent : public wxEvent
880 wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL);
882 // only for wxEVT_MENU_HIGHLIGHT
883 int GetMenuId() const;
885 // only for wxEVT_MENU_OPEN/CLOSE
886 bool IsPopup() const;
888 // only for wxEVT_MENU_OPEN/CLOSE
889 wxMenu* GetMenu() const;
892 //---------------------------------------------------------------------------
895 // Window close or session close event class
896 class wxCloseEvent : public wxEvent
899 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0);
901 void SetLoggingOff(bool logOff);
902 bool GetLoggingOff() const;
904 void Veto(bool veto = True);
905 void SetCanVeto(bool canVeto);
907 bool CanVeto() const;
908 bool GetVeto() const;
912 //---------------------------------------------------------------------------
915 class wxShowEvent : public wxEvent
918 wxShowEvent(int winid = 0, bool show = False);
920 void SetShow(bool show);
921 bool GetShow() const;
926 //---------------------------------------------------------------------------
929 class wxIconizeEvent: public wxEvent
932 wxIconizeEvent(int id = 0, bool iconized = True);
937 //---------------------------------------------------------------------------
940 class wxMaximizeEvent: public wxEvent
943 wxMaximizeEvent(int id = 0);
946 //---------------------------------------------------------------------------
949 class wxDropFilesEvent: public wxEvent
952 wxPoint GetPosition();
953 int GetNumberOfFiles();
956 PyObject* GetFiles() {
957 int count = self->GetNumberOfFiles();
958 wxString* files = self->GetFiles();
959 PyObject* list = PyList_New(count);
962 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
966 for (int i=0; i<count; i++) {
967 PyList_SetItem(list, i, wx2PyString(files[i]));
976 //---------------------------------------------------------------------------
980 // Whether to always send update events to windows, or
981 // to only send update events to those with the
982 // wxWS_EX_PROCESS_UI_UPDATES style.
986 // Send UI update events to all windows
987 wxUPDATE_UI_PROCESS_ALL,
989 // Send UI update events to windows that have
990 // the wxWS_EX_PROCESS_UI_UPDATES flag specified
991 wxUPDATE_UI_PROCESS_SPECIFIED
994 class wxUpdateUIEvent : public wxCommandEvent
997 wxUpdateUIEvent(wxWindowID commandId = 0);
999 bool GetChecked() const;
1000 bool GetEnabled() const;
1001 wxString GetText() const;
1002 bool GetSetText() const;
1003 bool GetSetChecked() const;
1004 bool GetSetEnabled() const;
1006 void Check(bool check);
1007 void Enable(bool enable);
1008 void SetText(const wxString& text);
1010 // Sets the interval between updates in milliseconds.
1011 // Set to -1 to disable updates, or to 0 to update as frequently as possible.
1012 static void SetUpdateInterval(long updateInterval);
1014 // Returns the current interval between updates in milliseconds
1015 static long GetUpdateInterval();
1017 // Can we update this window?
1018 static bool CanUpdate(wxWindow *win);
1020 // Reset the update time to provide a delay until the next
1021 // time we should update
1022 static void ResetUpdateTime();
1024 // Specify how wxWindows will send update events: to
1025 // all windows, or only to those which specify that they
1026 // will process the events.
1027 static void SetMode(wxUpdateUIMode mode);
1029 // Returns the UI update mode
1030 static wxUpdateUIMode GetMode();
1034 //---------------------------------------------------------------------------
1037 class wxSysColourChangedEvent: public wxEvent {
1039 wxSysColourChangedEvent();
1042 //---------------------------------------------------------------------------
1046 // wxEVT_MOUSE_CAPTURE_CHANGED
1047 // The window losing the capture receives this message
1048 // (even if it released the capture itself).
1049 class wxMouseCaptureChangedEvent : public wxEvent
1052 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL);
1054 wxWindow* GetCapturedWindow() const;
1057 //---------------------------------------------------------------------------
1060 class wxDisplayChangedEvent : public wxEvent
1063 wxDisplayChangedEvent();
1066 //---------------------------------------------------------------------------
1069 class wxPaletteChangedEvent : public wxEvent
1072 wxPaletteChangedEvent(wxWindowID id = 0);
1074 void SetChangedWindow(wxWindow* win);
1075 wxWindow* GetChangedWindow();
1079 //---------------------------------------------------------------------------
1083 // wxEVT_QUERY_NEW_PALETTE
1084 // Indicates the window is getting keyboard focus and should re-do its palette.
1085 class wxQueryNewPaletteEvent : public wxEvent
1088 wxQueryNewPaletteEvent(wxWindowID winid = 0);
1090 // App sets this if it changes the palette.
1091 void SetPaletteRealized(bool realized);
1092 bool GetPaletteRealized() const;
1095 //---------------------------------------------------------------------------
1099 // Event generated by dialog navigation keys
1100 // wxEVT_NAVIGATION_KEY
1102 class wxNavigationKeyEvent : public wxEvent
1105 wxNavigationKeyEvent();
1107 // direction: forward (True) or backward (False)
1108 bool GetDirection() const;
1109 void SetDirection(bool bForward);
1111 // it may be a window change event (MDI, notebook pages...) or a control
1113 bool IsWindowChange() const;
1114 void SetWindowChange(bool bIs);
1116 // the child which has the focus currently (may be NULL - use
1117 // wxWindow::FindFocus then)
1118 wxWindow* GetCurrentFocus() const;
1119 void SetCurrentFocus(wxWindow *win);
1123 //---------------------------------------------------------------------------
1126 // Window creation/destruction events: the first is sent as soon as window is
1127 // created (i.e. the underlying GUI object exists), but when the C++ object is
1128 // fully initialized (so virtual functions may be called). The second,
1129 // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
1130 // still safe to call virtual functions at this moment
1132 class wxWindowCreateEvent : public wxCommandEvent
1135 wxWindowCreateEvent(wxWindow *win = NULL);
1136 wxWindow *GetWindow() const;
1139 class wxWindowDestroyEvent : public wxCommandEvent
1142 wxWindowDestroyEvent(wxWindow *win = NULL);
1143 wxWindow *GetWindow() const;
1147 //---------------------------------------------------------------------------
1150 // A Context event is sent when the user right clicks on a window or
1151 // presses Shift-F10
1152 // NOTE : Under windows this is a repackaged WM_CONTETXMENU message
1153 // Under other systems it may have to be generated from a right click event
1158 class wxContextMenuEvent : public wxCommandEvent
1161 wxContextMenuEvent(wxEventType type = wxEVT_NULL,
1162 wxWindowID winid = 0,
1163 const wxPoint& pt = wxDefaultPosition);
1165 // Position of event (in screen coordinates)
1166 const wxPoint& GetPosition() const;
1167 void SetPosition(const wxPoint& pos);
1170 //---------------------------------------------------------------------------
1173 // Whether to always send idle events to windows, or
1174 // to only send update events to those with the
1175 // wxWS_EX_PROCESS_IDLE style.
1179 // Send idle events to all windows
1182 // Send idle events to windows that have
1183 // the wxWS_EX_PROCESS_IDLE flag specified
1184 wxIDLE_PROCESS_SPECIFIED
1187 class wxIdleEvent : public wxEvent
1192 void RequestMore(bool needMore = True);
1193 bool MoreRequested() const;
1195 // Specify how wxWindows will send idle events: to
1196 // all windows, or only to those which specify that they
1197 // will process the events.
1198 static void SetMode(wxIdleMode mode);
1200 // Returns the idle event mode
1201 static wxIdleMode GetMode();
1203 // Can we send an idle event?
1204 static bool CanSend(wxWindow* win);
1207 //---------------------------------------------------------------------------
1210 // These classes can be derived from in Python and passed through the event
1211 // system without loosing anything. They do this by keeping a reference to
1212 // themselves and some special case handling in wxPyCallback::EventThunker.
1214 class wxPyEvent : public wxEvent {
1216 %addtofunc wxPyEvent "self.SetSelf(self)"
1217 wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL );
1221 void SetSelf(PyObject* self);
1222 PyObject* GetSelf();
1226 class wxPyCommandEvent : public wxCommandEvent {
1228 %addtofunc wxPyCommandEvent "self.SetSelf(self)"
1229 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
1230 ~wxPyCommandEvent();
1232 void SetSelf(PyObject* self);
1233 PyObject* GetSelf();
1238 //---------------------------------------------------------------------------