]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_event.i
use wx.CallAfter to set the insertion point
[wxWidgets.git] / wxPython / src / _event.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _event.i
3// Purpose: SWIG interface for common event classes and event binders
4//
5// Author: Robin Dunn
6//
7// Created: 24-May-1998
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17// Include some extra python code here
18%pythoncode "_event_ex.py"
19
20//---------------------------------------------------------------------------
21%newgroup;
22
23// the predefined constants for the number of times we propagate event
24// upwards window child-parent chain
25enum Propagation_state
26{
27 // don't propagate it at all
28 wxEVENT_PROPAGATE_NONE = 0,
29
30 // propagate it until it is processed
31 wxEVENT_PROPAGATE_MAX = INT_MAX
32};
33
34
35//---------------------------------------------------------------------------
36// Event types
37
38wxEventType wxNewEventType();
39
40
41%constant wxEventType wxEVT_NULL;
42%constant wxEventType wxEVT_FIRST;
43%constant wxEventType wxEVT_USER_FIRST;
44
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;
51
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;
57
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;
63
64// Mouse event types
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;
81
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;
95
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;
103
104// Set cursor event
105%constant wxEventType wxEVT_SET_CURSOR;
106
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;
117
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;
127
128// System events
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;
150
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;
2d672d17
RD
166%constant wxEventType wxEVT_HIBERNATE;
167
d14a1e28
RD
168
169// Generic command events
170// Note: a click is a higher-level event than button down/up
171%constant wxEventType wxEVT_COMMAND_LEFT_CLICK;
172%constant wxEventType wxEVT_COMMAND_LEFT_DCLICK;
173%constant wxEventType wxEVT_COMMAND_RIGHT_CLICK;
174%constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
175%constant wxEventType wxEVT_COMMAND_SET_FOCUS;
176%constant wxEventType wxEVT_COMMAND_KILL_FOCUS;
177%constant wxEventType wxEVT_COMMAND_ENTER;
178
179
180
181%pythoncode {
182%#
183%# Create some event binders
184EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
185EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
186EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
187EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
188EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
189EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
190EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
191EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
192EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
193EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
194EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
195EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
196EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
197EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
198EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
199EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
200EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
201EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
202EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
203EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
204EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
205EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
206EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
207EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
2d672d17 208EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE )
d14a1e28
RD
209EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
210EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
211EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
212EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
213EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
214EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
215EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
216EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
217EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
218EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
219EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
220EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
221EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
222EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
223EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
224EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
225
226EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
227EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
228EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
229EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
230EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
231EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
232EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
233EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
234EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
235EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
236EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
237EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
238EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
239
240EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN,
241 wxEVT_LEFT_UP,
242 wxEVT_MIDDLE_DOWN,
243 wxEVT_MIDDLE_UP,
244 wxEVT_RIGHT_DOWN,
245 wxEVT_RIGHT_UP,
246 wxEVT_MOTION,
247 wxEVT_LEFT_DCLICK,
248 wxEVT_MIDDLE_DCLICK,
249 wxEVT_RIGHT_DCLICK,
250 wxEVT_ENTER_WINDOW,
251 wxEVT_LEAVE_WINDOW,
252 wxEVT_MOUSEWHEEL
253 ])
254
255
256%# Scrolling from wxWindow (sent to wxScrolledWindow)
257EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP,
258 wxEVT_SCROLLWIN_BOTTOM,
259 wxEVT_SCROLLWIN_LINEUP,
260 wxEVT_SCROLLWIN_LINEDOWN,
261 wxEVT_SCROLLWIN_PAGEUP,
262 wxEVT_SCROLLWIN_PAGEDOWN,
263 wxEVT_SCROLLWIN_THUMBTRACK,
264 wxEVT_SCROLLWIN_THUMBRELEASE,
265 ])
266
267EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
268EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
269EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
270EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
271EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
272EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
273EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
274EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
275
d5a7caf6 276%# Scrolling from wx.Slider and wx.ScrollBar
d14a1e28
RD
277EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
278 wxEVT_SCROLL_BOTTOM,
279 wxEVT_SCROLL_LINEUP,
280 wxEVT_SCROLL_LINEDOWN,
281 wxEVT_SCROLL_PAGEUP,
282 wxEVT_SCROLL_PAGEDOWN,
283 wxEVT_SCROLL_THUMBTRACK,
284 wxEVT_SCROLL_THUMBRELEASE,
285 wxEVT_SCROLL_ENDSCROLL,
286 ])
287
288EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
289EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
290EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
291EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
292EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
293EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
294EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
295EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
296EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL )
297
d5a7caf6 298%# Scrolling from wx.Slider and wx.ScrollBar, with an id
d14a1e28
RD
299EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
300 wxEVT_SCROLL_BOTTOM,
301 wxEVT_SCROLL_LINEUP,
302 wxEVT_SCROLL_LINEDOWN,
303 wxEVT_SCROLL_PAGEUP,
304 wxEVT_SCROLL_PAGEDOWN,
305 wxEVT_SCROLL_THUMBTRACK,
306 wxEVT_SCROLL_THUMBRELEASE,
307 wxEVT_SCROLL_ENDSCROLL,
308 ], 1)
309
310EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
311EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
312EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
313EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
314EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
315EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
316EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
317EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
318EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1)
319
d14a1e28
RD
320EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1)
321EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1)
322EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1)
323EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1)
324EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1)
325EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1)
326EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2)
327EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1)
328EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1)
329EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1)
330
331EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1)
332EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1)
333EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1)
334EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1)
335EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2)
336EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1)
337EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2)
338EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1)
339EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1)
340
341
342EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
343EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
344EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
345EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
346EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
347EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
348EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
349
350EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
351
352EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
353EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
354
355EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
356
357
358}
359
360//---------------------------------------------------------------------------
361%newgroup;
362
d5a7caf6
RD
363DocStr(wxEvent,
364"An event is a structure holding information about an event passed to a
365callback or member function. wx.Event is an abstract base class for
366other event classes", "");
367
d14a1e28
RD
368class wxEvent : public wxObject {
369public:
370 // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC
371 ~wxEvent();
372
d5a7caf6
RD
373 DocDeclStr(
374 void , SetEventType(wxEventType typ),
375 "Sets the specific type of the event.", "");
376
377 DocDeclStr(
378 wxEventType , GetEventType() const,
379 "Returns the identifier of the given event type, such as
380``wxEVT_COMMAND_BUTTON_CLICKED``.", "");
381
382 DocDeclStr(
383 wxObject *, GetEventObject() const,
384 "Returns the object (usually a window) associated with the event, if
385any.", "");
386
387 DocDeclStr(
388 void , SetEventObject(wxObject *obj),
389 "Sets the originating object, or in other words, obj is normally the
390object that is sending the event.", "");
391
d14a1e28
RD
392 long GetTimestamp() const;
393 void SetTimestamp(long ts = 0);
d5a7caf6
RD
394
395 DocDeclStr(
396 int , GetId() const,
397 "Returns the identifier associated with this event, such as a button
398command id.", "");
399
400 DocDeclStr(
401 void , SetId(int Id),
402 "Set's the ID for the event. This is usually the ID of the window that
403is sending the event, but it can also be a command id from a menu
404item, etc.", "");
405
d14a1e28
RD
406
407
d5a7caf6
RD
408 DocDeclStr(
409 bool , IsCommandEvent() const,
410 "Returns true if the event is or is derived from `wx.CommandEvent` else
411it returns false. Note: Exists only for optimization purposes.", "");
412
d14a1e28 413
31066066
RD
414 DocDeclStr(
415 void , Skip(bool skip = true),
416 "Called by an event handler, it controls whether additional event
417handlers bound to this event will be called after the current event
418handler returns. Skip(false) (the default setting) will prevent
419additional event handlers from being called and control will be
420returned to the sender of the event immediately after the current
421handler has finished. Skip(True) will cause the event processing
422system to continue searching for a handler function for this event.
423", "");
424
d5a7caf6
RD
425 DocDeclStr(
426 bool , GetSkipped() const,
427 "Returns true if the event handler should be skipped, false otherwise.
428:see: `Skip`", "");
429
d14a1e28 430
d5a7caf6
RD
431 DocDeclStr(
432 bool , ShouldPropagate() const,
433 "Test if this event should be propagated to the parent window or not,
434i.e. if the propagation level is currently greater than 0.", "");
435
d14a1e28
RD
436
437 // Stop an event from propagating to its parent window, returns the old
438 // propagation level value
d5a7caf6
RD
439 DocDeclStr(
440 int , StopPropagation(),
441 "Stop the event from propagating to its parent window. Returns the old
442propagation level value which may be later passed to
443`ResumePropagation` to allow propagating the event again.", "");
444
d14a1e28 445
d5a7caf6
RD
446 DocDeclStr(
447 void , ResumePropagation(int propagationLevel),
448 "Resume the event propagation by restoring the propagation level. (For
449example, you can use the value returned by an earlier call to
450`StopPropagation`.)
451", "");
452
d14a1e28
RD
453
454 // this function is used to create a copy of the event polymorphically and
455 // all derived classes must implement it because otherwise wxPostEvent()
456 // for them wouldn't work (it needs to do a copy of the event)
457 virtual wxEvent *Clone() /* =0*/;
458};
459
460
461//---------------------------------------------------------------------------
462%newgroup;
463
d5a7caf6
RD
464DocStr(wxPropagationDisabler,
465"Helper class to temporarily change an event not to propagate. Simply
466create an instance of this class and then whe it is destroyed the
467propogation of the event will be restored.", "");
d14a1e28
RD
468class wxPropagationDisabler
469{
470public:
471 wxPropagationDisabler(wxEvent& event);
472 ~wxPropagationDisabler();
473};
474
475
d5a7caf6
RD
476DocStr( wxPropagateOnce,
477"A helper class that will temporarily lower propagation level of an
478event. Simply create an instance of this class and then whe it is
479destroyed the propogation of the event will be restored.", "");
d14a1e28
RD
480class wxPropagateOnce
481{
482public:
483 wxPropagateOnce(wxEvent& event);
484 ~wxPropagateOnce();
485};
486
487//---------------------------------------------------------------------------
488%newgroup;
489
d5a7caf6
RD
490DocStr(wxCommandEvent,
491"This event class contains information about command events, which
492originate from a variety of simple controls, as well as menus and
493toolbars.", "");
494
d14a1e28
RD
495class wxCommandEvent : public wxEvent
496{
497public:
498 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
499
500
501// // Set/Get client data from controls
502// void SetClientData(void* clientData) { m_clientData = clientData; }
503// void *GetClientData() const { return m_clientData; }
504
505// // Set/Get client object from controls
506// void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
507// void *GetClientObject() const { return m_clientObject; }
508
509
d5a7caf6
RD
510 DocDeclStr(
511 int , GetSelection() const,
512 "Returns item index for a listbox or choice selection event (not valid
513for a deselection).", "");
514
d14a1e28 515
d14a1e28 516 void SetString(const wxString& s);
d5a7caf6
RD
517 DocDeclStr(
518 wxString , GetString() const,
519 "Returns item string for a listbox or choice selection event (not valid
520for a deselection).", "");
521
d14a1e28 522
d5a7caf6
RD
523 DocDeclStr(
524 bool , IsChecked() const,
525 "This method can be used with checkbox and menu events: for the
526checkboxes, the method returns true for a selection event and false
527for a deselection one. For the menu events, this method indicates if
528the menu item just has become checked or unchecked (and thus only
529makes sense for checkable menu items).", "");
530
61c5a8ac
RD
531 %pythoncode { Checked = IsChecked }
532
d5a7caf6
RD
533 DocDeclStr(
534 bool , IsSelection() const,
535 "For a listbox or similar event, returns true if it is a selection,
536false if it is a deselection.", "");
537
d14a1e28
RD
538
539 void SetExtraLong(long extraLong);
d5a7caf6
RD
540 DocDeclStr(
541 long , GetExtraLong() const,
e47ce385
RD
542 "Returns extra information dependant on the event objects type. If the
543event comes from a listbox selection, it is a boolean determining
544whether the event was a selection (true) or a deselection (false). A
545listbox deselection only occurs for multiple-selection boxes, and in
546this case the index and string values are indeterminate and the
547listbox must be examined by the application.", "");
d5a7caf6 548
d14a1e28
RD
549
550 void SetInt(int i);
d5a7caf6
RD
551 DocDeclStr(
552 long , GetInt() const,
e47ce385
RD
553 "Returns the integer identifier corresponding to a listbox, choice or
554radiobox selection (only if the event was a selection, not a
555deselection), or a boolean value representing the value of a checkbox.", "");
d5a7caf6 556
d14a1e28
RD
557
558 virtual wxEvent *Clone() const;
559
560};
561
562//---------------------------------------------------------------------------
563%newgroup;
564
d5a7caf6
RD
565DocStr(wxNotifyEvent,
566"An instance of this class (or one of its derived classes) is sent from
567a control when the control's state is being changed and the control
568allows that change to be prevented from happening. The event handler
569can call `Veto` or `Allow` to tell the control what to do.", "");
570
d14a1e28
RD
571class wxNotifyEvent : public wxCommandEvent
572{
573public:
574 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
575
d5a7caf6
RD
576 DocDeclStr(
577 void , Veto(),
578 "Prevents the change announced by this event from happening.
d14a1e28 579
d5a7caf6
RD
580It is in general a good idea to notify the user about the reasons for
581vetoing the change because otherwise the applications behaviour (which
582just refuses to do what the user wants) might be quite surprising.", "");
583
584
585 DocDeclStr(
586 void , Allow(),
587 "This is the opposite of `Veto`: it explicitly allows the event to be
588processed. For most events it is not necessary to call this method as
589the events are allowed anyhow but some are forbidden by default (this
590will be mentioned in the corresponding event description).", "");
591
d14a1e28 592
d5a7caf6
RD
593 DocDeclStr(
594 bool , IsAllowed(),
595 "Returns true if the change is allowed (`Veto` hasn't been called) or
596false otherwise (if it was).", "");
597
d14a1e28
RD
598};
599
600
601//---------------------------------------------------------------------------
602%newgroup;
603
d5a7caf6
RD
604DocStr(wxScrollEvent,
605"A scroll event holds information about events sent from stand-alone
606scrollbars and sliders. Note that scrolled windows do not send
607instnaces of this event class, but send the `wx.ScrollWinEvent`
608instead.", "
609
610Events
611-------
612 ======================= ==========================================
613 EVT_SCROLL Used to bind all scroll events
614 EVT_SCROLL_TOP scroll-to-top events (minimum position)
615 EVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position)
616 EVT_SCROLL_LINEUP line up events
617 EVT_SCROLL_LINEDOWN line down events
618 EVT_SCROLL_PAGEUP page up events
619 EVT_SCROLL_PAGEDOWN page down events
620 EVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
621 as the user drags the 'thumb')
622 EVT_SCROLL_THUMBRELEASE thumb release events.
623 EVT_SCROLL_ENDSCROLL End of scrolling
624 ======================= ==========================================
625
626Note
627------
628 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually
629 dragging the thumb using the mouse and releasing it (This
630 EVT_SCROLL_THUMBRELEASE event is also followed by an
631 EVT_SCROLL_ENDSCROLL event).
632
633 The EVT_SCROLL_ENDSCROLL event also occurs when using the keyboard
634 to change the thumb position, and when clicking next to the thumb
635 (In all these cases the EVT_SCROLL_THUMBRELEASE event does not
636 happen).
637
638 In short, the EVT_SCROLL_ENDSCROLL event is triggered when
639 scrolling/ moving has finished. The only exception (unfortunately)
640 is that changing the thumb position using the mousewheel does give
641 a EVT_SCROLL_THUMBRELEASE event but NOT an EVT_SCROLL_ENDSCROLL
642 event.
643");
644
d14a1e28
RD
645class wxScrollEvent : public wxCommandEvent
646{
647public:
d5a7caf6
RD
648 DocCtorStr(
649 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
650 int winid = 0, int pos = 0, int orient = 0),
651 "", "");
d14a1e28 652
d5a7caf6
RD
653 DocDeclStr(
654 int , GetOrientation() const,
655 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
656the scrollbar.", "");
657
658 DocDeclStr(
659 int , GetPosition() const,
660 "Returns the position of the scrollbar.", "");
661
d14a1e28
RD
662 void SetOrientation(int orient);
663 void SetPosition(int pos);
664};
665
666
667//---------------------------------------------------------------------------
668%newgroup;
669
d5a7caf6
RD
670DocStr(wxScrollWinEvent,
671"A wx.ScrollWinEvent holds information about scrolling and is sent from
672scrolling windows.", "
673
674Events
675-------
676 ========================== ==========================================
677 EVT_SCROLLWIN Used to bind all scrolled window scroll events
678 EVT_SCROLLWIN_TOP scroll-to-top events (minimum position)
679 EVT_SCROLLWIN_BOTTOM scroll-to-bottom events (maximum position)
680 EVT_SCROLLWIN_LINEUP line up events
681 EVT_SCROLLWIN_LINEDOWN line down events
682 EVT_SCROLLWIN_PAGEUP page up events
683 EVT_SCROLLWIN_PAGEDOWN page down events
684 EVT_SCROLLWIN_THUMBTRACK thumbtrack events (frequent events sent
685 as the user drags the 'thumb')
686 EVT_SCROLLWIN_THUMBRELEASE thumb release events.
687 EVT_SCROLLWIN_ENDSCROLL End of scrolling
688 ========================== ==========================================
689
e47ce385 690:see: `wx.ScrollEvent`
d5a7caf6
RD
691");
692
d14a1e28
RD
693class wxScrollWinEvent : public wxEvent
694{
695public:
696 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
697 int pos = 0, int orient = 0);
698
d5a7caf6
RD
699 DocDeclStr(
700 int , GetOrientation() const,
701 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
702the scrollbar.", "");
703
704 DocDeclStr(
705 int , GetPosition() const,
706 "Returns the position of the scrollbar for the thumb track and release
707events. Note that this field can't be used for the other events, you
708need to query the window itself for the current position in that case.", "");
709
d14a1e28
RD
710 void SetOrientation(int orient);
711 void SetPosition(int pos);
712};
713
714//---------------------------------------------------------------------------
715%newgroup;
716
d5a7caf6
RD
717
718DocStr(wxMouseEvent,
719"This event class contains information about the events generated by
720the mouse: they include mouse buttons press and release events and
721mouse move events.
722
723All mouse events involving the buttons use ``wx.MOUSE_BTN_LEFT`` for
724the left mouse button, ``wx.MOUSE_BTN_MIDDLE`` for the middle one and
725``wx.MOUSE_BTN_RIGHT`` for the right one. Note that not all mice have
726a middle button so a portable application should avoid relying on the
727events from it.
728
729Note the difference between methods like `LeftDown` and `LeftIsDown`:
730the former returns true when the event corresponds to the left mouse
731button click while the latter returns true if the left mouse button is
732currently being pressed. For example, when the user is dragging the
733mouse you can use `LeftIsDown` to test whether the left mouse button
734is (still) depressed. Also, by convention, if `LeftDown` returns true,
735`LeftIsDown` will also return true in wxWidgets whatever the
736underlying GUI behaviour is (which is platform-dependent). The same
737applies, of course, to other mouse buttons as well.", "
738
739Events
740-------
741 ================== ==============================================
742 EVT_LEFT_DOWN Left mouse button down event. The handler
743 of this event should normally call
744 event.Skip() to allow the default processing
745 to take place as otherwise the window under
746 mouse wouldn't get the focus.
747 EVT_LEFT_UP Left mouse button up event
748 EVT_LEFT_DCLICK Left mouse button double click event
749 EVT_MIDDLE_DOWN Middle mouse button down event
750 EVT_MIDDLE_UP Middle mouse button up event
751 EVT_MIDDLE_DCLICK Middle mouse button double click event
752 EVT_RIGHT_DOWN Right mouse button down event
753 EVT_RIGHT_UP Right mouse button up event
754 EVT_RIGHT_DCLICK Right mouse button double click event
755 EVT_MOTION Event sent when the mouse is moving
756 EVT_ENTER_WINDOW Event sent when the mouse enters the
757 boundaries of a window.
758 EVT_LEAVE_WINDOW Sent when the mouse leaves the window's bounds
759 EVT_MOUSEWHEEL Mouse scroll wheel event
760 EVT_MOUSE_EVENTS Binds all mouse events at once.
761 ================== ==============================================
762
763");
764
765
d14a1e28
RD
766// the symbolic names for the mouse buttons
767enum
768{
769 wxMOUSE_BTN_ANY = -1,
770 wxMOUSE_BTN_NONE = -1,
771 wxMOUSE_BTN_LEFT = 0,
772 wxMOUSE_BTN_MIDDLE = 1,
773 wxMOUSE_BTN_RIGHT = 2
774};
775
776
777// Mouse event class
778class wxMouseEvent : public wxEvent
779{
780public:
d5a7caf6
RD
781 DocCtorStr(
782 wxMouseEvent(wxEventType mouseType = wxEVT_NULL),
783"Constructs a wx.MouseEvent. Valid event types are:
784
785 * wxEVT_ENTER_WINDOW
786 * wxEVT_LEAVE_WINDOW
787 * wxEVT_LEFT_DOWN
788 * wxEVT_LEFT_UP
789 * wxEVT_LEFT_DCLICK
790 * wxEVT_MIDDLE_DOWN
791 * wxEVT_MIDDLE_UP
792 * wxEVT_MIDDLE_DCLICK
793 * wxEVT_RIGHT_DOWN
794 * wxEVT_RIGHT_UP
795 * wxEVT_RIGHT_DCLICK
796 * wxEVT_MOTION
797 * wxEVT_MOUSEWHEEL ", "");
d14a1e28 798
d14a1e28 799
d5a7caf6
RD
800 DocDeclStr(
801 bool , IsButton() const,
802 "Returns true if the event was a mouse button event (not necessarily a
803button down event - that may be tested using `ButtonDown`).", "");
804
d14a1e28 805
d5a7caf6
RD
806 DocDeclStr(
807 bool , ButtonDown(int but = wxMOUSE_BTN_ANY) const,
e47ce385
RD
808 "If the argument is omitted, this returns true if the event was any
809mouse button down event. Otherwise the argument specifies which
810button-down event shold be checked for (see `Button` for the possible
811values).", "");
d5a7caf6
RD
812
813
814 DocDeclStr(
815 bool , ButtonDClick(int but = wxMOUSE_BTN_ANY) const,
816 "If the argument is omitted, this returns true if the event was any
817mouse double click event. Otherwise the argument specifies which
818double click event to check for (see `Button` for the possible
819values).", "");
820
d14a1e28 821
d5a7caf6
RD
822 DocDeclStr(
823 bool , ButtonUp(int but = wxMOUSE_BTN_ANY) const,
824 "If the argument is omitted, this returns true if the event was any
e47ce385
RD
825mouse button up event. Otherwise the argument specifies which button
826up event to check for (see `Button` for the possible values).", "");
d5a7caf6 827
d14a1e28 828
d5a7caf6
RD
829 DocDeclStr(
830 bool , Button(int button) const,
831 "Returns true if the identified mouse button is changing state. Valid
832values of button are:
833
834 ==================== =====================================
835 wx.MOUSE_BTN_LEFT check if left button was pressed
836 wx.MOUSE_BTN_MIDDLE check if middle button was pressed
837 wx.MOUSE_BTN_RIGHT check if right button was pressed
838 wx.MOUSE_BTN_ANY check if any button was pressed
839 ==================== =====================================
840", "");
841
d14a1e28
RD
842
843 // Was the given button in Down state?
844 bool ButtonIsDown(int but) const;
845
d5a7caf6
RD
846 DocDeclStr(
847 int , GetButton() const,
848 "Returns the mouse button which generated this event or
849wx.MOUSE_BTN_NONE if no button is involved (for mouse move, enter or
850leave event, for example). Otherwise wx.MOUSE_BTN_LEFT is returned for
851the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE
852and wx.MOUSE_BTN_RIGHT for the same events for the middle and the
853right buttons respectively.", "");
854
d14a1e28 855
d5a7caf6
RD
856 DocDeclStr(
857 bool , ControlDown() const,
858 "Returns true if the control key was down at the time of the event.", "");
859
860 DocDeclStr(
861 bool , MetaDown() const,
862 "Returns true if the Meta key was down at the time of the event.", "");
863
864
865 DocDeclStr(
866 bool , AltDown() const,
867 "Returns true if the Alt key was down at the time of the event.", "");
868
869 DocDeclStr(
870 bool , ShiftDown() const,
871 "Returns true if the Shift key was down at the time of the event.", "");
872
d14a1e28 873
ba3e5ef2
RD
874 DocDeclStr(
875 bool , CmdDown() const,
876 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
877platforms but the special \"Apple\" (a.k.a as \"Command\") key on
e47ce385 878Macs. It often makes sense to use it instead of, say, `ControlDown`
ba3e5ef2 879because Cmd key is used for the same thing under Mac as Ctrl
d5a7caf6 880elsewhere. The Ctrl key still exists, it's just not used for this
ba3e5ef2
RD
881purpose. So for non-Mac platforms this is the same as `ControlDown`
882and Macs this is the same as `MetaDown`.", "");
883
d14a1e28 884
d5a7caf6
RD
885 DocDeclStr(
886 bool , LeftDown() const,
887 "Returns true if the left mouse button state changed to down.", "");
888
889 DocDeclStr(
890 bool , MiddleDown() const,
891 "Returns true if the middle mouse button state changed to down.", "");
892
893 DocDeclStr(
894 bool , RightDown() const,
895 "Returns true if the right mouse button state changed to down.", "");
896
897
898
899 DocDeclStr(
900 bool , LeftUp() const,
901 "Returns true if the left mouse button state changed to up.", "");
902
903 DocDeclStr(
904 bool , MiddleUp() const,
905 "Returns true if the middle mouse button state changed to up.", "");
906
907 DocDeclStr(
908 bool , RightUp() const,
909 "Returns true if the right mouse button state changed to up.", "");
910
911
912
913
914 DocDeclStr(
915 bool , LeftDClick() const,
916 "Returns true if the event was a left button double click.", "");
917
918 DocDeclStr(
919 bool , MiddleDClick() const,
920 "Returns true if the event was a middle button double click.", "");
921
922 DocDeclStr(
923 bool , RightDClick() const,
924 "Returns true if the event was a right button double click.", "");
925
926
927
928 DocDeclStr(
929 bool , LeftIsDown(),
930 "Returns true if the left mouse button is currently down, independent
931of the current event type.
d14a1e28 932
d5a7caf6
RD
933Please notice that it is not the same as LeftDown which returns true
934if the left mouse button was just pressed. Rather, it describes the
935state of the mouse button before the event happened.
d14a1e28 936
d5a7caf6
RD
937This event is usually used in the mouse event handlers which process
938\"move mouse\" messages to determine whether the user is (still)
939dragging the mouse.", "");
940
941 DocDeclStr(
942 bool , MiddleIsDown(),
943 "Returns true if the middle mouse button is currently down, independent
944of the current event type.", "");
945
946 DocDeclStr(
947 bool , RightIsDown(),
948 "Returns true if the right mouse button is currently down, independent
949of the current event type.", "");
950
d14a1e28 951
d5a7caf6
RD
952
953 DocDeclStr(
954 bool , Dragging() const,
955 "Returns true if this was a dragging event (motion while a button is
956depressed).", "");
957
d14a1e28 958
d5a7caf6
RD
959 DocDeclStr(
960 bool , Moving() const,
961 "Returns true if this was a motion event and no mouse buttons were
962pressed. If any mouse button is held pressed, then this method returns
963false and Dragging returns true.", "");
964
d14a1e28 965
d5a7caf6
RD
966 DocDeclStr(
967 bool , Entering() const,
968 "Returns true if the mouse was entering the window.", "");
969
d14a1e28 970
d5a7caf6
RD
971 DocDeclStr(
972 bool , Leaving() const,
973 "Returns true if the mouse was leaving the window.", "");
974
d14a1e28 975
dd9f7fea
RD
976
977 DocStr(GetPosition, // sets the docstring for both
d5a7caf6
RD
978 "Returns the pixel position of the mouse in window coordinates when the
979event happened.", "");
d14a1e28 980 wxPoint GetPosition();
d14a1e28 981
dd9f7fea
RD
982 DocDeclAName(
983 void, GetPosition(long *OUTPUT, long *OUTPUT),
984 "GetPositionTuple() -> (x,y)",
985 GetPositionTuple);
986
d5a7caf6
RD
987 DocDeclStr(
988 wxPoint , GetLogicalPosition(const wxDC& dc) const,
989 "Returns the logical mouse position in pixels (i.e. translated
990according to the translation set for the DC, which usually indicates
991that the window has been scrolled).", "");
992
d14a1e28 993
d5a7caf6
RD
994 DocDeclStr(
995 wxCoord , GetX() const,
996 "Returns X coordinate of the physical mouse event position.", "");
997
998 DocDeclStr(
999 wxCoord , GetY() const,
1000 "Returns Y coordinate of the physical mouse event position.", "");
1001
d14a1e28 1002
d5a7caf6
RD
1003 DocDeclStr(
1004 int , GetWheelRotation() const,
1005 "Get wheel rotation, positive or negative indicates direction of
1006rotation. Current devices all send an event when rotation is equal to
1007+/-WheelDelta, but this allows for finer resolution devices to be
1008created in the future. Because of this you shouldn't assume that one
1009event is equal to 1 line or whatever, but you should be able to either
1010do partial line scrolling or wait until +/-WheelDelta rotation values
1011have been accumulated before scrolling.", "");
1012
d14a1e28 1013
d5a7caf6
RD
1014 DocDeclStr(
1015 int , GetWheelDelta() const,
1016 "Get wheel delta, normally 120. This is the threshold for action to be
1017taken, and one such action (for example, scrolling one increment)
1018should occur for each delta.", "");
1019
1020
1021 DocDeclStr(
1022 int , GetLinesPerAction() const,
1023 "Returns the configured number of lines (or whatever) to be scrolled
1024per wheel action. Defaults to three.", "");
1025
1026
1027 DocDeclStr(
1028 bool , IsPageScroll() const,
1029 "Returns true if the system has been setup to do page scrolling with
1030the mouse wheel instead of line scrolling.", "");
1031
d14a1e28
RD
1032
1033public:
1034 wxCoord m_x, m_y;
1035
1036 bool m_leftDown;
1037 bool m_middleDown;
1038 bool m_rightDown;
1039
1040 bool m_controlDown;
1041 bool m_shiftDown;
1042 bool m_altDown;
1043 bool m_metaDown;
1044
1045 int m_wheelRotation;
1046 int m_wheelDelta;
1047 int m_linesPerAction;
1048};
1049
1050//---------------------------------------------------------------------------
1051%newgroup;
1052
1053// Cursor set event
e47ce385
RD
1054
1055DocStr(wxSetCursorEvent,
1056"A SetCursorEvent is generated when the mouse cursor is about to be set
1057as a result of mouse motion. This event gives the application the
1058chance to perform specific mouse cursor processing based on the
1059current position of the mouse within the window. Use the `SetCursor`
1060method to specify the cursor you want to be displayed.", "");
1061
d14a1e28
RD
1062class wxSetCursorEvent : public wxEvent
1063{
1064public:
e47ce385
RD
1065 DocCtorStr(
1066 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0),
1067 "Construct a new `wx.SetCursorEvent`.", "");
d14a1e28 1068
e47ce385
RD
1069 DocDeclStr(
1070 wxCoord , GetX() const,
1071 "Returns the X coordinate of the mouse in client coordinates.", "");
1072
1073 DocDeclStr(
1074 wxCoord , GetY() const,
1075 "Returns the Y coordinate of the mouse in client coordinates.", "");
1076
d14a1e28 1077
e47ce385
RD
1078 DocDeclStr(
1079 void , SetCursor(const wxCursor& cursor),
1080 "Sets the cursor associated with this event.", "");
1081
1082 DocDeclStr(
1083 const wxCursor& , GetCursor() const,
1084 "Returns a reference to the cursor specified by this event.", "");
1085
1086 DocDeclStr(
1087 bool , HasCursor() const,
1088 "Returns true if the cursor specified by this event is a valid cursor.", "");
1089
d14a1e28
RD
1090};
1091
1092//---------------------------------------------------------------------------
1093%newgroup;
1094
1095// Keyboard input event class
1096
e47ce385
RD
1097DocStr(wxKeyEvent,
1098"This event class contains information about keypress and character
1099events. These events are only sent to the widget that currently has
1100the keyboard focus.
1101
1102Notice that there are three different kinds of keyboard events in
1103wxWidgets: key down and up events and char events. The difference
1104between the first two is clear - the first corresponds to a key press
1105and the second to a key release - otherwise they are identical. Just
1106note that if the key is maintained in a pressed state you will
1107typically get a lot of (automatically generated) down events but only
1108one up so it is wrong to assume that there is one up event
1109corresponding to each down one.
1110
1111Both key events provide untranslated key codes while the char event
1112carries the translated one. The untranslated code for alphanumeric
1113keys is always an upper case value. For the other keys it is one of
1114WXK_XXX values from the keycodes table. The translated key is, in
1115general, the character the user expects to appear as the result of the
1116key combination when typing the text into a text entry zone, for
1117example.
1118
1119A few examples to clarify this (all assume that CAPS LOCK is unpressed
1120and the standard US keyboard): when the 'A' key is pressed, the key
1121down event key code is equal to ASCII A == 65. But the char event key
1122code is ASCII a == 97. On the other hand, if you press both SHIFT and
1123'A' keys simultaneously , the key code in key down event will still be
1124just 'A' while the char event key code parameter will now be 'A' as
1125well.
1126
1127Although in this simple case it is clear that the correct key code
1128could be found in the key down event handler by checking the value
1129returned by `ShiftDown`, in general you should use EVT_CHAR for this
1130as for non alphanumeric keys or non-US keyboard layouts the
1131translation is keyboard-layout dependent and can only be done properly
1132by the system itself.
1133
1134Another kind of translation is done when the control key is pressed:
1135for example, for CTRL-A key press the key down event still carries the
1136same key code 'A' as usual but the char event will have key code of 1,
1137the ASCII value of this key combination.
1138
1139You may discover how the other keys on your system behave
1140interactively by running the KeyEvents sample in the wxPython demo and
1141pressing some keys while the blue box at the top has the keyboard
1142focus.
1143
1144**Note**: If a key down event is caught and the event handler does not
1145call event.Skip() then the coresponding char event will not
1146happen. This is by design and enables the programs that handle both
1147types of events to be a bit simpler.
1148
1149**Note for Windows programmers**: The key and char events in wxWidgets
1150are similar to but slightly different from Windows WM_KEYDOWN and
1151WM_CHAR events. In particular, Alt-x combination will generate a char
1152event in wxWidgets (unless it is used as an accelerator).
1153
1154**Tip**: be sure to call event.Skip() for events that you don't
1155process in key event function, otherwise menu shortcuts may cease to
1156work under Windows.
1157", "
1158
1159Events
1160------
1161 ================== ==============================================
1162 wx.EVT_KEY_DOWN Sent when a keyboard key has been pressed
1163 wx.EVT_KEY_UP Sent when a keyboard key has been released
1164 wx.EVT_CHAR Sent for translated character events.
1165 ================== ==============================================
1166
1167
1168Keycode Table
1169-------------
1170 =========== ============== ======== ==================== =================
1171 WXK_BACK WXK_EXECUTE WXK_F1 WXK_NUMPAD_SPACE WXK_WINDOWS_LEFT
1172 WXK_TAB WXK_SNAPSHOT WXK_F2 WXK_NUMPAD_TAB WXK_WINDOWS_RIGHT
1173 WXK_RETURN WXK_INSERT WXK_F3 WXK_NUMPAD_ENTER WXK_WINDOWS_MENU
1174 WXK_ESCAPE WXK_HELP WXK_F4 WXK_NUMPAD_F1 WXK_SPECIAL1
1175 WXK_SPACE WXK_NUMPAD0 WXK_F5 WXK_NUMPAD_F2 WXK_SPECIAL2
1176 WXK_DELETE WXK_NUMPAD1 WXK_F6 WXK_NUMPAD_F3 WXK_SPECIAL3
1177 WXK_LBUTTON WXK_NUMPAD2 WXK_F7 WXK_NUMPAD_F4 WXK_SPECIAL4
1178 WXK_RBUTTON WXK_NUMPAD3 WXK_F8 WXK_NUMPAD_HOME WXK_SPECIAL5
1179 WXK_CANCEL WXK_NUMPAD4 WXK_F9 WXK_NUMPAD_LEFT WXK_SPECIAL6
1180 WXK_MBUTTON WXK_NUMPAD5 WXK_F10 WXK_NUMPAD_UP WXK_SPECIAL7
1181 WXK_CLEAR WXK_NUMPAD6 WXK_F11 WXK_NUMPAD_RIGHT WXK_SPECIAL8
1182 WXK_SHIFT WXK_NUMPAD7 WXK_F12 WXK_NUMPAD_DOWN WXK_SPECIAL9
1183 WXK_ALT WXK_NUMPAD8 WXK_F13 WXK_NUMPAD_PRIOR WXK_SPECIAL10
1184 WXK_CONTROL WXK_NUMPAD9 WXK_F14 WXK_NUMPAD_PAGEUP WXK_SPECIAL11
1185 WXK_MENU WXK_MULTIPLY WXK_F15 WXK_NUMPAD_NEXT WXK_SPECIAL12
1186 WXK_PAUSE WXK_ADD WXK_F16 WXK_NUMPAD_PAGEDOWN WXK_SPECIAL13
1187 WXK_CAPITAL WXK_SEPARATOR WXK_F17 WXK_NUMPAD_END WXK_SPECIAL14
1188 WXK_PRIOR WXK_SUBTRACT WXK_F18 WXK_NUMPAD_BEGIN WXK_SPECIAL15
1189 WXK_NEXT WXK_DECIMAL WXK_F19 WXK_NUMPAD_INSERT WXK_SPECIAL16
1190 WXK_END WXK_DIVIDE WXK_F20 WXK_NUMPAD_DELETE WXK_SPECIAL17
1191 WXK_HOME WXK_NUMLOCK WXK_F21 WXK_NUMPAD_EQUAL WXK_SPECIAL18
1192 WXK_LEFT WXK_SCROLL WXK_F22 WXK_NUMPAD_MULTIPLY WXK_SPECIAL19
1193 WXK_UP WXK_PAGEUP WXK_F23 WXK_NUMPAD_ADD WXK_SPECIAL20
1194 WXK_RIGHT WXK_PAGEDOWN WXK_F24 WXK_NUMPAD_SEPARATOR
1195 WXK_DOWN WXK_NUMPAD_SUBTRACT
1196 WXK_SELECT WXK_NUMPAD_DECIMAL
1197 WXK_PRINT WXK_NUMPAD_DIVIDE
1198 =========== ============== ======== ==================== =================
1199");
1200
d14a1e28
RD
1201class wxKeyEvent : public wxEvent
1202{
1203public:
e47ce385
RD
1204 DocCtorStr(
1205 wxKeyEvent(wxEventType eventType = wxEVT_NULL),
1206 "Construct a new `wx.KeyEvent`. Valid event types are:
1207 * ", "");
1208
d14a1e28 1209
e47ce385
RD
1210 DocDeclStr(
1211 bool , ControlDown() const,
1212 "Returns ``True`` if the Control key was down at the time of the event.", "");
1213
1214 DocDeclStr(
1215 bool , MetaDown() const,
1216 "Returns ``True`` if the Meta key was down at the time of the event.", "");
1217
1218 DocDeclStr(
1219 bool , AltDown() const,
1220 "Returns ``True`` if the Alt key was down at the time of the event.", "");
1221
1222 DocDeclStr(
1223 bool , ShiftDown() const,
1224 "Returns ``True`` if the Shift key was down at the time of the event.", "");
1225
ba3e5ef2
RD
1226
1227 DocDeclStr(
1228 bool , CmdDown() const,
1229 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
1230platforms but the special \"Apple\" (a.k.a as \"Command\") key on
e47ce385 1231Macs. It makes often sense to use it instead of, say, `ControlDown`
ba3e5ef2
RD
1232because Cmd key is used for the same thing under Mac as Ctrl
1233elsewhere. The Ctrl still exists, it's just not used for this
1234purpose. So for non-Mac platforms this is the same as `ControlDown`
1235and Macs this is the same as `MetaDown`.", "");
1236
1237
d14a1e28 1238
e47ce385
RD
1239 DocDeclStr(
1240 bool , HasModifiers() const,
1241 "Returns true if either CTRL or ALT keys was down at the time of the
1242key event. Note that this function does not take into account neither
1243SHIFT nor META key states (the reason for ignoring the latter is that
1244it is common for NUMLOCK key to be configured as META under X but the
1245key presses even while NUMLOCK is on should be still processed
1246normally).", "");
1247
d14a1e28 1248
e47ce385
RD
1249 DocDeclStr(
1250 int , GetKeyCode() const,
1251 "Returns the virtual key code. ASCII events return normal ASCII values,
1252while non-ASCII events return values such as WXK_LEFT for the left
1253cursor key. See `wx.KeyEvent` for a full list of the virtual key
1254codes.
1255
1256Note that in Unicode build, the returned value is meaningful only if
1257the user entered a character that can be represented in current
1258locale's default charset. You can obtain the corresponding Unicode
1259character using `GetUnicodeKey`.", "");
d14a1e28
RD
1260 %pythoncode { KeyCode = GetKeyCode }
1261
e47ce385 1262
d14a1e28 1263 %extend {
e47ce385
RD
1264 DocStr(
1265 GetUnicodeKey,
1266 "Returns the Unicode character corresponding to this key event. This
1267function is only meaningfule in a Unicode build of wxPython.", "");
ba87052f 1268 int GetUnicodeKey() {
3b7224dc 1269 %#if wxUSE_UNICODE
ba87052f 1270 return self->GetUnicodeKey();
3b7224dc 1271 %#else
d14a1e28 1272 return 0;
3b7224dc 1273 %#endif
d14a1e28
RD
1274 }
1275 }
ba87052f
RD
1276 %pythoncode { GetUniChar = GetUnicodeKey }
1277
d14a1e28 1278
e47ce385
RD
1279 DocDeclStr(
1280 wxUint32 , GetRawKeyCode() const,
1281 "Returns the raw key code for this event. This is a platform-dependent
1282scan code which should only be used in advanced
1283applications. Currently the raw key codes are not supported by all
1284ports.", "");
1285
d14a1e28 1286
e47ce385
RD
1287 DocDeclStr(
1288 wxUint32 , GetRawKeyFlags() const,
1289 "Returns the low level key flags for this event. The flags are
1290platform-dependent and should only be used in advanced applications.
1291Currently the raw key flags are not supported by all ports.", "");
1292
d14a1e28 1293
dd9f7fea
RD
1294
1295 DocStr(GetPosition, // sets the docstring for both
e47ce385 1296 "Find the position of the event, if applicable.", "");
d14a1e28 1297 wxPoint GetPosition();
dd9f7fea
RD
1298
1299 DocDeclAName(
1300 void, GetPosition(long *OUTPUT, long *OUTPUT),
1301 "GetPositionTuple() -> (x,y)",
1302 GetPositionTuple);
d14a1e28 1303
e47ce385
RD
1304
1305 DocDeclStr(
1306 wxCoord , GetX() const,
1307 "Returns the X position (in client coordinates) of the event, if
1308applicable.", "");
1309
d14a1e28 1310
e47ce385
RD
1311 DocDeclStr(
1312 wxCoord , GetY() const,
1313 "Returns the Y position (in client coordinates) of the event, if
1314applicable.", "");
1315
d14a1e28
RD
1316
1317public:
1318 wxCoord m_x, m_y;
1319
1320 long m_keyCode;
1321
1322 bool m_controlDown;
1323 bool m_shiftDown;
1324 bool m_altDown;
1325 bool m_metaDown;
1326 bool m_scanCode;
1327
d14a1e28
RD
1328 wxUint32 m_rawCode;
1329 wxUint32 m_rawFlags;
1330};
1331
1332//---------------------------------------------------------------------------
1333%newgroup;
1334
1335// Size event class
e47ce385
RD
1336
1337DocStr(wxSizeEvent,
1338"A size event holds information about size change events. The EVT_SIZE
1339handler function will be called when the window it is bound to has
1340been resized.
1341
1342Note that the size passed is of the whole window: call
1343`wx.Window.GetClientSize` for the area which may be used by the
1344application.
1345
1346When a window is resized, usually only a small part of the window is
1347damaged and and that area is all that is in the update region for the
1348next paint event. However, if your drawing depends on the size of the
1349window, you may need to clear the DC explicitly and repaint the whole
1350window. In which case, you may need to call `wx.Window.Refresh` to
1351invalidate the entire window.
1352", "");
1353
d14a1e28
RD
1354class wxSizeEvent : public wxEvent
1355{
1356public:
e47ce385
RD
1357 DocCtorStr(
1358 wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0),
1359 "Construct a new ``wx.SizeEvent``.", "");
d14a1e28 1360
e47ce385
RD
1361 DocDeclStr(
1362 wxSize , GetSize() const,
1363 "Returns the entire size of the window generating the size change
1364event.", "");
1365
d14a1e28
RD
1366 wxRect GetRect() const;
1367 void SetRect(wxRect rect);
e47ce385 1368
d14a1e28
RD
1369 %extend {
1370 void SetSize(wxSize size) {
1371 self->m_size = size;
1372 }
1373 }
1374
1375public:
1376 wxSize m_size;
e47ce385 1377 wxRect m_rect;
d14a1e28
RD
1378};
1379
1380
1381//---------------------------------------------------------------------------
1382%newgroup;
1383
e47ce385
RD
1384DocStr(wxMoveEvent,
1385"This event object is sent for EVT_MOVE event bindings when a window is
1386moved to a new position.", "");
1387
d14a1e28
RD
1388class wxMoveEvent : public wxEvent
1389{
1390public:
e47ce385
RD
1391 DocCtorStr(
1392 wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0),
1393 "Constructor.", "");
d14a1e28 1394
e47ce385
RD
1395 DocDeclStr(
1396 wxPoint , GetPosition() const,
1397 "Returns the position of the window generating the move change event.", "");
1398
d14a1e28 1399 wxRect GetRect() const;
aeee37c3
RD
1400 void SetRect(const wxRect& rect);
1401 void SetPosition(const wxPoint& pos);
d14a1e28 1402
aeee37c3
RD
1403 %pythoncode {
1404 m_pos = property(GetPosition, SetPosition)
1405 m_rect = property(GetRect, SetRect)
1406 }
d14a1e28
RD
1407};
1408
1409//---------------------------------------------------------------------------
1410%newgroup;
1411
e47ce385
RD
1412DocStr(wxPaintEvent,
1413"A paint event is sent when a window's contents needs to be repainted.
1414Note that in an EVT_PAINT handler the application must *always* create
1415a `wx.PaintDC` object, even if you do not use it. Otherwise MS
1416Windows assumes that the window has not been painted yet and will send
1417the event again, causing endless refreshes.
1418
1419You can optimize painting by retrieving the rectangles that have been
1420damaged using `wx.Window.GetUpdateRegion` and/or `wx.RegionIterator`,
1421and only repainting these rectangles. The rectangles are in terms of
1422the client area, and are unscrolled, so you will need to do some
1423calculations using the current view position to obtain logical,
1424scrolled units.
1425", "");
1426
d14a1e28
RD
1427class wxPaintEvent : public wxEvent
1428{
1429public:
e47ce385
RD
1430 DocCtorStr(
1431 wxPaintEvent(int Id = 0),
1432 "", "");
d14a1e28
RD
1433};
1434
1435
1436class wxNcPaintEvent : public wxEvent
1437{
1438public:
1439 wxNcPaintEvent(int winid = 0);
1440};
1441
1442//---------------------------------------------------------------------------
1443%newgroup;
1444
e47ce385
RD
1445DocStr(wxEraseEvent,
1446"An erase event is sent whenever the background of a window needs to be
1447repainted. To intercept this event use the EVT_ERASE_BACKGROUND event
1448binder. On some platforms, such as GTK+, this event is simulated
1449(simply generated just before the paint event) and may cause flicker.
1450
1451To paint a custom background use the `GetDC` method and use the returned
1452device context if it is not ``None``, otherwise create a temporary
1453`wx.ClientDC` and draw on that.
1454", "");
1455
d14a1e28
RD
1456class wxEraseEvent : public wxEvent
1457{
1458public:
e47ce385
RD
1459 DocCtorStr(
1460 wxEraseEvent(int Id = 0, wxDC *dc = NULL),
1461 "Constructor", "");
d14a1e28 1462
e47ce385
RD
1463 DocDeclStr(
1464 wxDC *, GetDC() const,
1465 "Returns the device context the event handler should draw upon. If
1466``None`` is returned then create a temporary `wx.ClientDC` and use
1467that instead.", "");
d14a1e28
RD
1468};
1469
1470
1471//---------------------------------------------------------------------------
1472%newgroup;
1473
e47ce385
RD
1474DocStr(wxFocusEvent,
1475"A focus event is sent when a window's focus changes. The window losing
1476focus receives an EVT_KILL_FOCUS event while the window gaining it
1477gets an EVT_SET_FOCUS event.
1478
1479Notice that the set focus event happens both when the user gives focus
1480to the window (whether using the mouse or keyboard) and when it is
1481done from the program itself using `wx.Window.SetFocus`.
1482", "");
1483
d14a1e28
RD
1484class wxFocusEvent : public wxEvent
1485{
1486public:
e47ce385
RD
1487 DocCtorStr(
1488 wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0),
1489 "Constructor", "");
d14a1e28 1490
e47ce385
RD
1491 DocDeclStr(
1492 wxWindow *, GetWindow() const,
1493 "Returns the other window associated with this event, that is the
1494window which had the focus before for the EVT_SET_FOCUS event and the
1495window which is going to receive focus for the wxEVT_KILL_FOCUS event.
1496
1497Warning: the window returned may be None!", "");
1498
d14a1e28
RD
1499 void SetWindow(wxWindow *win);
1500};
1501
1502//---------------------------------------------------------------------------
1503%newgroup;
1504
e47ce385
RD
1505DocStr(wxChildFocusEvent,
1506"wx.ChildFocusEvent notifies the parent that a child has received the
1507focus. Unlike `wx.FocusEvent` it is propagated up the window
1508heirarchy.", "");
1509
1510
d14a1e28
RD
1511class wxChildFocusEvent : public wxCommandEvent
1512{
1513public:
e47ce385
RD
1514 DocCtorStr(
1515 wxChildFocusEvent(wxWindow *win = NULL),
1516 "Constructor", "");
d14a1e28 1517
e47ce385
RD
1518 DocDeclStr(
1519 wxWindow *, GetWindow() const,
1520 "The window which has just received the focus.", "");
1521
d14a1e28
RD
1522};
1523
1524//---------------------------------------------------------------------------
1525%newgroup;
1526
e47ce385
RD
1527DocStr(wxActivateEvent,
1528"An activate event is sent when a top-level window or the entire
1529application is being activated or deactivated.
1530
1531A top-level window (a dialog or frame) receives an activate event when
1532is being activated or deactivated. This is indicated visually by the
1533title bar changing colour, and a subwindow gaining the keyboard focus.
1534An application is activated or deactivated when one of its frames
1535becomes activated, or a frame becomes inactivate resulting in all
1536application frames being inactive.
1537
1538Please note that usually you should call event.Skip() in your handlers
1539for these events so the default handlers will still be called, as not
1540doing so can result in strange effects.
1541", "
1542
1543Events
1544-------
1545 ======================= ==========================================
1546 wx.EVT_ACTIVATE Sent to a frame when it has been activated
1547 or deactivated.
1548 wx.EVT_ACTIVATE_APP Sent to the app object when its activation
1549 state changes.
1550 ======================= ==========================================
1551");
1552
1553
d14a1e28
RD
1554class wxActivateEvent : public wxEvent
1555{
1556public:
e47ce385
RD
1557 DocCtorStr(
1558 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0),
1559 "Constructor", "");
1560
1561 DocDeclStr(
1562 bool , GetActive() const,
1563 "Returns true if the application or window is being activated, false
1564otherwise.", "");
1565
d14a1e28
RD
1566};
1567
1568
1569//---------------------------------------------------------------------------
1570%newgroup;
1571
e47ce385
RD
1572DocStr(wxInitDialogEvent,
1573"A wx.InitDialogEvent is sent as a dialog is being initialised, or for
1574any window when `wx.Window.InitDialog` is called. Handlers for this
1575event can transfer data to the window, or anything else that should be
1576done before the user begins editing the form. The default handler
1577calls `wx.Window.TransferDataToWindow`.", "
1578
1579Events
1580-------
1581 ======================= ==========================================
1582 wx.EVT_INIT_DIALOG Binder for init dialog events.
1583 ======================= ==========================================
1584");
1585
d14a1e28
RD
1586class wxInitDialogEvent : public wxEvent
1587{
1588public:
e47ce385
RD
1589 DocCtorStr(
1590 wxInitDialogEvent(int Id = 0),
1591 "Constructor", "");
d14a1e28
RD
1592};
1593
1594
1595//---------------------------------------------------------------------------
1596%newgroup;
1597
e47ce385
RD
1598DocStr(wxMenuEvent,
1599"This class is used for a variety of menu-related events. Note that
1600these do not include menu command events, which are handled by sending
1601`wx.CommandEvent` objects.
1602
1603The default handler for wx.EVT_MENU_HIGHLIGHT displays menu item help
1604text in the first field of the status bar.", "
1605
1606Events
1607-------
1608 ========================= ==========================================
1609 wx.EVT_MENU_OPEN A menu is about to be opened. On Windows,
1610 this is only sent once for each navigation
1611 of the menubar (up until all menus have closed).
1612 wx.EVT_MENU_CLOSE A menu has been just closed.
1613 wx.EVT_MENU_HIGHLIGHT Sent when the menu item with the specified id
1614 has been highlighted: used by default to show
1615 help prompts in the `wx.Frame`'s status bar.
1616 wx.EVT_MENU_HIGHLIGHT_ALL Can be used to catch the menu highlight
1617 event for all menu items.
1618 ========================= ==========================================
1619");
1620
d14a1e28
RD
1621class wxMenuEvent : public wxEvent
1622{
1623public:
e47ce385
RD
1624 DocCtorStr(
1625 wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL),
1626 "Constructor", "");
1627
1628 DocDeclStr(
1629 int , GetMenuId() const,
1630 "Returns the menu identifier associated with the event. This method
1631should be only used with the HIGHLIGHT events.", "");
d14a1e28 1632
d14a1e28 1633
e47ce385
RD
1634 DocDeclStr(
1635 bool , IsPopup() const,
1636 "Returns ``True`` if the menu which is being opened or closed is a
1637popup menu, ``False`` if it is a normal one. This method should only
1638be used with the OPEN and CLOSE events.", "");
1639
d14a1e28 1640
e47ce385
RD
1641 DocDeclStr(
1642 wxMenu* , GetMenu() const,
1643 "Returns the menu which is being opened or closed. This method should
1644only be used with the OPEN and CLOSE events.", "");
1645
d14a1e28
RD
1646};
1647
1648//---------------------------------------------------------------------------
1649%newgroup;
1650
e47ce385
RD
1651DocStr(wxCloseEvent,
1652"This event class contains information about window and session close
1653events.
1654
1655The handler function for EVT_CLOSE is called when the user has tried
1656to close a a frame or dialog box using the window manager controls or
1657the system menu. It can also be invoked by the application itself
1658programmatically, for example by calling the `wx.Window.Close`
1659function.
1660
1661You should check whether the application is forcing the deletion of
1662the window using `CanVeto`. If it returns ``False``, you must destroy
1663the window using `wx.Window.Destroy`. If the return value is ``True``,
1664it is up to you whether you respond by destroying the window or not.
1665For example you may wish to display a message dialog prompting to save
1666files or to cancel the close.
1667
1668If you don't destroy the window, you should call `Veto` to let the
1669calling code know that you did not destroy the window. This allows the
1670`wx.Window.Close` function to return ``True`` or ``False`` depending
1671on whether the close instruction was honored or not.", "
1672
1673Events
1674-------
1675 ========================= ==========================================
1676 wx.EVT_CLOSE This event is sent to a top-level window
1677 when it has been requested to close either
1678 from the user or programatically.
1679 wx.EVT_QUERY_END_SESSION This event is sent to the `wx.App` when the
1680 system is about to be logged off, giving the
1681 app a chance to veto the shutdown.
1682 wx.EVT_END_SESSION This event is sent to the `wx.App` when the
1683 system is being logged off.
1684 ========================= ==========================================
1685");
1686
d14a1e28
RD
1687class wxCloseEvent : public wxEvent
1688{
1689public:
e47ce385
RD
1690 DocCtorStr(
1691 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0),
1692 "Constructor.", "");
1693
1694 DocDeclStr(
1695 void , SetLoggingOff(bool logOff),
1696 "Sets the 'logging off' flag.", "");
1697
1698 DocDeclStr(
1699 bool , GetLoggingOff() const,
6c75a4cf
RD
1700 "Returns ``True`` if the user is logging off or ``False`` if the
1701system is shutting down. This method can only be called for end
1702session and query end session events, it doesn't make sense for close
1703window event.", "");
d14a1e28 1704
d14a1e28 1705
e47ce385
RD
1706 DocDeclStr(
1707 void , Veto(bool veto = true),
1708 "Call this from your event handler to veto a system shutdown or to
1709signal to the calling application that a window close did not happen.
1710
1711You can only veto a shutdown or close if `CanVeto` returns true.", "");
d14a1e28 1712
d14a1e28 1713 bool GetVeto() const;
e47ce385
RD
1714
1715 DocDeclStr(
1716 void , SetCanVeto(bool canVeto),
1717 "Sets the 'can veto' flag.", "");
1718
1719 DocDeclStr(
1720 bool , CanVeto() const,
1721 "Returns true if you can veto a system shutdown or a window close
1722event. Vetoing a window close event is not possible if the calling
1723code wishes to force the application to exit, and so this function
1724must be called to check this.", "");
1725
d14a1e28
RD
1726};
1727
1728
1729//---------------------------------------------------------------------------
1730%newgroup;
1731
e47ce385
RD
1732DocStr(wxShowEvent,
1733"An EVT_SHOW event is sent when a window is shown or hidden.", "");
1734
d14a1e28
RD
1735class wxShowEvent : public wxEvent
1736{
1737public:
a72f4631 1738 wxShowEvent(int winid = 0, bool show = false);
d14a1e28
RD
1739
1740 void SetShow(bool show);
1741 bool GetShow() const;
1742
1743};
1744
1745
1746//---------------------------------------------------------------------------
1747%newgroup;
1748
e47ce385
RD
1749DocStr(wxIconizeEvent,
1750"An EVT_ICONIZE event is sent when a frame is iconized (minimized) or
1751restored.", "");
1752
d14a1e28
RD
1753class wxIconizeEvent: public wxEvent
1754{
1755public:
a72f4631 1756 wxIconizeEvent(int id = 0, bool iconized = true);
e47ce385
RD
1757
1758 DocDeclStr(
1759 bool , Iconized(),
1760 "Returns ``True`` if the frame has been iconized, ``False`` if it has
1761been restored.", "");
1762
d14a1e28
RD
1763};
1764
1765
1766//---------------------------------------------------------------------------
1767%newgroup;
1768
e47ce385
RD
1769DocStr(wxMaximizeEvent,
1770"An EVT_MAXIMIZE event is sent when a frame is maximized or restored.", "");
1771
d14a1e28
RD
1772class wxMaximizeEvent: public wxEvent
1773{
1774public:
1775 wxMaximizeEvent(int id = 0);
1776};
1777
1778//---------------------------------------------------------------------------
1779%newgroup;
1780
e47ce385
RD
1781DocStr(wxDropFilesEvent,
1782"This class is used for drop files events, that is, when files have
1783been dropped onto the window. This functionality is only available
1784under Windows. The window must have previously been enabled for
1785dropping by calling `wx.Window.DragAcceptFiles`.
1786
1787Important note: this is a separate implementation to the more general
1788drag and drop implementation using `wx.FileDropTarget`, and etc. This
1789implementation uses the older, Windows message-based approach of
1790dropping files.
1791
1792Use wx.EVT_DROP_FILES to bind an event handler to receive file drop
1793events.
1794", "");
1795
d14a1e28
RD
1796class wxDropFilesEvent: public wxEvent
1797{
1798public:
e47ce385
RD
1799
1800 // TODO: wrap the ctor!
1801
1802
1803 DocDeclStr(
1804 wxPoint , GetPosition(),
1805 "Returns the position at which the files were dropped.", "");
1806
1807 DocDeclStr(
1808 int , GetNumberOfFiles(),
1809 "Returns the number of files dropped.", "");
1810
d14a1e28
RD
1811
1812 %extend {
e47ce385
RD
1813 DocStr(
1814 GetFiles,
1815 "Returns a list of the filenames that were dropped.", "");
1816
d14a1e28
RD
1817 PyObject* GetFiles() {
1818 int count = self->GetNumberOfFiles();
1819 wxString* files = self->GetFiles();
e47ce385 1820 wxPyBlock_t blocked = wxPyBeginBlockThreads();
d14a1e28
RD
1821 PyObject* list = PyList_New(count);
1822
1823 if (!list) {
1824 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
e47ce385 1825 wxPyEndBlockThreads(blocked);
d14a1e28
RD
1826 return NULL;
1827 }
1828
1829 for (int i=0; i<count; i++) {
1fc9204a 1830 PyList_SetItem(list, i, wx2PyString(files[i]));
d14a1e28 1831 }
e47ce385 1832 wxPyEndBlockThreads(blocked);
d14a1e28
RD
1833 return list;
1834 }
1835 }
1836};
1837
1838
1839
1840//---------------------------------------------------------------------------
1841%newgroup;
1842
1843
d14a1e28
RD
1844enum wxUpdateUIMode
1845{
d14a1e28 1846 wxUPDATE_UI_PROCESS_ALL,
d14a1e28
RD
1847 wxUPDATE_UI_PROCESS_SPECIFIED
1848};
1849
64e8a1f0 1850
e47ce385
RD
1851DocStr(wxUpdateUIEvent,
1852"This class is used for EVT_UPDATE_UI pseudo-events which are sent by
1853wxWidgets to give an application the chance to update various user
1854interface elements.
1855
1856Without update UI events, an application has to work hard to
1857check/uncheck, enable/disable, and set the text for elements such as
1858menu items and toolbar buttons. The code for doing this has to be
1859mixed up with the code that is invoked when an action is invoked for a
1860menu item or button.
1861
1862With update UI events, you define an event handler to look at the
1863state of the application and change UI elements accordingly. wxWidgets
1864will call your handler functions in idle time, so you don't have to
1865worry where to call this code. In addition to being a clearer and more
1866declarative method, it also means you don't have to worry whether
1867you're updating a toolbar or menubar identifier. The same handler can
1868update a menu item and toolbar button, if the ID values are the same.
1869
1870Instead of directly manipulating the menu or button, you call
1871functions in the event object, such as `Check`. wxWidgets will
1872determine whether such a call has been made, and which UI element to
1873update.
1874
1875These events will work for popup menus as well as menubars. Just
1876before a menu is popped up, `wx.Menu.UpdateUI` is called to process
1877any UI events for the window that owns the menu.
1878
1879If you find that the overhead of UI update processing is affecting
1880your application, you can do one or both of the following:
1881
1882 1. Call `wx.UpdateUIEvent.SetMode` with a value of
1883 wx.UPDATE_UI_PROCESS_SPECIFIED, and set the extra style
1884 wx.WS_EX_PROCESS_UPDATE_EVENTS for every window that should
1885 receive update events. No other windows will receive update
1886 events.
1887
1888 2. Call `wx.UpdateUIEvent.SetUpdateInterval` with a millisecond
1889 value to set the delay between updates. You may need to call
1890 `wx.Window.UpdateWindowUI` at critical points, for example when
1891 a dialog is about to be shown, in case the user sees a slight
1892 delay before windows are updated.
1893
1894Note that although events are sent in idle time, defining a EVT_IDLE
1895handler for a window does not affect this because the events are sent
1896from an internal idle handler.
1897
1898wxWidgets tries to optimize update events on some platforms. On
1899Windows and GTK+, events for menubar items are only sent when the menu
1900is about to be shown, and not in idle time.
1901", "");
64e8a1f0 1902
d14a1e28
RD
1903class wxUpdateUIEvent : public wxCommandEvent
1904{
1905public:
e47ce385
RD
1906 DocCtorStr(
1907 wxUpdateUIEvent(wxWindowID commandId = 0),
1908 "Constructor", "");
1909
1910 DocDeclStr(
1911 bool , GetChecked() const,
1912 "Returns ``True`` if the UI element should be checked.", "");
1913
1914 DocDeclStr(
1915 bool , GetEnabled() const,
1916 "Returns ``True`` if the UI element should be enabled.", "");
d14a1e28 1917
e47ce385
RD
1918 DocDeclStr(
1919 wxString , GetText() const,
1920 "Returns the text that should be set for the UI element.", "");
1921
1922 DocDeclStr(
1923 bool , GetSetText() const,
1924 "Returns ``True`` if the application has called `SetText`. For
1925wxWidgets internal use only.", "");
1926
1927 DocDeclStr(
1928 bool , GetSetChecked() const,
1929 "Returns ``True`` if the application has called `Check`. For wxWidgets
1930internal use only.", "");
1931
1932 DocDeclStr(
1933 bool , GetSetEnabled() const,
1934 "Returns ``True`` if the application has called `Enable`. For wxWidgets
1935internal use only.", "");
1936
1937
d14a1e28 1938
e47ce385
RD
1939 DocDeclStr(
1940 void , Check(bool check),
1941 "Check or uncheck the UI element.", "");
1942
1943 DocDeclStr(
1944 void , Enable(bool enable),
1945 "Enable or disable the UI element.", "");
1946
1947 DocDeclStr(
1948 void , SetText(const wxString& text),
1949 "Sets the text for this UI element.", "");
1950
1951
1952
1953 DocDeclStr(
1954 static void , SetUpdateInterval(long updateInterval),
1955 "Sets the interval between updates in milliseconds. Set to -1 to
1956disable updates, or to 0 to update as frequently as possible. The
1957default is 0.
d14a1e28 1958
e47ce385
RD
1959Use this to reduce the overhead of UI update events if your
1960application has a lot of windows. If you set the value to -1 or
1961greater than 0, you may also need to call `wx.Window.UpdateWindowUI`
1962at appropriate points in your application, such as when a dialog is
1963about to be shown.", "");
1964
d14a1e28 1965
e47ce385
RD
1966 DocDeclStr(
1967 static long , GetUpdateInterval(),
1968 "Returns the current interval between updates in milliseconds. -1
1969disables updates, 0 updates as frequently as possible.", "");
1970
d14a1e28 1971
e47ce385
RD
1972 DocDeclStr(
1973 static bool , CanUpdate(wxWindow *win),
1974 "Returns ``True`` if it is appropriate to update (send UI update events
1975to) this window.
1976
1977This function looks at the mode used (see `wx.UpdateUIEvent.SetMode`),
1978the wx.WS_EX_PROCESS_UPDATE_EVENTS flag in window, the time update
1979events were last sent in idle time, and the update interval, to
1980determine whether events should be sent to this window now. By default
1981this will always return true because the update mode is initially
1982wx.UPDATE_UI_PROCESS_ALL and the interval is set to 0; so update
1983events will be sent as often as possible. You can reduce the frequency
1984that events are sent by changing the mode and/or setting an update
1985interval.
1986", "");
1987
d14a1e28 1988
e47ce385
RD
1989 DocDeclStr(
1990 static void , ResetUpdateTime(),
1991 "Used internally to reset the last-updated time to the current time. It
1992is assumed that update events are normally sent in idle time, so this
1993is called at the end of idle processing.", "");
1994
d14a1e28 1995
e47ce385
RD
1996 DocDeclStr(
1997 static void , SetMode(wxUpdateUIMode mode),
1998 "Specify how wxWidgets will send update events: to all windows, or only
1999to those which specify that they will process the events.
2000
2001The mode may be one of the following values:
2002
2003 ============================= ==========================================
2004 wxUPDATE_UI_PROCESS_ALL Send UI update events to all windows. This
2005 is the default setting.
2006 wxUPDATE_UI_PROCESS_SPECIFIED Send UI update events only to windows that
2007 have the wx.WS_EX_PROCESS_UI_UPDATES extra
2008 style set.
2009 ============================= ==========================================
2010", "");
2011
d14a1e28 2012
e47ce385
RD
2013 DocDeclStr(
2014 static wxUpdateUIMode , GetMode(),
2015 "Returns a value specifying how wxWidgets will send update events: to
2016all windows, or only to those which specify that they will process the
2017events.", "");
2018
d14a1e28
RD
2019};
2020
d14a1e28
RD
2021//---------------------------------------------------------------------------
2022%newgroup;
2023
e47ce385
RD
2024DocStr(wxSysColourChangedEvent,
2025"This class is used for EVT_SYS_COLOUR_CHANGED, which are generated
2026when the user changes the colour settings using the control
2027panel. This is only applicable under Windows.
2028
2029The default event handler for this event propagates the event to child
2030windows, since Windows only sends the events to top-level windows. If
2031intercepting this event for a top-level window, remember to call
2032`Skip` so the the base class handler will still be executed, or to
2033pass the event on to the window's children explicitly.
2034", "");
2035
d14a1e28
RD
2036class wxSysColourChangedEvent: public wxEvent {
2037public:
e47ce385
RD
2038 DocCtorStr(
2039 wxSysColourChangedEvent(),
2040 "Constructor", "");
d14a1e28
RD
2041};
2042
2043//---------------------------------------------------------------------------
2044%newgroup;
2045
2046
e47ce385
RD
2047DocStr(wxMouseCaptureChangedEvent,
2048"An mouse capture changed event (EVT_MOUSE_CAPTURE_CHANGED) is sent to
2049a window that loses its mouse capture. This is called even if
2050`wx.Window.ReleaseMouse` was called by the application code. Handling
2051this event allows an application to cater for unexpected capture
2052releases which might otherwise confuse mouse handling code.
2053
2054This event is implemented under Windows only.", "");
2055
d14a1e28
RD
2056class wxMouseCaptureChangedEvent : public wxEvent
2057{
2058public:
e47ce385
RD
2059 DocCtorStr(
2060 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL),
2061 "Constructor", "");
d14a1e28 2062
e47ce385
RD
2063 DocDeclStr(
2064 wxWindow* , GetCapturedWindow() const,
2065 "Returns the window that gained the capture, or ``None`` if it was a
2066non-wxWidgets window.", "");
2067
d14a1e28
RD
2068};
2069
2070//---------------------------------------------------------------------------
2071%newgroup;
2072
e47ce385
RD
2073DocStr(wxDisplayChangedEvent,
2074"An EVT_DISPLAY_CHANGED event is sent to all windows when the display
2075resolution has changed.
2076
2077This event is implemented under Windows only.", "");
2078
d14a1e28
RD
2079class wxDisplayChangedEvent : public wxEvent
2080{
2081public:
e47ce385
RD
2082 DocCtorStr(
2083 wxDisplayChangedEvent(),
2084 "", "");
d14a1e28
RD
2085};
2086
2087//---------------------------------------------------------------------------
2088%newgroup;
2089
e47ce385
RD
2090DocStr(wxPaletteChangedEvent,
2091"An EVT_PALETTE_CHANGED event is sent when the system palette has
2092changed, thereby giving each window a chance to redo their own to
2093match.
2094
2095This event is implemented under Windows only.", "");
2096
d14a1e28
RD
2097class wxPaletteChangedEvent : public wxEvent
2098{
2099public:
2100 wxPaletteChangedEvent(wxWindowID id = 0);
2101
2102 void SetChangedWindow(wxWindow* win);
2103 wxWindow* GetChangedWindow();
2104
2105};
2106
2107//---------------------------------------------------------------------------
2108%newgroup;
2109
e47ce385
RD
2110DocStr(wxQueryNewPaletteEvent,
2111 "An EVT_QUERY_NEW_PALETE event indicates the window is getting keyboard
2112focus and should re-do its palette.
2113
2114This event is implemented under Windows only.", "");
d14a1e28 2115
d14a1e28
RD
2116class wxQueryNewPaletteEvent : public wxEvent
2117{
2118public:
e47ce385
RD
2119 DocCtorStr(
2120 wxQueryNewPaletteEvent(wxWindowID winid = 0),
2121 "Constructor.", "");
d14a1e28 2122
e47ce385
RD
2123 DocDeclStr(
2124 void , SetPaletteRealized(bool realized),
2125 "App should set this if it changes the palette.", "");
2126
d14a1e28
RD
2127 bool GetPaletteRealized() const;
2128};
2129
2130//---------------------------------------------------------------------------
2131%newgroup;
2132
2133
e47ce385
RD
2134
2135DocStr(wxNavigationKeyEvent,
2136"EVT_NAVIGATION_KEY events are used to control moving the focus between
2137widgets, otherwise known as tab-traversal. You woudl normally not
2138catch navigation events in applications as there are already
2139appropriate handlers in `wx.Dialog` and `wx.Panel`, but you may find
2140it useful to send navigation events in certain situations to change
2141the focus in certain ways, although it's probably easier to just call
2142`wx.Window.Navigate`.", "");
d14a1e28
RD
2143
2144class wxNavigationKeyEvent : public wxEvent
2145{
2146public:
e47ce385
RD
2147 DocCtorStr(
2148 wxNavigationKeyEvent(),
2149 "", "");
2150
2151 DocDeclStr(
2152 bool , GetDirection() const,
2153 "Returns ``True`` if the direction is forward, ``False`` otherwise.", "");
2154
2155 DocDeclStr(
2156 void , SetDirection(bool forward),
2157 "Specify the direction that the navigation should take. Usually the
2158difference between using Tab and Shift-Tab.", "");
d14a1e28 2159
d14a1e28 2160
e47ce385
RD
2161 DocDeclStr(
2162 bool , IsWindowChange() const,
2163 "Returns ``True`` if window change is allowed.", "");
2164
2165 DocDeclStr(
2166 void , SetWindowChange(bool ischange),
2167 "Specify if the navigation should be able to change parent windows.
2168For example, changing notebook pages, etc. This is usually implemented
2169by using Control-Tab.", "");
2170
d14a1e28 2171
e47ce385
RD
2172 DocDeclStr(
2173 bool , IsFromTab() const,
2174 "Returns ``True`` if the navigation event is originated from the Tab
2175key.", "");
2176
2177 DocDeclStr(
2178 void , SetFromTab(bool bIs),
2179 "Set to true under MSW if the event was generated using the tab key.
2180This is required for proper navogation over radio buttons.", "");
2181
b7189025 2182
e47ce385
RD
2183 DocDeclStr(
2184 void , SetFlags(long flags),
2185 "Set the navigation flags to a combination of the following:
2186
2187 * wx.NavigationKeyEvent.IsBackward
2188 * wx.NavigationKeyEvent.IsForward
2189 * wx.NavigationKeyEvent.WinChange
2190 * wx.NavigationKeyEvent.FromTab
2191", "");
2192
2193
2194 DocDeclStr(
2195 wxWindow* , GetCurrentFocus() const,
2196 "Returns the child window which currenty has the focus. May be
2197``None``.", "");
2198
2199 DocDeclStr(
2200 void , SetCurrentFocus(wxWindow *win),
2201 "Set the window that has the focus.", "");
3b74f194 2202
3b74f194
RD
2203
2204 enum {
5a319c5c 2205 IsBackward,
3b74f194 2206 IsForward,
b7189025
RD
2207 WinChange,
2208 FromTab
3b74f194 2209 };
d14a1e28
RD
2210};
2211
d14a1e28
RD
2212//---------------------------------------------------------------------------
2213%newgroup;
2214
e47ce385
RD
2215
2216DocStr(wxWindowCreateEvent,
2217 "The EVT_WINDOW_CREATE event is sent as soon as the window object (the
2218underlying GUI object) exists.", "");
d14a1e28
RD
2219
2220class wxWindowCreateEvent : public wxCommandEvent
2221{
2222public:
2223 wxWindowCreateEvent(wxWindow *win = NULL);
e47ce385
RD
2224
2225 DocDeclStr(
2226 wxWindow *, GetWindow() const,
2227 "Returns the window that this event refers to.", "");
2228
d14a1e28
RD
2229};
2230
e47ce385
RD
2231
2232DocStr(wxWindowDestroyEvent,
2233 "The EVT_WINDOW_DESTROY event is sent right before the window is
2234destroyed.", "");
d14a1e28
RD
2235class wxWindowDestroyEvent : public wxCommandEvent
2236{
2237public:
2238 wxWindowDestroyEvent(wxWindow *win = NULL);
e47ce385
RD
2239
2240 DocDeclStr(
2241 wxWindow *, GetWindow() const,
2242 "Returns the window that this event refers to.", "");
d14a1e28
RD
2243};
2244
2245
2246//---------------------------------------------------------------------------
2247%newgroup;
2248
e47ce385
RD
2249
2250DocStr(wxContextMenuEvent,
2251"This class is used for context menu events (EVT_CONTECT_MENU,) sent to
2252give the application a chance to show a context (popup) menu.", "");
d14a1e28
RD
2253
2254class wxContextMenuEvent : public wxCommandEvent
2255{
2256public:
e47ce385
RD
2257 DocCtorStr(
2258 wxContextMenuEvent(wxEventType type = wxEVT_NULL,
2259 wxWindowID winid = 0,
2260 const wxPoint& pt = wxDefaultPosition),
2261 "Constructor.", "");
d14a1e28
RD
2262
2263 // Position of event (in screen coordinates)
e47ce385
RD
2264 DocDeclStr(
2265 const wxPoint& , GetPosition() const,
2266 "Returns the position (in screen coordinants) at which the menu should
2267be shown.", "");
2268
2269
2270 DocDeclStr(
2271 void , SetPosition(const wxPoint& pos),
2272 "Sets the position at which the menu should be shown.", "");
2273
d14a1e28
RD
2274};
2275
2276//---------------------------------------------------------------------------
2277%newgroup;
2278
d14a1e28
RD
2279enum wxIdleMode
2280{
d14a1e28 2281 wxIDLE_PROCESS_ALL,
d14a1e28
RD
2282 wxIDLE_PROCESS_SPECIFIED
2283};
2284
64e8a1f0 2285
e47ce385
RD
2286DocStr(wxIdleEvent,
2287"This class is used for EVT_IDLE events, which are generated and sent
2288when the application *becomes* idle. In other words, the when the
2289event queue becomes empty then idle events are sent to all windows (by
2290default) and as long as none of them call `RequestMore` then there are
2291no more idle events until after the system event queue has some normal
2292events and then becomes empty again.
2293
2294By default, idle events are sent to all windows. If this is causing a
2295significant overhead in your application, you can call
2296`wx.IdleEvent.SetMode` with the value wx.IDLE_PROCESS_SPECIFIED, and
2297set the wx.WS_EX_PROCESS_IDLE extra window style for every window
2298which should receive idle events. Then idle events will only be sent
2299to those windows and not to any others.", "");
2300
d14a1e28
RD
2301class wxIdleEvent : public wxEvent
2302{
2303public:
e47ce385
RD
2304 DocCtorStr(
2305 wxIdleEvent(),
2306 "Constructor", "");
2307
2308
2309 DocDeclStr(
2310 void , RequestMore(bool needMore = true),
2311 "Tells wxWidgets that more processing is required. This function can be
2312called by an EVT_IDLE handler for a window to indicate that the
2313application should forward the EVT_IDLE event once more to the
2314application windows. If no window calls this function during its
2315EVT_IDLE handler, then the application will remain in a passive event
2316loop until a new event is posted to the application by the windowing
2317system.", "");
2318
2319 DocDeclStr(
2320 bool , MoreRequested() const,
2321 "Returns ``True`` if the OnIdle function processing this event
2322requested more processing time.", "");
2323
2324
2325 DocDeclStr(
2326 static void , SetMode(wxIdleMode mode),
2327 "Static method for specifying how wxWidgets will send idle events: to
2328all windows, or only to those which specify that they will process the
2329events.
2330
2331The mode can be one of the following values:
2332
2333 ========================= ========================================
2334 wx.IDLE_PROCESS_ALL Send idle events to all windows
2335 wx.IDLE_PROCESS_SPECIFIED Send idle events only to windows that have
2336 the wx.WS_EX_PROCESS_IDLE extra style
2337 flag set.
2338 ========================= ========================================
2339", "");
d14a1e28 2340
d14a1e28 2341
e47ce385
RD
2342 DocDeclStr(
2343 static wxIdleMode , GetMode(),
2344 "Static method returning a value specifying how wxWidgets will send
2345idle events: to all windows, or only to those which specify that they
2346will process the events.", "");
2347
d14a1e28 2348
e47ce385
RD
2349 DocDeclStr(
2350 static bool , CanSend(wxWindow* win),
2351 "Returns ``True`` if it is appropriate to send idle events to this
2352window.
d14a1e28 2353
e47ce385
RD
2354This function looks at the mode used (see `wx.IdleEvent.SetMode`), and
2355the wx.WS_EX_PROCESS_IDLE style in window to determine whether idle
2356events should be sent to this window now. By default this will always
2357return ``True`` because the update mode is initially
2358wx.IDLE_PROCESS_ALL. You can change the mode to only send idle events
2359to windows with the wx.WS_EX_PROCESS_IDLE extra window style set.", "");
2360
d14a1e28
RD
2361};
2362
2363//---------------------------------------------------------------------------
2364%newgroup;
2365
2366// These classes can be derived from in Python and passed through the event
2367// system without loosing anything. They do this by keeping a reference to
2368// themselves and some special case handling in wxPyCallback::EventThunker.
2369
e47ce385
RD
2370DocStr(wxPyEvent,
2371"wx.PyEvent can be used as a base class for implementing custom event
2372types in Python. You should derived from this class instead of
2373`wx.Event` because this class is Python-aware and is able to transport
2374its Python bits safely through the wxWidgets event system and have
2375them still be there when the event handler is invoked.
2376
2377:see: `wx.PyCommandEvent`
2378", "");
2379
d14a1e28
RD
2380class wxPyEvent : public wxEvent {
2381public:
e47ce385
RD
2382 %pythonAppend wxPyEvent "self._SetSelf(self)"
2383 DocCtorStr(
2384 wxPyEvent(int winid=0, wxEventType eventType = wxEVT_NULL ),
2385 "", "");
2386
d14a1e28
RD
2387 ~wxPyEvent();
2388
2389
e47ce385
RD
2390 %Rename(_SetSelf, void , SetSelf(PyObject* self));
2391 %Rename(_GetSelf, PyObject* , GetSelf());
d14a1e28
RD
2392};
2393
2394
e47ce385
RD
2395
2396DocStr(wxPyCommandEvent,
2397"wx.PyCommandEvent can be used as a base class for implementing custom
2398event types in Python, where the event shoudl travel up to parent
2399windows looking for a handler. You should derived from this class
2400instead of `wx.CommandEvent` because this class is Python-aware and is
2401able to transport its Python bits safely through the wxWidgets event
2402system and have them still be there when the event handler is invoked.
2403
2404:see: `wx.PyEvent`
2405", "");
2406
d14a1e28
RD
2407class wxPyCommandEvent : public wxCommandEvent {
2408public:
e47ce385
RD
2409 %pythonAppend wxPyCommandEvent "self._SetSelf(self)"
2410
2411 DocCtorStr(
2412 wxPyCommandEvent(wxEventType eventType = wxEVT_NULL, int id=0),
2413 "", "");
2414
d14a1e28
RD
2415 ~wxPyCommandEvent();
2416
e47ce385
RD
2417 %Rename(_SetSelf, void , SetSelf(PyObject* self));
2418 %Rename(_GetSelf, PyObject* , GetSelf());
d14a1e28
RD
2419};
2420
2421
2422
2423//---------------------------------------------------------------------------
2424
2425
e47ce385
RD
2426DocStr(wxDateEvent,
2427"This event class holds information about a date change event and is
2428used together with `wx.DatePickerCtrl`. It also serves as a base class
2429for `wx.calendar.CalendarEvent`. Bind these event types with
2430EVT_DATE_CHANGED.", "");
2431
b3b61cda
RD
2432class wxDateEvent : public wxCommandEvent
2433{
2434public:
e47ce385
RD
2435 DocCtorStr(
2436 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type),
2437 "", "");
b3b61cda 2438
e47ce385
RD
2439 DocDeclStr(
2440 const wxDateTime& , GetDate() const,
2441 "Returns the date.", "");
2442
2443 DocDeclStr(
2444 void , SetDate(const wxDateTime &date),
2445 "Sets the date carried by the event, normally only used by the library
2446internally.", "");
2447
b3b61cda
RD
2448
2449};
2450
d14a1e28 2451
b3b61cda
RD
2452%constant wxEventType wxEVT_DATE_CHANGED;
2453
2454%pythoncode {
2455 EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
2456}
2457
2458
2459//---------------------------------------------------------------------------