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