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;
105 #define wxEVT_HOTKEY -9999
109 %constant wxEventType wxEVT_HOTKEY;
113 %constant wxEventType wxEVT_SET_CURSOR;
115 // wxScrollBar and wxSlider event identifiers
116 %constant wxEventType wxEVT_SCROLL_TOP;
117 %constant wxEventType wxEVT_SCROLL_BOTTOM;
118 %constant wxEventType wxEVT_SCROLL_LINEUP;
119 %constant wxEventType wxEVT_SCROLL_LINEDOWN;
120 %constant wxEventType wxEVT_SCROLL_PAGEUP;
121 %constant wxEventType wxEVT_SCROLL_PAGEDOWN;
122 %constant wxEventType wxEVT_SCROLL_THUMBTRACK;
123 %constant wxEventType wxEVT_SCROLL_THUMBRELEASE;
124 %constant wxEventType wxEVT_SCROLL_CHANGED;
125 %pythoncode { wxEVT_SCROLL_ENDSCROLL = wxEVT_SCROLL_CHANGED }
128 // Scroll events from wxWindow
129 %constant wxEventType wxEVT_SCROLLWIN_TOP;
130 %constant wxEventType wxEVT_SCROLLWIN_BOTTOM;
131 %constant wxEventType wxEVT_SCROLLWIN_LINEUP;
132 %constant wxEventType wxEVT_SCROLLWIN_LINEDOWN;
133 %constant wxEventType wxEVT_SCROLLWIN_PAGEUP;
134 %constant wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
135 %constant wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
136 %constant wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
139 %constant wxEventType wxEVT_SIZE;
140 %constant wxEventType wxEVT_MOVE;
141 %constant wxEventType wxEVT_CLOSE_WINDOW;
142 %constant wxEventType wxEVT_END_SESSION;
143 %constant wxEventType wxEVT_QUERY_END_SESSION;
144 %constant wxEventType wxEVT_ACTIVATE_APP;
145 %constant wxEventType wxEVT_POWER;
146 %constant wxEventType wxEVT_ACTIVATE;
147 %constant wxEventType wxEVT_CREATE;
148 %constant wxEventType wxEVT_DESTROY;
149 %constant wxEventType wxEVT_SHOW;
150 %constant wxEventType wxEVT_ICONIZE;
151 %constant wxEventType wxEVT_MAXIMIZE;
152 %constant wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
153 %constant wxEventType wxEVT_PAINT;
154 %constant wxEventType wxEVT_ERASE_BACKGROUND;
155 %constant wxEventType wxEVT_NC_PAINT;
156 %constant wxEventType wxEVT_PAINT_ICON;
157 %constant wxEventType wxEVT_MENU_OPEN;
158 %constant wxEventType wxEVT_MENU_CLOSE;
159 %constant wxEventType wxEVT_MENU_HIGHLIGHT;
161 %constant wxEventType wxEVT_CONTEXT_MENU;
162 %constant wxEventType wxEVT_SYS_COLOUR_CHANGED;
163 %constant wxEventType wxEVT_DISPLAY_CHANGED;
164 %constant wxEventType wxEVT_SETTING_CHANGED;
165 %constant wxEventType wxEVT_QUERY_NEW_PALETTE;
166 %constant wxEventType wxEVT_PALETTE_CHANGED;
167 %constant wxEventType wxEVT_DROP_FILES;
168 %constant wxEventType wxEVT_DRAW_ITEM;
169 %constant wxEventType wxEVT_MEASURE_ITEM;
170 %constant wxEventType wxEVT_COMPARE_ITEM;
171 %constant wxEventType wxEVT_INIT_DIALOG;
172 %constant wxEventType wxEVT_IDLE;
173 %constant wxEventType wxEVT_UPDATE_UI;
174 %constant wxEventType wxEVT_SIZING;
175 %constant wxEventType wxEVT_MOVING;
176 %constant wxEventType wxEVT_HIBERNATE;
179 // Generic command events
180 // Note: a click is a higher-level event than button down/up
181 %constant wxEventType wxEVT_COMMAND_LEFT_CLICK;
182 %constant wxEventType wxEVT_COMMAND_LEFT_DCLICK;
183 %constant wxEventType wxEVT_COMMAND_RIGHT_CLICK;
184 %constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
185 %constant wxEventType wxEVT_COMMAND_SET_FOCUS;
186 %constant wxEventType wxEVT_COMMAND_KILL_FOCUS;
187 %constant wxEventType wxEVT_COMMAND_ENTER;
193 %# Create some event binders
194 EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
195 EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
196 EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
197 EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
198 EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
199 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
200 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
201 EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
202 EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
203 EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
204 EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
205 EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
206 EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
207 EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
208 EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
209 EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
210 EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
211 EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
212 EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
213 EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
214 EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
215 EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
216 EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
217 EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
218 EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE )
219 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
220 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
221 EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
222 EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
223 EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
224 EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
225 EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
226 EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
227 EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
228 EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
229 EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
230 EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
231 EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
232 EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
233 EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
234 EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
236 EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
237 EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
238 EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
239 EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
240 EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
241 EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
242 EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
243 EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
244 EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
245 EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
246 EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
247 EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
248 EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
250 EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN,
266 %# Scrolling from wxWindow (sent to wxScrolledWindow)
267 EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP,
268 wxEVT_SCROLLWIN_BOTTOM,
269 wxEVT_SCROLLWIN_LINEUP,
270 wxEVT_SCROLLWIN_LINEDOWN,
271 wxEVT_SCROLLWIN_PAGEUP,
272 wxEVT_SCROLLWIN_PAGEDOWN,
273 wxEVT_SCROLLWIN_THUMBTRACK,
274 wxEVT_SCROLLWIN_THUMBRELEASE,
277 EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
278 EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
279 EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
280 EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
281 EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
282 EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
283 EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
284 EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
286 %# Scrolling from wx.Slider and wx.ScrollBar
287 EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
290 wxEVT_SCROLL_LINEDOWN,
292 wxEVT_SCROLL_PAGEDOWN,
293 wxEVT_SCROLL_THUMBTRACK,
294 wxEVT_SCROLL_THUMBRELEASE,
295 wxEVT_SCROLL_CHANGED,
298 EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
299 EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
300 EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
301 EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
302 EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
303 EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
304 EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
305 EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
306 EVT_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED )
307 EVT_SCROLL_ENDSCROLL = EVT_SCROLL_CHANGED
309 %# Scrolling from wx.Slider and wx.ScrollBar, with an id
310 EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
313 wxEVT_SCROLL_LINEDOWN,
315 wxEVT_SCROLL_PAGEDOWN,
316 wxEVT_SCROLL_THUMBTRACK,
317 wxEVT_SCROLL_THUMBRELEASE,
318 wxEVT_SCROLL_CHANGED,
321 EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
322 EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
323 EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
324 EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
325 EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
326 EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
327 EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
328 EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
329 EVT_COMMAND_SCROLL_CHANGED = wx.PyEventBinder( wxEVT_SCROLL_CHANGED, 1)
330 EVT_COMMAND_SCROLL_ENDSCROLL = EVT_COMMAND_SCROLL_CHANGED
332 EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1)
333 EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1)
334 EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1)
335 EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1)
336 EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1)
337 EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1)
338 EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2)
339 EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1)
340 EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1)
341 EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1)
343 EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1)
344 EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1)
345 EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1)
346 EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1)
347 EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2)
348 EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1)
349 EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2)
350 EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1)
351 EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1)
354 EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
355 EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
356 EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
357 EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
358 EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
359 EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
360 EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
362 EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
364 EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
365 EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
367 EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
372 //---------------------------------------------------------------------------
376 "An event is a structure holding information about an event passed to a
377 callback or member function. wx.Event is an abstract base class for
378 other event classes", "");
380 class wxEvent : public wxObject {
382 // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC
386 void , SetEventType(wxEventType typ),
387 "Sets the specific type of the event.", "");
390 wxEventType , GetEventType() const,
391 "Returns the identifier of the given event type, such as
392 ``wxEVT_COMMAND_BUTTON_CLICKED``.", "");
395 wxObject *, GetEventObject() const,
396 "Returns the object (usually a window) associated with the event, if
400 void , SetEventObject(wxObject *obj),
401 "Sets the originating object, or in other words, obj is normally the
402 object that is sending the event.", "");
404 long GetTimestamp() const;
405 void SetTimestamp(long ts = 0);
409 "Returns the identifier associated with this event, such as a button
413 void , SetId(int Id),
414 "Set's the ID for the event. This is usually the ID of the window that
415 is sending the event, but it can also be a command id from a menu
421 bool , IsCommandEvent() const,
422 "Returns true if the event is or is derived from `wx.CommandEvent` else
423 it returns false. Note: Exists only for optimization purposes.", "");
427 void , Skip(bool skip = true),
428 "Called by an event handler, it controls whether additional event
429 handlers bound to this event will be called after the current event
430 handler returns. Skip(false) (the default setting) will prevent
431 additional event handlers from being called and control will be
432 returned to the sender of the event immediately after the current
433 handler has finished. Skip(True) will cause the event processing
434 system to continue searching for a handler function for this event.
438 bool , GetSkipped() const,
439 "Returns true if the event handler should be skipped, false otherwise.
444 bool , ShouldPropagate() const,
445 "Test if this event should be propagated to the parent window or not,
446 i.e. if the propagation level is currently greater than 0.", "");
449 // Stop an event from propagating to its parent window, returns the old
450 // propagation level value
452 int , StopPropagation(),
453 "Stop the event from propagating to its parent window. Returns the old
454 propagation level value which may be later passed to
455 `ResumePropagation` to allow propagating the event again.", "");
459 void , ResumePropagation(int propagationLevel),
460 "Resume the event propagation by restoring the propagation level. (For
461 example, you can use the value returned by an earlier call to
466 // this function is used to create a copy of the event polymorphically and
467 // all derived classes must implement it because otherwise wxPostEvent()
468 // for them wouldn't work (it needs to do a copy of the event)
469 virtual wxEvent *Clone() /* =0*/;
473 //---------------------------------------------------------------------------
476 DocStr(wxPropagationDisabler,
477 "Helper class to temporarily change an event not to propagate. Simply
478 create an instance of this class and then whe it is destroyed the
479 propogation of the event will be restored.", "");
480 class wxPropagationDisabler
483 wxPropagationDisabler(wxEvent& event);
484 ~wxPropagationDisabler();
488 DocStr( wxPropagateOnce,
489 "A helper class that will temporarily lower propagation level of an
490 event. Simply create an instance of this class and then whe it is
491 destroyed the propogation of the event will be restored.", "");
492 class wxPropagateOnce
495 wxPropagateOnce(wxEvent& event);
499 //---------------------------------------------------------------------------
502 DocStr(wxCommandEvent,
503 "This event class contains information about command events, which
504 originate from a variety of simple controls, as well as menus and
507 class wxCommandEvent : public wxEvent
510 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
513 // // Set/Get client data from controls
514 // void SetClientData(void* clientData) { m_clientData = clientData; }
515 // void *GetClientData() const { return m_clientData; }
517 // // Set/Get client object from controls
518 // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
519 // void *GetClientObject() const { return m_clientObject; }
523 int , GetSelection() const,
524 "Returns item index for a listbox or choice selection event (not valid
525 for a deselection).", "");
528 void SetString(const wxString& s);
530 wxString , GetString() const,
531 "Returns item string for a listbox or choice selection event (not valid
532 for a deselection).", "");
536 bool , IsChecked() const,
537 "This method can be used with checkbox and menu events: for the
538 checkboxes, the method returns true for a selection event and false
539 for a deselection one. For the menu events, this method indicates if
540 the menu item just has become checked or unchecked (and thus only
541 makes sense for checkable menu items).", "");
543 %pythoncode { Checked = IsChecked }
546 bool , IsSelection() const,
547 "For a listbox or similar event, returns true if it is a selection,
548 false if it is a deselection.", "");
551 void SetExtraLong(long extraLong);
553 long , GetExtraLong() const,
554 "Returns extra information dependant on the event objects type. If the
555 event comes from a listbox selection, it is a boolean determining
556 whether the event was a selection (true) or a deselection (false). A
557 listbox deselection only occurs for multiple-selection boxes, and in
558 this case the index and string values are indeterminate and the
559 listbox must be examined by the application.", "");
564 long , GetInt() const,
565 "Returns the integer identifier corresponding to a listbox, choice or
566 radiobox selection (only if the event was a selection, not a
567 deselection), or a boolean value representing the value of a checkbox.", "");
570 virtual wxEvent *Clone() const;
574 //---------------------------------------------------------------------------
577 DocStr(wxNotifyEvent,
578 "An instance of this class (or one of its derived classes) is sent from
579 a control when the control's state is being changed and the control
580 allows that change to be prevented from happening. The event handler
581 can call `Veto` or `Allow` to tell the control what to do.", "");
583 class wxNotifyEvent : public wxCommandEvent
586 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
590 "Prevents the change announced by this event from happening.
592 It is in general a good idea to notify the user about the reasons for
593 vetoing the change because otherwise the applications behaviour (which
594 just refuses to do what the user wants) might be quite surprising.", "");
599 "This is the opposite of `Veto`: it explicitly allows the event to be
600 processed. For most events it is not necessary to call this method as
601 the events are allowed anyhow but some are forbidden by default (this
602 will be mentioned in the corresponding event description).", "");
607 "Returns true if the change is allowed (`Veto` hasn't been called) or
608 false otherwise (if it was).", "");
613 //---------------------------------------------------------------------------
616 DocStr(wxScrollEvent,
617 "A scroll event holds information about events sent from stand-alone
618 scrollbars and sliders. Note that scrolled windows do not send
619 instnaces of this event class, but send the `wx.ScrollWinEvent`
624 ======================= ==========================================
625 EVT_SCROLL Used to bind all scroll events
626 EVT_SCROLL_TOP scroll-to-top events (minimum position)
627 EVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position)
628 EVT_SCROLL_LINEUP line up events
629 EVT_SCROLL_LINEDOWN line down events
630 EVT_SCROLL_PAGEUP page up events
631 EVT_SCROLL_PAGEDOWN page down events
632 EVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
633 as the user drags the 'thumb')
634 EVT_SCROLL_THUMBRELEASE thumb release events.
635 EVT_SCROLL_ENDSCROLL End of scrolling
636 ======================= ==========================================
640 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually
641 dragging the thumb using the mouse and releasing it (This
642 EVT_SCROLL_THUMBRELEASE event is also followed by an
643 EVT_SCROLL_ENDSCROLL event).
645 The EVT_SCROLL_ENDSCROLL event also occurs when using the keyboard
646 to change the thumb position, and when clicking next to the thumb
647 (In all these cases the EVT_SCROLL_THUMBRELEASE event does not
650 In short, the EVT_SCROLL_ENDSCROLL event is triggered when
651 scrolling/ moving has finished. The only exception (unfortunately)
652 is that changing the thumb position using the mousewheel does give
653 a EVT_SCROLL_THUMBRELEASE event but NOT an EVT_SCROLL_ENDSCROLL
657 class wxScrollEvent : public wxCommandEvent
661 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
662 int winid = 0, int pos = 0, int orient = 0),
666 int , GetOrientation() const,
667 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
668 the scrollbar.", "");
671 int , GetPosition() const,
672 "Returns the position of the scrollbar.", "");
674 void SetOrientation(int orient);
675 void SetPosition(int pos);
679 //---------------------------------------------------------------------------
682 DocStr(wxScrollWinEvent,
683 "A wx.ScrollWinEvent holds information about scrolling and is sent from
684 scrolling windows.", "
688 ========================== ==========================================
689 EVT_SCROLLWIN Used to bind all scrolled window scroll events
690 EVT_SCROLLWIN_TOP scroll-to-top events (minimum position)
691 EVT_SCROLLWIN_BOTTOM scroll-to-bottom events (maximum position)
692 EVT_SCROLLWIN_LINEUP line up events
693 EVT_SCROLLWIN_LINEDOWN line down events
694 EVT_SCROLLWIN_PAGEUP page up events
695 EVT_SCROLLWIN_PAGEDOWN page down events
696 EVT_SCROLLWIN_THUMBTRACK thumbtrack events (frequent events sent
697 as the user drags the 'thumb')
698 EVT_SCROLLWIN_THUMBRELEASE thumb release events.
699 EVT_SCROLLWIN_ENDSCROLL End of scrolling
700 ========================== ==========================================
702 :see: `wx.ScrollEvent`
705 class wxScrollWinEvent : public wxEvent
708 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
709 int pos = 0, int orient = 0);
712 int , GetOrientation() const,
713 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
714 the scrollbar.", "");
717 int , GetPosition() const,
718 "Returns the position of the scrollbar for the thumb track and release
719 events. Note that this field can't be used for the other events, you
720 need to query the window itself for the current position in that case.", "");
722 void SetOrientation(int orient);
723 void SetPosition(int pos);
726 //---------------------------------------------------------------------------
731 "This event class contains information about the events generated by
732 the mouse: they include mouse buttons press and release events and
735 All mouse events involving the buttons use ``wx.MOUSE_BTN_LEFT`` for
736 the left mouse button, ``wx.MOUSE_BTN_MIDDLE`` for the middle one and
737 ``wx.MOUSE_BTN_RIGHT`` for the right one. Note that not all mice have
738 a middle button so a portable application should avoid relying on the
741 Note the difference between methods like `LeftDown` and `LeftIsDown`:
742 the former returns true when the event corresponds to the left mouse
743 button click while the latter returns true if the left mouse button is
744 currently being pressed. For example, when the user is dragging the
745 mouse you can use `LeftIsDown` to test whether the left mouse button
746 is (still) depressed. Also, by convention, if `LeftDown` returns true,
747 `LeftIsDown` will also return true in wxWidgets whatever the
748 underlying GUI behaviour is (which is platform-dependent). The same
749 applies, of course, to other mouse buttons as well.", "
753 ================== ==============================================
754 EVT_LEFT_DOWN Left mouse button down event. The handler
755 of this event should normally call
756 event.Skip() to allow the default processing
757 to take place as otherwise the window under
758 mouse wouldn't get the focus.
759 EVT_LEFT_UP Left mouse button up event
760 EVT_LEFT_DCLICK Left mouse button double click event
761 EVT_MIDDLE_DOWN Middle mouse button down event
762 EVT_MIDDLE_UP Middle mouse button up event
763 EVT_MIDDLE_DCLICK Middle mouse button double click event
764 EVT_RIGHT_DOWN Right mouse button down event
765 EVT_RIGHT_UP Right mouse button up event
766 EVT_RIGHT_DCLICK Right mouse button double click event
767 EVT_MOTION Event sent when the mouse is moving
768 EVT_ENTER_WINDOW Event sent when the mouse enters the
769 boundaries of a window.
770 EVT_LEAVE_WINDOW Sent when the mouse leaves the window's bounds
771 EVT_MOUSEWHEEL Mouse scroll wheel event
772 EVT_MOUSE_EVENTS Binds all mouse events at once.
773 ================== ==============================================
778 // the symbolic names for the mouse buttons
781 wxMOUSE_BTN_ANY = -1,
782 wxMOUSE_BTN_NONE = -1,
783 wxMOUSE_BTN_LEFT = 0,
784 wxMOUSE_BTN_MIDDLE = 1,
785 wxMOUSE_BTN_RIGHT = 2
790 class wxMouseEvent : public wxEvent
794 wxMouseEvent(wxEventType mouseType = wxEVT_NULL),
795 "Constructs a wx.MouseEvent. Valid event types are:
804 * wxEVT_MIDDLE_DCLICK
809 * wxEVT_MOUSEWHEEL ", "");
813 bool , IsButton() const,
814 "Returns true if the event was a mouse button event (not necessarily a
815 button down event - that may be tested using `ButtonDown`).", "");
819 bool , ButtonDown(int but = wxMOUSE_BTN_ANY) const,
820 "If the argument is omitted, this returns true if the event was any
821 mouse button down event. Otherwise the argument specifies which
822 button-down event shold be checked for (see `Button` for the possible
827 bool , ButtonDClick(int but = wxMOUSE_BTN_ANY) const,
828 "If the argument is omitted, this returns true if the event was any
829 mouse double click event. Otherwise the argument specifies which
830 double click event to check for (see `Button` for the possible
835 bool , ButtonUp(int but = wxMOUSE_BTN_ANY) const,
836 "If the argument is omitted, this returns true if the event was any
837 mouse button up event. Otherwise the argument specifies which button
838 up event to check for (see `Button` for the possible values).", "");
842 bool , Button(int button) const,
843 "Returns true if the identified mouse button is changing state. Valid
844 values of button are:
846 ==================== =====================================
847 wx.MOUSE_BTN_LEFT check if left button was pressed
848 wx.MOUSE_BTN_MIDDLE check if middle button was pressed
849 wx.MOUSE_BTN_RIGHT check if right button was pressed
850 wx.MOUSE_BTN_ANY check if any button was pressed
851 ==================== =====================================
855 // Was the given button in Down state?
856 bool ButtonIsDown(int but) const;
859 int , GetButton() const,
860 "Returns the mouse button which generated this event or
861 wx.MOUSE_BTN_NONE if no button is involved (for mouse move, enter or
862 leave event, for example). Otherwise wx.MOUSE_BTN_LEFT is returned for
863 the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE
864 and wx.MOUSE_BTN_RIGHT for the same events for the middle and the
865 right buttons respectively.", "");
869 bool , ControlDown() const,
870 "Returns true if the control key was down at the time of the event.", "");
873 bool , MetaDown() const,
874 "Returns true if the Meta key was down at the time of the event.", "");
878 bool , AltDown() const,
879 "Returns true if the Alt key was down at the time of the event.", "");
882 bool , ShiftDown() const,
883 "Returns true if the Shift key was down at the time of the event.", "");
887 bool , CmdDown() const,
888 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
889 platforms but the special \"Apple\" (a.k.a as \"Command\") key on
890 Macs. It often makes sense to use it instead of, say, `ControlDown`
891 because Cmd key is used for the same thing under Mac as Ctrl
892 elsewhere. The Ctrl key still exists, it's just not used for this
893 purpose. So for non-Mac platforms this is the same as `ControlDown`
894 and Macs this is the same as `MetaDown`.", "");
898 bool , LeftDown() const,
899 "Returns true if the left mouse button state changed to down.", "");
902 bool , MiddleDown() const,
903 "Returns true if the middle mouse button state changed to down.", "");
906 bool , RightDown() const,
907 "Returns true if the right mouse button state changed to down.", "");
912 bool , LeftUp() const,
913 "Returns true if the left mouse button state changed to up.", "");
916 bool , MiddleUp() const,
917 "Returns true if the middle mouse button state changed to up.", "");
920 bool , RightUp() const,
921 "Returns true if the right mouse button state changed to up.", "");
927 bool , LeftDClick() const,
928 "Returns true if the event was a left button double click.", "");
931 bool , MiddleDClick() const,
932 "Returns true if the event was a middle button double click.", "");
935 bool , RightDClick() const,
936 "Returns true if the event was a right button double click.", "");
942 "Returns true if the left mouse button is currently down, independent
943 of the current event type.
945 Please notice that it is not the same as LeftDown which returns true
946 if the left mouse button was just pressed. Rather, it describes the
947 state of the mouse button before the event happened.
949 This event is usually used in the mouse event handlers which process
950 \"move mouse\" messages to determine whether the user is (still)
951 dragging the mouse.", "");
954 bool , MiddleIsDown(),
955 "Returns true if the middle mouse button is currently down, independent
956 of the current event type.", "");
959 bool , RightIsDown(),
960 "Returns true if the right mouse button is currently down, independent
961 of the current event type.", "");
966 bool , Dragging() const,
967 "Returns true if this was a dragging event (motion while a button is
972 bool , Moving() const,
973 "Returns true if this was a motion event and no mouse buttons were
974 pressed. If any mouse button is held pressed, then this method returns
975 false and Dragging returns true.", "");
979 bool , Entering() const,
980 "Returns true if the mouse was entering the window.", "");
984 bool , Leaving() const,
985 "Returns true if the mouse was leaving the window.", "");
989 DocStr(GetPosition, // sets the docstring for both
990 "Returns the pixel position of the mouse in window coordinates when the
991 event happened.", "");
992 wxPoint GetPosition();
995 void, GetPosition(long *OUTPUT, long *OUTPUT),
996 "GetPositionTuple() -> (x,y)",
1000 wxPoint , GetLogicalPosition(const wxDC& dc) const,
1001 "Returns the logical mouse position in pixels (i.e. translated
1002 according to the translation set for the DC, which usually indicates
1003 that the window has been scrolled).", "");
1007 wxCoord , GetX() const,
1008 "Returns X coordinate of the physical mouse event position.", "");
1011 wxCoord , GetY() const,
1012 "Returns Y coordinate of the physical mouse event position.", "");
1016 int , GetWheelRotation() const,
1017 "Get wheel rotation, positive or negative indicates direction of
1018 rotation. Current devices all send an event when rotation is equal to
1019 +/-WheelDelta, but this allows for finer resolution devices to be
1020 created in the future. Because of this you shouldn't assume that one
1021 event is equal to 1 line or whatever, but you should be able to either
1022 do partial line scrolling or wait until +/-WheelDelta rotation values
1023 have been accumulated before scrolling.", "");
1027 int , GetWheelDelta() const,
1028 "Get wheel delta, normally 120. This is the threshold for action to be
1029 taken, and one such action (for example, scrolling one increment)
1030 should occur for each delta.", "");
1034 int , GetLinesPerAction() const,
1035 "Returns the configured number of lines (or whatever) to be scrolled
1036 per wheel action. Defaults to three.", "");
1040 bool , IsPageScroll() const,
1041 "Returns true if the system has been setup to do page scrolling with
1042 the mouse wheel instead of line scrolling.", "");
1057 int m_wheelRotation;
1059 int m_linesPerAction;
1062 //---------------------------------------------------------------------------
1067 DocStr(wxSetCursorEvent,
1068 "A SetCursorEvent is generated when the mouse cursor is about to be set
1069 as a result of mouse motion. This event gives the application the
1070 chance to perform specific mouse cursor processing based on the
1071 current position of the mouse within the window. Use the `SetCursor`
1072 method to specify the cursor you want to be displayed.", "");
1074 class wxSetCursorEvent : public wxEvent
1078 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0),
1079 "Construct a new `wx.SetCursorEvent`.", "");
1082 wxCoord , GetX() const,
1083 "Returns the X coordinate of the mouse in client coordinates.", "");
1086 wxCoord , GetY() const,
1087 "Returns the Y coordinate of the mouse in client coordinates.", "");
1091 void , SetCursor(const wxCursor& cursor),
1092 "Sets the cursor associated with this event.", "");
1095 const wxCursor& , GetCursor() const,
1096 "Returns a reference to the cursor specified by this event.", "");
1099 bool , HasCursor() const,
1100 "Returns true if the cursor specified by this event is a valid cursor.", "");
1104 //---------------------------------------------------------------------------
1107 // Keyboard input event class
1110 "This event class contains information about keypress and character
1111 events. These events are only sent to the widget that currently has
1114 Notice that there are three different kinds of keyboard events in
1115 wxWidgets: key down and up events and char events. The difference
1116 between the first two is clear - the first corresponds to a key press
1117 and the second to a key release - otherwise they are identical. Just
1118 note that if the key is maintained in a pressed state you will
1119 typically get a lot of (automatically generated) down events but only
1120 one up so it is wrong to assume that there is one up event
1121 corresponding to each down one.
1123 Both key events provide untranslated key codes while the char event
1124 carries the translated one. The untranslated code for alphanumeric
1125 keys is always an upper case value. For the other keys it is one of
1126 WXK_XXX values from the keycodes table. The translated key is, in
1127 general, the character the user expects to appear as the result of the
1128 key combination when typing the text into a text entry zone, for
1131 A few examples to clarify this (all assume that CAPS LOCK is unpressed
1132 and the standard US keyboard): when the 'A' key is pressed, the key
1133 down event key code is equal to ASCII A == 65. But the char event key
1134 code is ASCII a == 97. On the other hand, if you press both SHIFT and
1135 'A' keys simultaneously , the key code in key down event will still be
1136 just 'A' while the char event key code parameter will now be 'A' as
1139 Although in this simple case it is clear that the correct key code
1140 could be found in the key down event handler by checking the value
1141 returned by `ShiftDown`, in general you should use EVT_CHAR for this
1142 as for non alphanumeric keys or non-US keyboard layouts the
1143 translation is keyboard-layout dependent and can only be done properly
1144 by the system itself.
1146 Another kind of translation is done when the control key is pressed:
1147 for example, for CTRL-A key press the key down event still carries the
1148 same key code 'A' as usual but the char event will have key code of 1,
1149 the ASCII value of this key combination.
1151 You may discover how the other keys on your system behave
1152 interactively by running the KeyEvents sample in the wxPython demo and
1153 pressing some keys while the blue box at the top has the keyboard
1156 **Note**: If a key down event is caught and the event handler does not
1157 call event.Skip() then the coresponding char event will not
1158 happen. This is by design and enables the programs that handle both
1159 types of events to be a bit simpler.
1161 **Note for Windows programmers**: The key and char events in wxWidgets
1162 are similar to but slightly different from Windows WM_KEYDOWN and
1163 WM_CHAR events. In particular, Alt-x combination will generate a char
1164 event in wxWidgets (unless it is used as an accelerator).
1166 **Tip**: be sure to call event.Skip() for events that you don't
1167 process in key event function, otherwise menu shortcuts may cease to
1173 ================== ==============================================
1174 wx.EVT_KEY_DOWN Sent when a keyboard key has been pressed
1175 wx.EVT_KEY_UP Sent when a keyboard key has been released
1176 wx.EVT_CHAR Sent for translated character events.
1177 ================== ==============================================
1182 =========== ============== ======== ==================== =================
1183 WXK_BACK WXK_EXECUTE WXK_F1 WXK_NUMPAD_SPACE WXK_WINDOWS_LEFT
1184 WXK_TAB WXK_SNAPSHOT WXK_F2 WXK_NUMPAD_TAB WXK_WINDOWS_RIGHT
1185 WXK_RETURN WXK_INSERT WXK_F3 WXK_NUMPAD_ENTER WXK_WINDOWS_MENU
1186 WXK_ESCAPE WXK_HELP WXK_F4 WXK_NUMPAD_F1 WXK_SPECIAL1
1187 WXK_SPACE WXK_NUMPAD0 WXK_F5 WXK_NUMPAD_F2 WXK_SPECIAL2
1188 WXK_DELETE WXK_NUMPAD1 WXK_F6 WXK_NUMPAD_F3 WXK_SPECIAL3
1189 WXK_LBUTTON WXK_NUMPAD2 WXK_F7 WXK_NUMPAD_F4 WXK_SPECIAL4
1190 WXK_RBUTTON WXK_NUMPAD3 WXK_F8 WXK_NUMPAD_HOME WXK_SPECIAL5
1191 WXK_CANCEL WXK_NUMPAD4 WXK_F9 WXK_NUMPAD_LEFT WXK_SPECIAL6
1192 WXK_MBUTTON WXK_NUMPAD5 WXK_F10 WXK_NUMPAD_UP WXK_SPECIAL7
1193 WXK_CLEAR WXK_NUMPAD6 WXK_F11 WXK_NUMPAD_RIGHT WXK_SPECIAL8
1194 WXK_SHIFT WXK_NUMPAD7 WXK_F12 WXK_NUMPAD_DOWN WXK_SPECIAL9
1195 WXK_ALT WXK_NUMPAD8 WXK_F13 WXK_NUMPAD_PRIOR WXK_SPECIAL10
1196 WXK_CONTROL WXK_NUMPAD9 WXK_F14 WXK_NUMPAD_PAGEUP WXK_SPECIAL11
1197 WXK_MENU WXK_MULTIPLY WXK_F15 WXK_NUMPAD_NEXT WXK_SPECIAL12
1198 WXK_PAUSE WXK_ADD WXK_F16 WXK_NUMPAD_PAGEDOWN WXK_SPECIAL13
1199 WXK_CAPITAL WXK_SEPARATOR WXK_F17 WXK_NUMPAD_END WXK_SPECIAL14
1200 WXK_PRIOR WXK_SUBTRACT WXK_F18 WXK_NUMPAD_BEGIN WXK_SPECIAL15
1201 WXK_NEXT WXK_DECIMAL WXK_F19 WXK_NUMPAD_INSERT WXK_SPECIAL16
1202 WXK_END WXK_DIVIDE WXK_F20 WXK_NUMPAD_DELETE WXK_SPECIAL17
1203 WXK_HOME WXK_NUMLOCK WXK_F21 WXK_NUMPAD_EQUAL WXK_SPECIAL18
1204 WXK_LEFT WXK_SCROLL WXK_F22 WXK_NUMPAD_MULTIPLY WXK_SPECIAL19
1205 WXK_UP WXK_PAGEUP WXK_F23 WXK_NUMPAD_ADD WXK_SPECIAL20
1206 WXK_RIGHT WXK_PAGEDOWN WXK_F24 WXK_NUMPAD_SEPARATOR
1207 WXK_DOWN WXK_NUMPAD_SUBTRACT
1208 WXK_SELECT WXK_NUMPAD_DECIMAL
1209 WXK_PRINT WXK_NUMPAD_DIVIDE
1210 =========== ============== ======== ==================== =================
1213 class wxKeyEvent : public wxEvent
1217 wxKeyEvent(wxEventType eventType = wxEVT_NULL),
1218 "Construct a new `wx.KeyEvent`. Valid event types are:
1223 bool , ControlDown() const,
1224 "Returns ``True`` if the Control key was down at the time of the event.", "");
1227 bool , MetaDown() const,
1228 "Returns ``True`` if the Meta key was down at the time of the event.", "");
1231 bool , AltDown() const,
1232 "Returns ``True`` if the Alt key was down at the time of the event.", "");
1235 bool , ShiftDown() const,
1236 "Returns ``True`` if the Shift key was down at the time of the event.", "");
1240 bool , CmdDown() const,
1241 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
1242 platforms but the special \"Apple\" (a.k.a as \"Command\") key on
1243 Macs. It makes often sense to use it instead of, say, `ControlDown`
1244 because Cmd key is used for the same thing under Mac as Ctrl
1245 elsewhere. The Ctrl still exists, it's just not used for this
1246 purpose. So for non-Mac platforms this is the same as `ControlDown`
1247 and Macs this is the same as `MetaDown`.", "");
1252 bool , HasModifiers() const,
1253 "Returns true if either CTRL or ALT keys was down at the time of the
1254 key event. Note that this function does not take into account neither
1255 SHIFT nor META key states (the reason for ignoring the latter is that
1256 it is common for NUMLOCK key to be configured as META under X but the
1257 key presses even while NUMLOCK is on should be still processed
1262 int , GetKeyCode() const,
1263 "Returns the virtual key code. ASCII events return normal ASCII values,
1264 while non-ASCII events return values such as WXK_LEFT for the left
1265 cursor key. See `wx.KeyEvent` for a full list of the virtual key
1268 Note that in Unicode build, the returned value is meaningful only if
1269 the user entered a character that can be represented in current
1270 locale's default charset. You can obtain the corresponding Unicode
1271 character using `GetUnicodeKey`.", "");
1272 %pythoncode { KeyCode = GetKeyCode }
1278 "Returns the Unicode character corresponding to this key event. This
1279 function is only meaningfule in a Unicode build of wxPython.", "");
1280 int GetUnicodeKey() {
1282 return self->GetUnicodeKey();
1288 %pythoncode { GetUniChar = GetUnicodeKey }
1292 wxUint32 , GetRawKeyCode() const,
1293 "Returns the raw key code for this event. This is a platform-dependent
1294 scan code which should only be used in advanced
1295 applications. Currently the raw key codes are not supported by all
1300 wxUint32 , GetRawKeyFlags() const,
1301 "Returns the low level key flags for this event. The flags are
1302 platform-dependent and should only be used in advanced applications.
1303 Currently the raw key flags are not supported by all ports.", "");
1307 DocStr(GetPosition, // sets the docstring for both
1308 "Find the position of the event, if applicable.", "");
1309 wxPoint GetPosition();
1312 void, GetPosition(long *OUTPUT, long *OUTPUT),
1313 "GetPositionTuple() -> (x,y)",
1318 wxCoord , GetX() const,
1319 "Returns the X position (in client coordinates) of the event, if
1324 wxCoord , GetY() const,
1325 "Returns the Y position (in client coordinates) of the event, if
1341 wxUint32 m_rawFlags;
1344 //---------------------------------------------------------------------------
1350 "A size event holds information about size change events. The EVT_SIZE
1351 handler function will be called when the window it is bound to has
1354 Note that the size passed is of the whole window: call
1355 `wx.Window.GetClientSize` for the area which may be used by the
1358 When a window is resized, usually only a small part of the window is
1359 damaged and and that area is all that is in the update region for the
1360 next paint event. However, if your drawing depends on the size of the
1361 window, you may need to clear the DC explicitly and repaint the whole
1362 window. In which case, you may need to call `wx.Window.Refresh` to
1363 invalidate the entire window.
1366 class wxSizeEvent : public wxEvent
1370 wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0),
1371 "Construct a new ``wx.SizeEvent``.", "");
1374 wxSize , GetSize() const,
1375 "Returns the entire size of the window generating the size change
1378 wxRect GetRect() const;
1379 void SetRect(wxRect rect);
1382 void SetSize(wxSize size) {
1383 self->m_size = size;
1393 //---------------------------------------------------------------------------
1397 "This event object is sent for EVT_MOVE event bindings when a window is
1398 moved to a new position.", "");
1400 class wxMoveEvent : public wxEvent
1404 wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0),
1405 "Constructor.", "");
1408 wxPoint , GetPosition() const,
1409 "Returns the position of the window generating the move change event.", "");
1411 wxRect GetRect() const;
1412 void SetRect(const wxRect& rect);
1413 void SetPosition(const wxPoint& pos);
1416 m_pos = property(GetPosition, SetPosition)
1417 m_rect = property(GetRect, SetRect)
1421 //---------------------------------------------------------------------------
1424 DocStr(wxPaintEvent,
1425 "A paint event is sent when a window's contents needs to be repainted.
1426 Note that in an EVT_PAINT handler the application must *always* create
1427 a `wx.PaintDC` object, even if you do not use it. Otherwise MS
1428 Windows assumes that the window has not been painted yet and will send
1429 the event again, causing endless refreshes.
1431 You can optimize painting by retrieving the rectangles that have been
1432 damaged using `wx.Window.GetUpdateRegion` and/or `wx.RegionIterator`,
1433 and only repainting these rectangles. The rectangles are in terms of
1434 the client area, and are unscrolled, so you will need to do some
1435 calculations using the current view position to obtain logical,
1439 class wxPaintEvent : public wxEvent
1443 wxPaintEvent(int Id = 0),
1448 class wxNcPaintEvent : public wxEvent
1451 wxNcPaintEvent(int winid = 0);
1454 //---------------------------------------------------------------------------
1457 DocStr(wxEraseEvent,
1458 "An erase event is sent whenever the background of a window needs to be
1459 repainted. To intercept this event use the EVT_ERASE_BACKGROUND event
1460 binder. On some platforms, such as GTK+, this event is simulated
1461 (simply generated just before the paint event) and may cause flicker.
1463 To paint a custom background use the `GetDC` method and use the returned
1464 device context if it is not ``None``, otherwise create a temporary
1465 `wx.ClientDC` and draw on that.
1468 class wxEraseEvent : public wxEvent
1472 wxEraseEvent(int Id = 0, wxDC *dc = NULL),
1476 wxDC *, GetDC() const,
1477 "Returns the device context the event handler should draw upon. If
1478 ``None`` is returned then create a temporary `wx.ClientDC` and use
1479 that instead.", "");
1483 //---------------------------------------------------------------------------
1486 DocStr(wxFocusEvent,
1487 "A focus event is sent when a window's focus changes. The window losing
1488 focus receives an EVT_KILL_FOCUS event while the window gaining it
1489 gets an EVT_SET_FOCUS event.
1491 Notice that the set focus event happens both when the user gives focus
1492 to the window (whether using the mouse or keyboard) and when it is
1493 done from the program itself using `wx.Window.SetFocus`.
1496 class wxFocusEvent : public wxEvent
1500 wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0),
1504 wxWindow *, GetWindow() const,
1505 "Returns the other window associated with this event, that is the
1506 window which had the focus before for the EVT_SET_FOCUS event and the
1507 window which is going to receive focus for the wxEVT_KILL_FOCUS event.
1509 Warning: the window returned may be None!", "");
1511 void SetWindow(wxWindow *win);
1514 //---------------------------------------------------------------------------
1517 DocStr(wxChildFocusEvent,
1518 "wx.ChildFocusEvent notifies the parent that a child has received the
1519 focus. Unlike `wx.FocusEvent` it is propagated up the window
1523 class wxChildFocusEvent : public wxCommandEvent
1527 wxChildFocusEvent(wxWindow *win = NULL),
1531 wxWindow *, GetWindow() const,
1532 "The window which has just received the focus.", "");
1536 //---------------------------------------------------------------------------
1539 DocStr(wxActivateEvent,
1540 "An activate event is sent when a top-level window or the entire
1541 application is being activated or deactivated.
1543 A top-level window (a dialog or frame) receives an activate event when
1544 is being activated or deactivated. This is indicated visually by the
1545 title bar changing colour, and a subwindow gaining the keyboard focus.
1546 An application is activated or deactivated when one of its frames
1547 becomes activated, or a frame becomes inactivate resulting in all
1548 application frames being inactive.
1550 Please note that usually you should call event.Skip() in your handlers
1551 for these events so the default handlers will still be called, as not
1552 doing so can result in strange effects.
1557 ======================= ==========================================
1558 wx.EVT_ACTIVATE Sent to a frame when it has been activated
1560 wx.EVT_ACTIVATE_APP Sent to the app object when its activation
1562 ======================= ==========================================
1566 class wxActivateEvent : public wxEvent
1570 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0),
1574 bool , GetActive() const,
1575 "Returns true if the application or window is being activated, false
1581 //---------------------------------------------------------------------------
1584 DocStr(wxInitDialogEvent,
1585 "A wx.InitDialogEvent is sent as a dialog is being initialised, or for
1586 any window when `wx.Window.InitDialog` is called. Handlers for this
1587 event can transfer data to the window, or anything else that should be
1588 done before the user begins editing the form. The default handler
1589 calls `wx.Window.TransferDataToWindow`.", "
1593 ======================= ==========================================
1594 wx.EVT_INIT_DIALOG Binder for init dialog events.
1595 ======================= ==========================================
1598 class wxInitDialogEvent : public wxEvent
1602 wxInitDialogEvent(int Id = 0),
1607 //---------------------------------------------------------------------------
1611 "This class is used for a variety of menu-related events. Note that
1612 these do not include menu command events, which are handled by sending
1613 `wx.CommandEvent` objects.
1615 The default handler for wx.EVT_MENU_HIGHLIGHT displays menu item help
1616 text in the first field of the status bar.", "
1620 ========================= ==========================================
1621 wx.EVT_MENU_OPEN A menu is about to be opened. On Windows,
1622 this is only sent once for each navigation
1623 of the menubar (up until all menus have closed).
1624 wx.EVT_MENU_CLOSE A menu has been just closed.
1625 wx.EVT_MENU_HIGHLIGHT Sent when the menu item with the specified id
1626 has been highlighted: used by default to show
1627 help prompts in the `wx.Frame`'s status bar.
1628 wx.EVT_MENU_HIGHLIGHT_ALL Can be used to catch the menu highlight
1629 event for all menu items.
1630 ========================= ==========================================
1633 class wxMenuEvent : public wxEvent
1637 wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL),
1641 int , GetMenuId() const,
1642 "Returns the menu identifier associated with the event. This method
1643 should be only used with the HIGHLIGHT events.", "");
1647 bool , IsPopup() const,
1648 "Returns ``True`` if the menu which is being opened or closed is a
1649 popup menu, ``False`` if it is a normal one. This method should only
1650 be used with the OPEN and CLOSE events.", "");
1654 wxMenu* , GetMenu() const,
1655 "Returns the menu which is being opened or closed. This method should
1656 only be used with the OPEN and CLOSE events.", "");
1660 //---------------------------------------------------------------------------
1663 DocStr(wxCloseEvent,
1664 "This event class contains information about window and session close
1667 The handler function for EVT_CLOSE is called when the user has tried
1668 to close a a frame or dialog box using the window manager controls or
1669 the system menu. It can also be invoked by the application itself
1670 programmatically, for example by calling the `wx.Window.Close`
1673 You should check whether the application is forcing the deletion of
1674 the window using `CanVeto`. If it returns ``False``, you must destroy
1675 the window using `wx.Window.Destroy`. If the return value is ``True``,
1676 it is up to you whether you respond by destroying the window or not.
1677 For example you may wish to display a message dialog prompting to save
1678 files or to cancel the close.
1680 If you don't destroy the window, you should call `Veto` to let the
1681 calling code know that you did not destroy the window. This allows the
1682 `wx.Window.Close` function to return ``True`` or ``False`` depending
1683 on whether the close instruction was honored or not.", "
1687 ========================= ==========================================
1688 wx.EVT_CLOSE This event is sent to a top-level window
1689 when it has been requested to close either
1690 from the user or programatically.
1691 wx.EVT_QUERY_END_SESSION This event is sent to the `wx.App` when the
1692 system is about to be logged off, giving the
1693 app a chance to veto the shutdown.
1694 wx.EVT_END_SESSION This event is sent to the `wx.App` when the
1695 system is being logged off.
1696 ========================= ==========================================
1699 class wxCloseEvent : public wxEvent
1703 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0),
1704 "Constructor.", "");
1707 void , SetLoggingOff(bool logOff),
1708 "Sets the 'logging off' flag.", "");
1711 bool , GetLoggingOff() const,
1712 "Returns ``True`` if the user is logging off or ``False`` if the
1713 system is shutting down. This method can only be called for end
1714 session and query end session events, it doesn't make sense for close
1715 window event.", "");
1719 void , Veto(bool veto = true),
1720 "Call this from your event handler to veto a system shutdown or to
1721 signal to the calling application that a window close did not happen.
1723 You can only veto a shutdown or close if `CanVeto` returns true.", "");
1725 bool GetVeto() const;
1728 void , SetCanVeto(bool canVeto),
1729 "Sets the 'can veto' flag.", "");
1732 bool , CanVeto() const,
1733 "Returns true if you can veto a system shutdown or a window close
1734 event. Vetoing a window close event is not possible if the calling
1735 code wishes to force the application to exit, and so this function
1736 must be called to check this.", "");
1741 //---------------------------------------------------------------------------
1745 "An EVT_SHOW event is sent when a window is shown or hidden.", "");
1747 class wxShowEvent : public wxEvent
1750 wxShowEvent(int winid = 0, bool show = false);
1752 void SetShow(bool show);
1753 bool GetShow() const;
1758 //---------------------------------------------------------------------------
1761 DocStr(wxIconizeEvent,
1762 "An EVT_ICONIZE event is sent when a frame is iconized (minimized) or
1765 class wxIconizeEvent: public wxEvent
1768 wxIconizeEvent(int id = 0, bool iconized = true);
1772 "Returns ``True`` if the frame has been iconized, ``False`` if it has
1773 been restored.", "");
1778 //---------------------------------------------------------------------------
1781 DocStr(wxMaximizeEvent,
1782 "An EVT_MAXIMIZE event is sent when a frame is maximized or restored.", "");
1784 class wxMaximizeEvent: public wxEvent
1787 wxMaximizeEvent(int id = 0);
1790 //---------------------------------------------------------------------------
1793 DocStr(wxDropFilesEvent,
1794 "This class is used for drop files events, that is, when files have
1795 been dropped onto the window. This functionality is only available
1796 under Windows. The window must have previously been enabled for
1797 dropping by calling `wx.Window.DragAcceptFiles`.
1799 Important note: this is a separate implementation to the more general
1800 drag and drop implementation using `wx.FileDropTarget`, and etc. This
1801 implementation uses the older, Windows message-based approach of
1804 Use wx.EVT_DROP_FILES to bind an event handler to receive file drop
1808 class wxDropFilesEvent: public wxEvent
1812 // TODO: wrap the ctor!
1816 wxPoint , GetPosition(),
1817 "Returns the position at which the files were dropped.", "");
1820 int , GetNumberOfFiles(),
1821 "Returns the number of files dropped.", "");
1827 "Returns a list of the filenames that were dropped.", "");
1829 PyObject* GetFiles() {
1830 int count = self->GetNumberOfFiles();
1831 wxString* files = self->GetFiles();
1832 wxPyBlock_t blocked = wxPyBeginBlockThreads();
1833 PyObject* list = PyList_New(count);
1836 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
1837 wxPyEndBlockThreads(blocked);
1841 for (int i=0; i<count; i++) {
1842 PyList_SetItem(list, i, wx2PyString(files[i]));
1844 wxPyEndBlockThreads(blocked);
1852 //---------------------------------------------------------------------------
1858 wxUPDATE_UI_PROCESS_ALL,
1859 wxUPDATE_UI_PROCESS_SPECIFIED
1863 DocStr(wxUpdateUIEvent,
1864 "This class is used for EVT_UPDATE_UI pseudo-events which are sent by
1865 wxWidgets to give an application the chance to update various user
1868 Without update UI events, an application has to work hard to
1869 check/uncheck, enable/disable, and set the text for elements such as
1870 menu items and toolbar buttons. The code for doing this has to be
1871 mixed up with the code that is invoked when an action is invoked for a
1872 menu item or button.
1874 With update UI events, you define an event handler to look at the
1875 state of the application and change UI elements accordingly. wxWidgets
1876 will call your handler functions in idle time, so you don't have to
1877 worry where to call this code. In addition to being a clearer and more
1878 declarative method, it also means you don't have to worry whether
1879 you're updating a toolbar or menubar identifier. The same handler can
1880 update a menu item and toolbar button, if the ID values are the same.
1882 Instead of directly manipulating the menu or button, you call
1883 functions in the event object, such as `Check`. wxWidgets will
1884 determine whether such a call has been made, and which UI element to
1887 These events will work for popup menus as well as menubars. Just
1888 before a menu is popped up, `wx.Menu.UpdateUI` is called to process
1889 any UI events for the window that owns the menu.
1891 If you find that the overhead of UI update processing is affecting
1892 your application, you can do one or both of the following:
1894 1. Call `wx.UpdateUIEvent.SetMode` with a value of
1895 wx.UPDATE_UI_PROCESS_SPECIFIED, and set the extra style
1896 wx.WS_EX_PROCESS_UPDATE_EVENTS for every window that should
1897 receive update events. No other windows will receive update
1900 2. Call `wx.UpdateUIEvent.SetUpdateInterval` with a millisecond
1901 value to set the delay between updates. You may need to call
1902 `wx.Window.UpdateWindowUI` at critical points, for example when
1903 a dialog is about to be shown, in case the user sees a slight
1904 delay before windows are updated.
1906 Note that although events are sent in idle time, defining a EVT_IDLE
1907 handler for a window does not affect this because the events are sent
1908 from an internal idle handler.
1910 wxWidgets tries to optimize update events on some platforms. On
1911 Windows and GTK+, events for menubar items are only sent when the menu
1912 is about to be shown, and not in idle time.
1915 class wxUpdateUIEvent : public wxCommandEvent
1919 wxUpdateUIEvent(wxWindowID commandId = 0),
1923 bool , GetChecked() const,
1924 "Returns ``True`` if the UI element should be checked.", "");
1927 bool , GetEnabled() const,
1928 "Returns ``True`` if the UI element should be enabled.", "");
1931 wxString , GetText() const,
1932 "Returns the text that should be set for the UI element.", "");
1935 bool , GetSetText() const,
1936 "Returns ``True`` if the application has called `SetText`. For
1937 wxWidgets internal use only.", "");
1940 bool , GetSetChecked() const,
1941 "Returns ``True`` if the application has called `Check`. For wxWidgets
1942 internal use only.", "");
1945 bool , GetSetEnabled() const,
1946 "Returns ``True`` if the application has called `Enable`. For wxWidgets
1947 internal use only.", "");
1952 void , Check(bool check),
1953 "Check or uncheck the UI element.", "");
1956 void , Enable(bool enable),
1957 "Enable or disable the UI element.", "");
1960 void , SetText(const wxString& text),
1961 "Sets the text for this UI element.", "");
1966 static void , SetUpdateInterval(long updateInterval),
1967 "Sets the interval between updates in milliseconds. Set to -1 to
1968 disable updates, or to 0 to update as frequently as possible. The
1971 Use this to reduce the overhead of UI update events if your
1972 application has a lot of windows. If you set the value to -1 or
1973 greater than 0, you may also need to call `wx.Window.UpdateWindowUI`
1974 at appropriate points in your application, such as when a dialog is
1975 about to be shown.", "");
1979 static long , GetUpdateInterval(),
1980 "Returns the current interval between updates in milliseconds. -1
1981 disables updates, 0 updates as frequently as possible.", "");
1985 static bool , CanUpdate(wxWindow *win),
1986 "Returns ``True`` if it is appropriate to update (send UI update events
1989 This function looks at the mode used (see `wx.UpdateUIEvent.SetMode`),
1990 the wx.WS_EX_PROCESS_UPDATE_EVENTS flag in window, the time update
1991 events were last sent in idle time, and the update interval, to
1992 determine whether events should be sent to this window now. By default
1993 this will always return true because the update mode is initially
1994 wx.UPDATE_UI_PROCESS_ALL and the interval is set to 0; so update
1995 events will be sent as often as possible. You can reduce the frequency
1996 that events are sent by changing the mode and/or setting an update
2002 static void , ResetUpdateTime(),
2003 "Used internally to reset the last-updated time to the current time. It
2004 is assumed that update events are normally sent in idle time, so this
2005 is called at the end of idle processing.", "");
2009 static void , SetMode(wxUpdateUIMode mode),
2010 "Specify how wxWidgets will send update events: to all windows, or only
2011 to those which specify that they will process the events.
2013 The mode may be one of the following values:
2015 ============================= ==========================================
2016 wxUPDATE_UI_PROCESS_ALL Send UI update events to all windows. This
2017 is the default setting.
2018 wxUPDATE_UI_PROCESS_SPECIFIED Send UI update events only to windows that
2019 have the wx.WS_EX_PROCESS_UI_UPDATES extra
2021 ============================= ==========================================
2026 static wxUpdateUIMode , GetMode(),
2027 "Returns a value specifying how wxWidgets will send update events: to
2028 all windows, or only to those which specify that they will process the
2033 //---------------------------------------------------------------------------
2036 DocStr(wxSysColourChangedEvent,
2037 "This class is used for EVT_SYS_COLOUR_CHANGED, which are generated
2038 when the user changes the colour settings using the control
2039 panel. This is only applicable under Windows.
2041 The default event handler for this event propagates the event to child
2042 windows, since Windows only sends the events to top-level windows. If
2043 intercepting this event for a top-level window, remember to call
2044 `Skip` so the the base class handler will still be executed, or to
2045 pass the event on to the window's children explicitly.
2048 class wxSysColourChangedEvent: public wxEvent {
2051 wxSysColourChangedEvent(),
2055 //---------------------------------------------------------------------------
2059 DocStr(wxMouseCaptureChangedEvent,
2060 "An mouse capture changed event (EVT_MOUSE_CAPTURE_CHANGED) is sent to
2061 a window that loses its mouse capture. This is called even if
2062 `wx.Window.ReleaseMouse` was called by the application code. Handling
2063 this event allows an application to cater for unexpected capture
2064 releases which might otherwise confuse mouse handling code.
2066 This event is implemented under Windows only.", "");
2068 class wxMouseCaptureChangedEvent : public wxEvent
2072 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL),
2076 wxWindow* , GetCapturedWindow() const,
2077 "Returns the window that gained the capture, or ``None`` if it was a
2078 non-wxWidgets window.", "");
2082 //---------------------------------------------------------------------------
2085 DocStr(wxDisplayChangedEvent,
2086 "An EVT_DISPLAY_CHANGED event is sent to all windows when the display
2087 resolution has changed.
2089 This event is implemented under Windows only.", "");
2091 class wxDisplayChangedEvent : public wxEvent
2095 wxDisplayChangedEvent(),
2099 //---------------------------------------------------------------------------
2102 DocStr(wxPaletteChangedEvent,
2103 "An EVT_PALETTE_CHANGED event is sent when the system palette has
2104 changed, thereby giving each window a chance to redo their own to
2107 This event is implemented under Windows only.", "");
2109 class wxPaletteChangedEvent : public wxEvent
2112 wxPaletteChangedEvent(wxWindowID id = 0);
2114 void SetChangedWindow(wxWindow* win);
2115 wxWindow* GetChangedWindow();
2119 //---------------------------------------------------------------------------
2122 DocStr(wxQueryNewPaletteEvent,
2123 "An EVT_QUERY_NEW_PALETE event indicates the window is getting keyboard
2124 focus and should re-do its palette.
2126 This event is implemented under Windows only.", "");
2128 class wxQueryNewPaletteEvent : public wxEvent
2132 wxQueryNewPaletteEvent(wxWindowID winid = 0),
2133 "Constructor.", "");
2136 void , SetPaletteRealized(bool realized),
2137 "App should set this if it changes the palette.", "");
2139 bool GetPaletteRealized() const;
2142 //---------------------------------------------------------------------------
2147 DocStr(wxNavigationKeyEvent,
2148 "EVT_NAVIGATION_KEY events are used to control moving the focus between
2149 widgets, otherwise known as tab-traversal. You woudl normally not
2150 catch navigation events in applications as there are already
2151 appropriate handlers in `wx.Dialog` and `wx.Panel`, but you may find
2152 it useful to send navigation events in certain situations to change
2153 the focus in certain ways, although it's probably easier to just call
2154 `wx.Window.Navigate`.", "");
2156 class wxNavigationKeyEvent : public wxEvent
2160 wxNavigationKeyEvent(),
2164 bool , GetDirection() const,
2165 "Returns ``True`` if the direction is forward, ``False`` otherwise.", "");
2168 void , SetDirection(bool forward),
2169 "Specify the direction that the navigation should take. Usually the
2170 difference between using Tab and Shift-Tab.", "");
2174 bool , IsWindowChange() const,
2175 "Returns ``True`` if window change is allowed.", "");
2178 void , SetWindowChange(bool ischange),
2179 "Specify if the navigation should be able to change parent windows.
2180 For example, changing notebook pages, etc. This is usually implemented
2181 by using Control-Tab.", "");
2185 bool , IsFromTab() const,
2186 "Returns ``True`` if the navigation event is originated from the Tab
2190 void , SetFromTab(bool bIs),
2191 "Set to true under MSW if the event was generated using the tab key.
2192 This is required for proper navogation over radio buttons.", "");
2196 void , SetFlags(long flags),
2197 "Set the navigation flags to a combination of the following:
2199 * wx.NavigationKeyEvent.IsBackward
2200 * wx.NavigationKeyEvent.IsForward
2201 * wx.NavigationKeyEvent.WinChange
2202 * wx.NavigationKeyEvent.FromTab
2207 wxWindow* , GetCurrentFocus() const,
2208 "Returns the child window which currenty has the focus. May be
2212 void , SetCurrentFocus(wxWindow *win),
2213 "Set the window that has the focus.", "");
2224 //---------------------------------------------------------------------------
2228 DocStr(wxWindowCreateEvent,
2229 "The EVT_WINDOW_CREATE event is sent as soon as the window object (the
2230 underlying GUI object) exists.", "");
2232 class wxWindowCreateEvent : public wxCommandEvent
2235 wxWindowCreateEvent(wxWindow *win = NULL);
2238 wxWindow *, GetWindow() const,
2239 "Returns the window that this event refers to.", "");
2244 DocStr(wxWindowDestroyEvent,
2245 "The EVT_WINDOW_DESTROY event is sent from the `wx.Window` destructor
2246 when the GUI window is destroyed.
2248 When a class derived from `wx.Window` is destroyed its destructor will
2249 have already run by the time this event is sent. Therefore this event
2250 will not usually be received at all by the window itself. Since it is
2251 received after the destructor has run, an object should not try to
2252 handle its own wx.WindowDestroyEvent, but it can be used to get
2253 notification of the destruction of another window.", "");
2254 class wxWindowDestroyEvent : public wxCommandEvent
2257 wxWindowDestroyEvent(wxWindow *win = NULL);
2260 wxWindow *, GetWindow() const,
2261 "Returns the window that this event refers to.", "");
2265 //---------------------------------------------------------------------------
2269 DocStr(wxContextMenuEvent,
2270 "This class is used for context menu events (EVT_CONTECT_MENU,) sent to
2271 give the application a chance to show a context (popup) menu.", "");
2273 class wxContextMenuEvent : public wxCommandEvent
2277 wxContextMenuEvent(wxEventType type = wxEVT_NULL,
2278 wxWindowID winid = 0,
2279 const wxPoint& pt = wxDefaultPosition),
2280 "Constructor.", "");
2282 // Position of event (in screen coordinates)
2284 const wxPoint& , GetPosition() const,
2285 "Returns the position (in screen coordinants) at which the menu should
2290 void , SetPosition(const wxPoint& pos),
2291 "Sets the position at which the menu should be shown.", "");
2295 //---------------------------------------------------------------------------
2301 wxIDLE_PROCESS_SPECIFIED
2306 "This class is used for EVT_IDLE events, which are generated and sent
2307 when the application *becomes* idle. In other words, the when the
2308 event queue becomes empty then idle events are sent to all windows (by
2309 default) and as long as none of them call `RequestMore` then there are
2310 no more idle events until after the system event queue has some normal
2311 events and then becomes empty again.
2313 By default, idle events are sent to all windows. If this is causing a
2314 significant overhead in your application, you can call
2315 `wx.IdleEvent.SetMode` with the value wx.IDLE_PROCESS_SPECIFIED, and
2316 set the wx.WS_EX_PROCESS_IDLE extra window style for every window
2317 which should receive idle events. Then idle events will only be sent
2318 to those windows and not to any others.", "");
2320 class wxIdleEvent : public wxEvent
2329 void , RequestMore(bool needMore = true),
2330 "Tells wxWidgets that more processing is required. This function can be
2331 called by an EVT_IDLE handler for a window to indicate that the
2332 application should forward the EVT_IDLE event once more to the
2333 application windows. If no window calls this function during its
2334 EVT_IDLE handler, then the application will remain in a passive event
2335 loop until a new event is posted to the application by the windowing
2339 bool , MoreRequested() const,
2340 "Returns ``True`` if the OnIdle function processing this event
2341 requested more processing time.", "");
2345 static void , SetMode(wxIdleMode mode),
2346 "Static method for specifying how wxWidgets will send idle events: to
2347 all windows, or only to those which specify that they will process the
2350 The mode can be one of the following values:
2352 ========================= ========================================
2353 wx.IDLE_PROCESS_ALL Send idle events to all windows
2354 wx.IDLE_PROCESS_SPECIFIED Send idle events only to windows that have
2355 the wx.WS_EX_PROCESS_IDLE extra style
2357 ========================= ========================================
2362 static wxIdleMode , GetMode(),
2363 "Static method returning a value specifying how wxWidgets will send
2364 idle events: to all windows, or only to those which specify that they
2365 will process the events.", "");
2369 static bool , CanSend(wxWindow* win),
2370 "Returns ``True`` if it is appropriate to send idle events to this
2373 This function looks at the mode used (see `wx.IdleEvent.SetMode`), and
2374 the wx.WS_EX_PROCESS_IDLE style in window to determine whether idle
2375 events should be sent to this window now. By default this will always
2376 return ``True`` because the update mode is initially
2377 wx.IDLE_PROCESS_ALL. You can change the mode to only send idle events
2378 to windows with the wx.WS_EX_PROCESS_IDLE extra window style set.", "");
2382 //---------------------------------------------------------------------------
2385 // These classes can be derived from in Python and passed through the event
2386 // system without loosing anything. They do this by keeping a reference to
2387 // themselves and some special case handling in wxPyCallback::EventThunker.
2390 "wx.PyEvent can be used as a base class for implementing custom event
2391 types in Python. You should derived from this class instead of
2392 `wx.Event` because this class is Python-aware and is able to transport
2393 its Python bits safely through the wxWidgets event system and have
2394 them still be there when the event handler is invoked.
2396 :see: `wx.PyCommandEvent`
2399 class wxPyEvent : public wxEvent {
2401 %pythonAppend wxPyEvent "self._SetSelf(self)"
2403 wxPyEvent(int winid=0, wxEventType eventType = wxEVT_NULL ),
2409 %Rename(_SetSelf, void , SetSelf(PyObject* self));
2410 %Rename(_GetSelf, PyObject* , GetSelf());
2415 DocStr(wxPyCommandEvent,
2416 "wx.PyCommandEvent can be used as a base class for implementing custom
2417 event types in Python, where the event shoudl travel up to parent
2418 windows looking for a handler. You should derived from this class
2419 instead of `wx.CommandEvent` because this class is Python-aware and is
2420 able to transport its Python bits safely through the wxWidgets event
2421 system and have them still be there when the event handler is invoked.
2426 class wxPyCommandEvent : public wxCommandEvent {
2428 %pythonAppend wxPyCommandEvent "self._SetSelf(self)"
2431 wxPyCommandEvent(wxEventType eventType = wxEVT_NULL, int id=0),
2434 ~wxPyCommandEvent();
2436 %Rename(_SetSelf, void , SetSelf(PyObject* self));
2437 %Rename(_GetSelf, PyObject* , GetSelf());
2442 //---------------------------------------------------------------------------
2446 "This event class holds information about a date change event and is
2447 used together with `wx.DatePickerCtrl`. It also serves as a base class
2448 for `wx.calendar.CalendarEvent`. Bind these event types with
2449 EVT_DATE_CHANGED.", "");
2451 class wxDateEvent : public wxCommandEvent
2455 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type),
2459 const wxDateTime& , GetDate() const,
2460 "Returns the date.", "");
2463 void , SetDate(const wxDateTime &date),
2464 "Sets the date carried by the event, normally only used by the library
2471 %constant wxEventType wxEVT_DATE_CHANGED;
2474 EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
2478 //---------------------------------------------------------------------------