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