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