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