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