]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_event.i
AdjustScrollbars can go into an infinite loop, so bail out after a few
[wxWidgets.git] / wxPython / src / _event.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _event.i
3// Purpose: SWIG interface for common event classes and event binders
4//
5// Author: Robin Dunn
6//
7// Created: 24-May-1998
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17// Include some extra python code here
18%pythoncode "_event_ex.py"
19
20//---------------------------------------------------------------------------
21%newgroup;
22
23// the predefined constants for the number of times we propagate event
24// upwards window child-parent chain
25enum Propagation_state
26{
27 // don't propagate it at all
28 wxEVENT_PROPAGATE_NONE = 0,
29
30 // propagate it until it is processed
31 wxEVENT_PROPAGATE_MAX = INT_MAX
32};
33
34
35//---------------------------------------------------------------------------
36// Event types
37
38wxEventType wxNewEventType();
39
40
41%constant wxEventType wxEVT_NULL;
42%constant wxEventType wxEVT_FIRST;
43%constant wxEventType wxEVT_USER_FIRST;
44
45%constant wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
46%constant wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
47%constant wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
48%constant wxEventType wxEVT_COMMAND_LISTBOX_SELECTED;
49%constant wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
50%constant wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
51
52%constant wxEventType wxEVT_COMMAND_MENU_SELECTED;
53%constant wxEventType wxEVT_COMMAND_TOOL_CLICKED;
54%constant wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
55%constant wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
56%constant wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
57
58%constant wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED;
59%constant wxEventType wxEVT_COMMAND_VLBOX_SELECTED;
60%constant wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED;
61%constant wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
62%constant wxEventType wxEVT_COMMAND_TOOL_ENTER;
63
64// Mouse event types
65%constant wxEventType wxEVT_LEFT_DOWN;
66%constant wxEventType wxEVT_LEFT_UP;
67%constant wxEventType wxEVT_MIDDLE_DOWN;
68%constant wxEventType wxEVT_MIDDLE_UP;
69%constant wxEventType wxEVT_RIGHT_DOWN;
70%constant wxEventType wxEVT_RIGHT_UP;
71%constant wxEventType wxEVT_MOTION;
72%constant wxEventType wxEVT_ENTER_WINDOW;
73%constant wxEventType wxEVT_LEAVE_WINDOW;
74%constant wxEventType wxEVT_LEFT_DCLICK;
75%constant wxEventType wxEVT_MIDDLE_DCLICK;
76%constant wxEventType wxEVT_RIGHT_DCLICK;
77%constant wxEventType wxEVT_SET_FOCUS;
78%constant wxEventType wxEVT_KILL_FOCUS;
79%constant wxEventType wxEVT_CHILD_FOCUS;
80%constant wxEventType wxEVT_MOUSEWHEEL;
81
82// Non-client mouse events
83%constant wxEventType wxEVT_NC_LEFT_DOWN;
84%constant wxEventType wxEVT_NC_LEFT_UP;
85%constant wxEventType wxEVT_NC_MIDDLE_DOWN;
86%constant wxEventType wxEVT_NC_MIDDLE_UP;
87%constant wxEventType wxEVT_NC_RIGHT_DOWN;
88%constant wxEventType wxEVT_NC_RIGHT_UP;
89%constant wxEventType wxEVT_NC_MOTION;
90%constant wxEventType wxEVT_NC_ENTER_WINDOW;
91%constant wxEventType wxEVT_NC_LEAVE_WINDOW;
92%constant wxEventType wxEVT_NC_LEFT_DCLICK;
93%constant wxEventType wxEVT_NC_MIDDLE_DCLICK;
94%constant wxEventType wxEVT_NC_RIGHT_DCLICK;
95
96// Character input event type
97%constant wxEventType wxEVT_CHAR;
98%constant wxEventType wxEVT_CHAR_HOOK;
99%constant wxEventType wxEVT_NAVIGATION_KEY;
100%constant wxEventType wxEVT_KEY_DOWN;
101%constant wxEventType wxEVT_KEY_UP;
102%constant wxEventType wxEVT_HOTKEY;
103
104// Set cursor event
105%constant wxEventType wxEVT_SET_CURSOR;
106
107// wxScrollBar and wxSlider event identifiers
108%constant wxEventType wxEVT_SCROLL_TOP;
109%constant wxEventType wxEVT_SCROLL_BOTTOM;
110%constant wxEventType wxEVT_SCROLL_LINEUP;
111%constant wxEventType wxEVT_SCROLL_LINEDOWN;
112%constant wxEventType wxEVT_SCROLL_PAGEUP;
113%constant wxEventType wxEVT_SCROLL_PAGEDOWN;
114%constant wxEventType wxEVT_SCROLL_THUMBTRACK;
115%constant wxEventType wxEVT_SCROLL_THUMBRELEASE;
116%constant wxEventType wxEVT_SCROLL_ENDSCROLL;
117
118// Scroll events from wxWindow
119%constant wxEventType wxEVT_SCROLLWIN_TOP;
120%constant wxEventType wxEVT_SCROLLWIN_BOTTOM;
121%constant wxEventType wxEVT_SCROLLWIN_LINEUP;
122%constant wxEventType wxEVT_SCROLLWIN_LINEDOWN;
123%constant wxEventType wxEVT_SCROLLWIN_PAGEUP;
124%constant wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
125%constant wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
126%constant wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
127
128// System events
129%constant wxEventType wxEVT_SIZE;
130%constant wxEventType wxEVT_MOVE;
131%constant wxEventType wxEVT_CLOSE_WINDOW;
132%constant wxEventType wxEVT_END_SESSION;
133%constant wxEventType wxEVT_QUERY_END_SESSION;
134%constant wxEventType wxEVT_ACTIVATE_APP;
135%constant wxEventType wxEVT_POWER;
136%constant wxEventType wxEVT_ACTIVATE;
137%constant wxEventType wxEVT_CREATE;
138%constant wxEventType wxEVT_DESTROY;
139%constant wxEventType wxEVT_SHOW;
140%constant wxEventType wxEVT_ICONIZE;
141%constant wxEventType wxEVT_MAXIMIZE;
142%constant wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
143%constant wxEventType wxEVT_PAINT;
144%constant wxEventType wxEVT_ERASE_BACKGROUND;
145%constant wxEventType wxEVT_NC_PAINT;
146%constant wxEventType wxEVT_PAINT_ICON;
147%constant wxEventType wxEVT_MENU_OPEN;
148%constant wxEventType wxEVT_MENU_CLOSE;
149%constant wxEventType wxEVT_MENU_HIGHLIGHT;
150
151%constant wxEventType wxEVT_CONTEXT_MENU;
152%constant wxEventType wxEVT_SYS_COLOUR_CHANGED;
153%constant wxEventType wxEVT_DISPLAY_CHANGED;
154%constant wxEventType wxEVT_SETTING_CHANGED;
155%constant wxEventType wxEVT_QUERY_NEW_PALETTE;
156%constant wxEventType wxEVT_PALETTE_CHANGED;
157%constant wxEventType wxEVT_DROP_FILES;
158%constant wxEventType wxEVT_DRAW_ITEM;
159%constant wxEventType wxEVT_MEASURE_ITEM;
160%constant wxEventType wxEVT_COMPARE_ITEM;
161%constant wxEventType wxEVT_INIT_DIALOG;
162%constant wxEventType wxEVT_IDLE;
163%constant wxEventType wxEVT_UPDATE_UI;
164%constant wxEventType wxEVT_SIZING;
165%constant wxEventType wxEVT_MOVING;
2d672d17
RD
166%constant wxEventType wxEVT_HIBERNATE;
167
d14a1e28
RD
168
169// Generic command events
170// Note: a click is a higher-level event than button down/up
171%constant wxEventType wxEVT_COMMAND_LEFT_CLICK;
172%constant wxEventType wxEVT_COMMAND_LEFT_DCLICK;
173%constant wxEventType wxEVT_COMMAND_RIGHT_CLICK;
174%constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
175%constant wxEventType wxEVT_COMMAND_SET_FOCUS;
176%constant wxEventType wxEVT_COMMAND_KILL_FOCUS;
177%constant wxEventType wxEVT_COMMAND_ENTER;
178
179
180
181%pythoncode {
182%#
183%# Create some event binders
184EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
185EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
186EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
187EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
188EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
189EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
190EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
191EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
192EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
193EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
194EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
195EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
196EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
197EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
198EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
199EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
200EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
201EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
202EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
203EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
204EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
205EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
206EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
207EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
2d672d17 208EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE )
d14a1e28
RD
209EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
210EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
211EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
212EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
213EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
214EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
215EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
216EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
217EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
218EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
219EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
220EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
221EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
222EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
223EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
224EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
225
226EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
227EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
228EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
229EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
230EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
231EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
232EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
233EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
234EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
235EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
236EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
237EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
238EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
239
240EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN,
241 wxEVT_LEFT_UP,
242 wxEVT_MIDDLE_DOWN,
243 wxEVT_MIDDLE_UP,
244 wxEVT_RIGHT_DOWN,
245 wxEVT_RIGHT_UP,
246 wxEVT_MOTION,
247 wxEVT_LEFT_DCLICK,
248 wxEVT_MIDDLE_DCLICK,
249 wxEVT_RIGHT_DCLICK,
250 wxEVT_ENTER_WINDOW,
251 wxEVT_LEAVE_WINDOW,
252 wxEVT_MOUSEWHEEL
253 ])
254
255
256%# Scrolling from wxWindow (sent to wxScrolledWindow)
257EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP,
258 wxEVT_SCROLLWIN_BOTTOM,
259 wxEVT_SCROLLWIN_LINEUP,
260 wxEVT_SCROLLWIN_LINEDOWN,
261 wxEVT_SCROLLWIN_PAGEUP,
262 wxEVT_SCROLLWIN_PAGEDOWN,
263 wxEVT_SCROLLWIN_THUMBTRACK,
264 wxEVT_SCROLLWIN_THUMBRELEASE,
265 ])
266
267EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
268EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
269EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
270EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
271EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
272EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
273EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
274EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
275
d5a7caf6 276%# Scrolling from wx.Slider and wx.ScrollBar
d14a1e28
RD
277EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
278 wxEVT_SCROLL_BOTTOM,
279 wxEVT_SCROLL_LINEUP,
280 wxEVT_SCROLL_LINEDOWN,
281 wxEVT_SCROLL_PAGEUP,
282 wxEVT_SCROLL_PAGEDOWN,
283 wxEVT_SCROLL_THUMBTRACK,
284 wxEVT_SCROLL_THUMBRELEASE,
285 wxEVT_SCROLL_ENDSCROLL,
286 ])
287
288EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
289EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
290EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
291EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
292EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
293EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
294EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
295EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
296EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL )
297
d5a7caf6 298%# Scrolling from wx.Slider and wx.ScrollBar, with an id
d14a1e28
RD
299EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP,
300 wxEVT_SCROLL_BOTTOM,
301 wxEVT_SCROLL_LINEUP,
302 wxEVT_SCROLL_LINEDOWN,
303 wxEVT_SCROLL_PAGEUP,
304 wxEVT_SCROLL_PAGEDOWN,
305 wxEVT_SCROLL_THUMBTRACK,
306 wxEVT_SCROLL_THUMBRELEASE,
307 wxEVT_SCROLL_ENDSCROLL,
308 ], 1)
309
310EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
311EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
312EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
313EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
314EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
315EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
316EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
317EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
318EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1)
319
d14a1e28
RD
320EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1)
321EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1)
322EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1)
323EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1)
324EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1)
325EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1)
326EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2)
327EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1)
328EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1)
329EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1)
330
331EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1)
332EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1)
333EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1)
334EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1)
335EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2)
336EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1)
337EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2)
338EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1)
339EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1)
340
341
342EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
343EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
344EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
345EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
346EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
347EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
348EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
349
350EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
351
352EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
353EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
354
355EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
356
357
358}
359
360//---------------------------------------------------------------------------
361%newgroup;
362
d5a7caf6
RD
363DocStr(wxEvent,
364"An event is a structure holding information about an event passed to a
365callback or member function. wx.Event is an abstract base class for
366other event classes", "");
367
d14a1e28
RD
368class wxEvent : public wxObject {
369public:
370 // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC
371 ~wxEvent();
372
d5a7caf6
RD
373 DocDeclStr(
374 void , SetEventType(wxEventType typ),
375 "Sets the specific type of the event.", "");
376
377 DocDeclStr(
378 wxEventType , GetEventType() const,
379 "Returns the identifier of the given event type, such as
380``wxEVT_COMMAND_BUTTON_CLICKED``.", "");
381
382 DocDeclStr(
383 wxObject *, GetEventObject() const,
384 "Returns the object (usually a window) associated with the event, if
385any.", "");
386
387 DocDeclStr(
388 void , SetEventObject(wxObject *obj),
389 "Sets the originating object, or in other words, obj is normally the
390object that is sending the event.", "");
391
d14a1e28
RD
392 long GetTimestamp() const;
393 void SetTimestamp(long ts = 0);
d5a7caf6
RD
394
395 DocDeclStr(
396 int , GetId() const,
397 "Returns the identifier associated with this event, such as a button
398command id.", "");
399
400 DocDeclStr(
401 void , SetId(int Id),
402 "Set's the ID for the event. This is usually the ID of the window that
403is sending the event, but it can also be a command id from a menu
404item, etc.", "");
405
d14a1e28
RD
406
407
d5a7caf6
RD
408 DocDeclStr(
409 bool , IsCommandEvent() const,
410 "Returns true if the event is or is derived from `wx.CommandEvent` else
411it returns false. Note: Exists only for optimization purposes.", "");
412
d14a1e28 413
31066066
RD
414 DocDeclStr(
415 void , Skip(bool skip = true),
416 "Called by an event handler, it controls whether additional event
417handlers bound to this event will be called after the current event
418handler returns. Skip(false) (the default setting) will prevent
419additional event handlers from being called and control will be
420returned to the sender of the event immediately after the current
421handler has finished. Skip(True) will cause the event processing
422system to continue searching for a handler function for this event.
423", "");
424
d5a7caf6
RD
425 DocDeclStr(
426 bool , GetSkipped() const,
427 "Returns true if the event handler should be skipped, false otherwise.
428:see: `Skip`", "");
429
d14a1e28 430
d5a7caf6
RD
431 DocDeclStr(
432 bool , ShouldPropagate() const,
433 "Test if this event should be propagated to the parent window or not,
434i.e. if the propagation level is currently greater than 0.", "");
435
d14a1e28
RD
436
437 // Stop an event from propagating to its parent window, returns the old
438 // propagation level value
d5a7caf6
RD
439 DocDeclStr(
440 int , StopPropagation(),
441 "Stop the event from propagating to its parent window. Returns the old
442propagation level value which may be later passed to
443`ResumePropagation` to allow propagating the event again.", "");
444
d14a1e28 445
d5a7caf6
RD
446 DocDeclStr(
447 void , ResumePropagation(int propagationLevel),
448 "Resume the event propagation by restoring the propagation level. (For
449example, you can use the value returned by an earlier call to
450`StopPropagation`.)
451", "");
452
d14a1e28
RD
453
454 // this function is used to create a copy of the event polymorphically and
455 // all derived classes must implement it because otherwise wxPostEvent()
456 // for them wouldn't work (it needs to do a copy of the event)
457 virtual wxEvent *Clone() /* =0*/;
458};
459
460
461//---------------------------------------------------------------------------
462%newgroup;
463
d5a7caf6
RD
464DocStr(wxPropagationDisabler,
465"Helper class to temporarily change an event not to propagate. Simply
466create an instance of this class and then whe it is destroyed the
467propogation of the event will be restored.", "");
d14a1e28
RD
468class wxPropagationDisabler
469{
470public:
471 wxPropagationDisabler(wxEvent& event);
472 ~wxPropagationDisabler();
473};
474
475
d5a7caf6
RD
476DocStr( wxPropagateOnce,
477"A helper class that will temporarily lower propagation level of an
478event. Simply create an instance of this class and then whe it is
479destroyed the propogation of the event will be restored.", "");
d14a1e28
RD
480class wxPropagateOnce
481{
482public:
483 wxPropagateOnce(wxEvent& event);
484 ~wxPropagateOnce();
485};
486
487//---------------------------------------------------------------------------
488%newgroup;
489
d5a7caf6
RD
490DocStr(wxCommandEvent,
491"This event class contains information about command events, which
492originate from a variety of simple controls, as well as menus and
493toolbars.", "");
494
d14a1e28
RD
495class wxCommandEvent : public wxEvent
496{
497public:
498 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
499
500
501// // Set/Get client data from controls
502// void SetClientData(void* clientData) { m_clientData = clientData; }
503// void *GetClientData() const { return m_clientData; }
504
505// // Set/Get client object from controls
506// void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
507// void *GetClientObject() const { return m_clientObject; }
508
509
d5a7caf6
RD
510 DocDeclStr(
511 int , GetSelection() const,
512 "Returns item index for a listbox or choice selection event (not valid
513for a deselection).", "");
514
d14a1e28 515
d14a1e28 516 void SetString(const wxString& s);
d5a7caf6
RD
517 DocDeclStr(
518 wxString , GetString() const,
519 "Returns item string for a listbox or choice selection event (not valid
520for a deselection).", "");
521
d14a1e28 522
d5a7caf6
RD
523 DocDeclStr(
524 bool , IsChecked() const,
525 "This method can be used with checkbox and menu events: for the
526checkboxes, the method returns true for a selection event and false
527for a deselection one. For the menu events, this method indicates if
528the menu item just has become checked or unchecked (and thus only
529makes sense for checkable menu items).", "");
530
61c5a8ac
RD
531 %pythoncode { Checked = IsChecked }
532
d5a7caf6
RD
533 DocDeclStr(
534 bool , IsSelection() const,
535 "For a listbox or similar event, returns true if it is a selection,
536false if it is a deselection.", "");
537
d14a1e28
RD
538
539 void SetExtraLong(long extraLong);
d5a7caf6
RD
540 DocDeclStr(
541 long , GetExtraLong() const,
542 "Returns extra information dependant on the event objects type. If the event
543comes from a listbox selection, it is a boolean determining whether the event
544was a selection (true) or a deselection (false). A listbox deselection only
545occurs for multiple-selection boxes, and in this case the index and string
546values are indeterminate and the listbox must be examined by the application.", "");
547
d14a1e28
RD
548
549 void SetInt(int i);
d5a7caf6
RD
550 DocDeclStr(
551 long , GetInt() const,
552 "Returns the integer identifier corresponding to a listbox, choice or radiobox
553selection (only if the event was a selection, not a deselection), or a boolean
554value representing the value of a checkbox.", "");
555
d14a1e28
RD
556
557 virtual wxEvent *Clone() const;
558
559};
560
561//---------------------------------------------------------------------------
562%newgroup;
563
d5a7caf6
RD
564DocStr(wxNotifyEvent,
565"An instance of this class (or one of its derived classes) is sent from
566a control when the control's state is being changed and the control
567allows that change to be prevented from happening. The event handler
568can call `Veto` or `Allow` to tell the control what to do.", "");
569
d14a1e28
RD
570class wxNotifyEvent : public wxCommandEvent
571{
572public:
573 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
574
d5a7caf6
RD
575 DocDeclStr(
576 void , Veto(),
577 "Prevents the change announced by this event from happening.
d14a1e28 578
d5a7caf6
RD
579It is in general a good idea to notify the user about the reasons for
580vetoing the change because otherwise the applications behaviour (which
581just refuses to do what the user wants) might be quite surprising.", "");
582
583
584 DocDeclStr(
585 void , Allow(),
586 "This is the opposite of `Veto`: it explicitly allows the event to be
587processed. For most events it is not necessary to call this method as
588the events are allowed anyhow but some are forbidden by default (this
589will be mentioned in the corresponding event description).", "");
590
d14a1e28 591
d5a7caf6
RD
592 DocDeclStr(
593 bool , IsAllowed(),
594 "Returns true if the change is allowed (`Veto` hasn't been called) or
595false otherwise (if it was).", "");
596
d14a1e28
RD
597};
598
599
600//---------------------------------------------------------------------------
601%newgroup;
602
d5a7caf6
RD
603DocStr(wxScrollEvent,
604"A scroll event holds information about events sent from stand-alone
605scrollbars and sliders. Note that scrolled windows do not send
606instnaces of this event class, but send the `wx.ScrollWinEvent`
607instead.", "
608
609Events
610-------
611 ======================= ==========================================
612 EVT_SCROLL Used to bind all scroll events
613 EVT_SCROLL_TOP scroll-to-top events (minimum position)
614 EVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position)
615 EVT_SCROLL_LINEUP line up events
616 EVT_SCROLL_LINEDOWN line down events
617 EVT_SCROLL_PAGEUP page up events
618 EVT_SCROLL_PAGEDOWN page down events
619 EVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
620 as the user drags the 'thumb')
621 EVT_SCROLL_THUMBRELEASE thumb release events.
622 EVT_SCROLL_ENDSCROLL End of scrolling
623 ======================= ==========================================
624
625Note
626------
627 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually
628 dragging the thumb using the mouse and releasing it (This
629 EVT_SCROLL_THUMBRELEASE event is also followed by an
630 EVT_SCROLL_ENDSCROLL event).
631
632 The EVT_SCROLL_ENDSCROLL event also occurs when using the keyboard
633 to change the thumb position, and when clicking next to the thumb
634 (In all these cases the EVT_SCROLL_THUMBRELEASE event does not
635 happen).
636
637 In short, the EVT_SCROLL_ENDSCROLL event is triggered when
638 scrolling/ moving has finished. The only exception (unfortunately)
639 is that changing the thumb position using the mousewheel does give
640 a EVT_SCROLL_THUMBRELEASE event but NOT an EVT_SCROLL_ENDSCROLL
641 event.
642");
643
d14a1e28
RD
644class wxScrollEvent : public wxCommandEvent
645{
646public:
d5a7caf6
RD
647 DocCtorStr(
648 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
649 int winid = 0, int pos = 0, int orient = 0),
650 "", "");
d14a1e28 651
d5a7caf6
RD
652 DocDeclStr(
653 int , GetOrientation() const,
654 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
655the scrollbar.", "");
656
657 DocDeclStr(
658 int , GetPosition() const,
659 "Returns the position of the scrollbar.", "");
660
d14a1e28
RD
661 void SetOrientation(int orient);
662 void SetPosition(int pos);
663};
664
665
666//---------------------------------------------------------------------------
667%newgroup;
668
d5a7caf6
RD
669DocStr(wxScrollWinEvent,
670"A wx.ScrollWinEvent holds information about scrolling and is sent from
671scrolling windows.", "
672
673Events
674-------
675 ========================== ==========================================
676 EVT_SCROLLWIN Used to bind all scrolled window scroll events
677 EVT_SCROLLWIN_TOP scroll-to-top events (minimum position)
678 EVT_SCROLLWIN_BOTTOM scroll-to-bottom events (maximum position)
679 EVT_SCROLLWIN_LINEUP line up events
680 EVT_SCROLLWIN_LINEDOWN line down events
681 EVT_SCROLLWIN_PAGEUP page up events
682 EVT_SCROLLWIN_PAGEDOWN page down events
683 EVT_SCROLLWIN_THUMBTRACK thumbtrack events (frequent events sent
684 as the user drags the 'thumb')
685 EVT_SCROLLWIN_THUMBRELEASE thumb release events.
686 EVT_SCROLLWIN_ENDSCROLL End of scrolling
687 ========================== ==========================================
688
689");
690
d14a1e28
RD
691class wxScrollWinEvent : public wxEvent
692{
693public:
694 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
695 int pos = 0, int orient = 0);
696
d5a7caf6
RD
697 DocDeclStr(
698 int , GetOrientation() const,
699 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
700the scrollbar.", "");
701
702 DocDeclStr(
703 int , GetPosition() const,
704 "Returns the position of the scrollbar for the thumb track and release
705events. Note that this field can't be used for the other events, you
706need to query the window itself for the current position in that case.", "");
707
d14a1e28
RD
708 void SetOrientation(int orient);
709 void SetPosition(int pos);
710};
711
712//---------------------------------------------------------------------------
713%newgroup;
714
d5a7caf6
RD
715
716DocStr(wxMouseEvent,
717"This event class contains information about the events generated by
718the mouse: they include mouse buttons press and release events and
719mouse move events.
720
721All mouse events involving the buttons use ``wx.MOUSE_BTN_LEFT`` for
722the left mouse button, ``wx.MOUSE_BTN_MIDDLE`` for the middle one and
723``wx.MOUSE_BTN_RIGHT`` for the right one. Note that not all mice have
724a middle button so a portable application should avoid relying on the
725events from it.
726
727Note the difference between methods like `LeftDown` and `LeftIsDown`:
728the former returns true when the event corresponds to the left mouse
729button click while the latter returns true if the left mouse button is
730currently being pressed. For example, when the user is dragging the
731mouse you can use `LeftIsDown` to test whether the left mouse button
732is (still) depressed. Also, by convention, if `LeftDown` returns true,
733`LeftIsDown` will also return true in wxWidgets whatever the
734underlying GUI behaviour is (which is platform-dependent). The same
735applies, of course, to other mouse buttons as well.", "
736
737Events
738-------
739 ================== ==============================================
740 EVT_LEFT_DOWN Left mouse button down event. The handler
741 of this event should normally call
742 event.Skip() to allow the default processing
743 to take place as otherwise the window under
744 mouse wouldn't get the focus.
745 EVT_LEFT_UP Left mouse button up event
746 EVT_LEFT_DCLICK Left mouse button double click event
747 EVT_MIDDLE_DOWN Middle mouse button down event
748 EVT_MIDDLE_UP Middle mouse button up event
749 EVT_MIDDLE_DCLICK Middle mouse button double click event
750 EVT_RIGHT_DOWN Right mouse button down event
751 EVT_RIGHT_UP Right mouse button up event
752 EVT_RIGHT_DCLICK Right mouse button double click event
753 EVT_MOTION Event sent when the mouse is moving
754 EVT_ENTER_WINDOW Event sent when the mouse enters the
755 boundaries of a window.
756 EVT_LEAVE_WINDOW Sent when the mouse leaves the window's bounds
757 EVT_MOUSEWHEEL Mouse scroll wheel event
758 EVT_MOUSE_EVENTS Binds all mouse events at once.
759 ================== ==============================================
760
761");
762
763
d14a1e28
RD
764// the symbolic names for the mouse buttons
765enum
766{
767 wxMOUSE_BTN_ANY = -1,
768 wxMOUSE_BTN_NONE = -1,
769 wxMOUSE_BTN_LEFT = 0,
770 wxMOUSE_BTN_MIDDLE = 1,
771 wxMOUSE_BTN_RIGHT = 2
772};
773
774
775// Mouse event class
776class wxMouseEvent : public wxEvent
777{
778public:
d5a7caf6
RD
779 DocCtorStr(
780 wxMouseEvent(wxEventType mouseType = wxEVT_NULL),
781"Constructs a wx.MouseEvent. Valid event types are:
782
783 * wxEVT_ENTER_WINDOW
784 * wxEVT_LEAVE_WINDOW
785 * wxEVT_LEFT_DOWN
786 * wxEVT_LEFT_UP
787 * wxEVT_LEFT_DCLICK
788 * wxEVT_MIDDLE_DOWN
789 * wxEVT_MIDDLE_UP
790 * wxEVT_MIDDLE_DCLICK
791 * wxEVT_RIGHT_DOWN
792 * wxEVT_RIGHT_UP
793 * wxEVT_RIGHT_DCLICK
794 * wxEVT_MOTION
795 * wxEVT_MOUSEWHEEL ", "");
d14a1e28 796
d14a1e28 797
d5a7caf6
RD
798 DocDeclStr(
799 bool , IsButton() const,
800 "Returns true if the event was a mouse button event (not necessarily a
801button down event - that may be tested using `ButtonDown`).", "");
802
d14a1e28 803
d5a7caf6
RD
804 DocDeclStr(
805 bool , ButtonDown(int but = wxMOUSE_BTN_ANY) const,
806 "If the argument is omitted, this returns true if the event was any mouse
807button down event. Otherwise the argument specifies which button-down
808event shold be checked for (see `Button` for the possible values).", "");
809
810
811 DocDeclStr(
812 bool , ButtonDClick(int but = wxMOUSE_BTN_ANY) const,
813 "If the argument is omitted, this returns true if the event was any
814mouse double click event. Otherwise the argument specifies which
815double click event to check for (see `Button` for the possible
816values).", "");
817
d14a1e28 818
d5a7caf6
RD
819 DocDeclStr(
820 bool , ButtonUp(int but = wxMOUSE_BTN_ANY) const,
821 "If the argument is omitted, this returns true if the event was any
822mouse button up event. Otherwise the argument specifies which
823button up event to check for (see `Button` for the possible values).", "");
824
d14a1e28 825
d5a7caf6
RD
826 DocDeclStr(
827 bool , Button(int button) const,
828 "Returns true if the identified mouse button is changing state. Valid
829values of button are:
830
831 ==================== =====================================
832 wx.MOUSE_BTN_LEFT check if left button was pressed
833 wx.MOUSE_BTN_MIDDLE check if middle button was pressed
834 wx.MOUSE_BTN_RIGHT check if right button was pressed
835 wx.MOUSE_BTN_ANY check if any button was pressed
836 ==================== =====================================
837", "");
838
d14a1e28
RD
839
840 // Was the given button in Down state?
841 bool ButtonIsDown(int but) const;
842
d5a7caf6
RD
843 DocDeclStr(
844 int , GetButton() const,
845 "Returns the mouse button which generated this event or
846wx.MOUSE_BTN_NONE if no button is involved (for mouse move, enter or
847leave event, for example). Otherwise wx.MOUSE_BTN_LEFT is returned for
848the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE
849and wx.MOUSE_BTN_RIGHT for the same events for the middle and the
850right buttons respectively.", "");
851
d14a1e28 852
d5a7caf6
RD
853 DocDeclStr(
854 bool , ControlDown() const,
855 "Returns true if the control key was down at the time of the event.", "");
856
857 DocDeclStr(
858 bool , MetaDown() const,
859 "Returns true if the Meta key was down at the time of the event.", "");
860
861
862 DocDeclStr(
863 bool , AltDown() const,
864 "Returns true if the Alt key was down at the time of the event.", "");
865
866 DocDeclStr(
867 bool , ShiftDown() const,
868 "Returns true if the Shift key was down at the time of the event.", "");
869
d14a1e28 870
ba3e5ef2
RD
871 DocDeclStr(
872 bool , CmdDown() const,
873 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
874platforms but the special \"Apple\" (a.k.a as \"Command\") key on
d5a7caf6 875Macs: it often makes sense to use it instead of, say, `ControlDown`
ba3e5ef2 876because Cmd key is used for the same thing under Mac as Ctrl
d5a7caf6 877elsewhere. The Ctrl key still exists, it's just not used for this
ba3e5ef2
RD
878purpose. So for non-Mac platforms this is the same as `ControlDown`
879and Macs this is the same as `MetaDown`.", "");
880
d14a1e28 881
d5a7caf6
RD
882 DocDeclStr(
883 bool , LeftDown() const,
884 "Returns true if the left mouse button state changed to down.", "");
885
886 DocDeclStr(
887 bool , MiddleDown() const,
888 "Returns true if the middle mouse button state changed to down.", "");
889
890 DocDeclStr(
891 bool , RightDown() const,
892 "Returns true if the right mouse button state changed to down.", "");
893
894
895
896 DocDeclStr(
897 bool , LeftUp() const,
898 "Returns true if the left mouse button state changed to up.", "");
899
900 DocDeclStr(
901 bool , MiddleUp() const,
902 "Returns true if the middle mouse button state changed to up.", "");
903
904 DocDeclStr(
905 bool , RightUp() const,
906 "Returns true if the right mouse button state changed to up.", "");
907
908
909
910
911 DocDeclStr(
912 bool , LeftDClick() const,
913 "Returns true if the event was a left button double click.", "");
914
915 DocDeclStr(
916 bool , MiddleDClick() const,
917 "Returns true if the event was a middle button double click.", "");
918
919 DocDeclStr(
920 bool , RightDClick() const,
921 "Returns true if the event was a right button double click.", "");
922
923
924
925 DocDeclStr(
926 bool , LeftIsDown(),
927 "Returns true if the left mouse button is currently down, independent
928of the current event type.
d14a1e28 929
d5a7caf6
RD
930Please notice that it is not the same as LeftDown which returns true
931if the left mouse button was just pressed. Rather, it describes the
932state of the mouse button before the event happened.
d14a1e28 933
d5a7caf6
RD
934This event is usually used in the mouse event handlers which process
935\"move mouse\" messages to determine whether the user is (still)
936dragging the mouse.", "");
937
938 DocDeclStr(
939 bool , MiddleIsDown(),
940 "Returns true if the middle mouse button is currently down, independent
941of the current event type.", "");
942
943 DocDeclStr(
944 bool , RightIsDown(),
945 "Returns true if the right mouse button is currently down, independent
946of the current event type.", "");
947
d14a1e28 948
d5a7caf6
RD
949
950 DocDeclStr(
951 bool , Dragging() const,
952 "Returns true if this was a dragging event (motion while a button is
953depressed).", "");
954
d14a1e28 955
d5a7caf6
RD
956 DocDeclStr(
957 bool , Moving() const,
958 "Returns true if this was a motion event and no mouse buttons were
959pressed. If any mouse button is held pressed, then this method returns
960false and Dragging returns true.", "");
961
d14a1e28 962
d5a7caf6
RD
963 DocDeclStr(
964 bool , Entering() const,
965 "Returns true if the mouse was entering the window.", "");
966
d14a1e28 967
d5a7caf6
RD
968 DocDeclStr(
969 bool , Leaving() const,
970 "Returns true if the mouse was leaving the window.", "");
971
d14a1e28 972
dd9f7fea
RD
973
974 DocStr(GetPosition, // sets the docstring for both
d5a7caf6
RD
975 "Returns the pixel position of the mouse in window coordinates when the
976event happened.", "");
d14a1e28 977 wxPoint GetPosition();
d14a1e28 978
dd9f7fea
RD
979 DocDeclAName(
980 void, GetPosition(long *OUTPUT, long *OUTPUT),
981 "GetPositionTuple() -> (x,y)",
982 GetPositionTuple);
983
d5a7caf6
RD
984 DocDeclStr(
985 wxPoint , GetLogicalPosition(const wxDC& dc) const,
986 "Returns the logical mouse position in pixels (i.e. translated
987according to the translation set for the DC, which usually indicates
988that the window has been scrolled).", "");
989
d14a1e28 990
d5a7caf6
RD
991 DocDeclStr(
992 wxCoord , GetX() const,
993 "Returns X coordinate of the physical mouse event position.", "");
994
995 DocDeclStr(
996 wxCoord , GetY() const,
997 "Returns Y coordinate of the physical mouse event position.", "");
998
d14a1e28 999
d5a7caf6
RD
1000 DocDeclStr(
1001 int , GetWheelRotation() const,
1002 "Get wheel rotation, positive or negative indicates direction of
1003rotation. Current devices all send an event when rotation is equal to
1004+/-WheelDelta, but this allows for finer resolution devices to be
1005created in the future. Because of this you shouldn't assume that one
1006event is equal to 1 line or whatever, but you should be able to either
1007do partial line scrolling or wait until +/-WheelDelta rotation values
1008have been accumulated before scrolling.", "");
1009
d14a1e28 1010
d5a7caf6
RD
1011 DocDeclStr(
1012 int , GetWheelDelta() const,
1013 "Get wheel delta, normally 120. This is the threshold for action to be
1014taken, and one such action (for example, scrolling one increment)
1015should occur for each delta.", "");
1016
1017
1018 DocDeclStr(
1019 int , GetLinesPerAction() const,
1020 "Returns the configured number of lines (or whatever) to be scrolled
1021per wheel action. Defaults to three.", "");
1022
1023
1024 DocDeclStr(
1025 bool , IsPageScroll() const,
1026 "Returns true if the system has been setup to do page scrolling with
1027the mouse wheel instead of line scrolling.", "");
1028
d14a1e28
RD
1029
1030public:
1031 wxCoord m_x, m_y;
1032
1033 bool m_leftDown;
1034 bool m_middleDown;
1035 bool m_rightDown;
1036
1037 bool m_controlDown;
1038 bool m_shiftDown;
1039 bool m_altDown;
1040 bool m_metaDown;
1041
1042 int m_wheelRotation;
1043 int m_wheelDelta;
1044 int m_linesPerAction;
1045};
1046
1047//---------------------------------------------------------------------------
1048%newgroup;
1049
1050// Cursor set event
1051class wxSetCursorEvent : public wxEvent
1052{
1053public:
1054 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0);
1055
1056 wxCoord GetX() const;
1057 wxCoord GetY() const;
1058
1059 void SetCursor(const wxCursor& cursor);
1060 const wxCursor& GetCursor() const;
1061 bool HasCursor() const;
1062};
1063
1064//---------------------------------------------------------------------------
1065%newgroup;
1066
1067// Keyboard input event class
1068
1069class wxKeyEvent : public wxEvent
1070{
1071public:
1072 wxKeyEvent(wxEventType keyType = wxEVT_NULL);
1073
1074 // Find state of shift/control keys
1075 bool ControlDown() const;
1076 bool MetaDown() const;
1077 bool AltDown() const;
1078 bool ShiftDown() const;
ba3e5ef2
RD
1079
1080 DocDeclStr(
1081 bool , CmdDown() const,
1082 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
1083platforms but the special \"Apple\" (a.k.a as \"Command\") key on
1084Macs: it makes often sense to use it instead of, say, `ControlDown`
1085because Cmd key is used for the same thing under Mac as Ctrl
1086elsewhere. The Ctrl still exists, it's just not used for this
1087purpose. So for non-Mac platforms this is the same as `ControlDown`
1088and Macs this is the same as `MetaDown`.", "");
1089
1090
d14a1e28
RD
1091
1092 // exclude MetaDown() from HasModifiers() because NumLock under X is often
1093 // configured as mod2 modifier, yet the key events even when it is pressed
1094 // should be processed normally, not like Ctrl- or Alt-key
1095 bool HasModifiers() const;
1096
1097 // get the key code: an ASCII7 char or an element of wxKeyCode enum
1098 int GetKeyCode() const;
1099 %pythoncode { KeyCode = GetKeyCode }
1100
1101 %extend {
ba87052f 1102 int GetUnicodeKey() {
3b7224dc 1103 %#if wxUSE_UNICODE
ba87052f 1104 return self->GetUnicodeKey();
3b7224dc 1105 %#else
d14a1e28 1106 return 0;
3b7224dc 1107 %#endif
d14a1e28
RD
1108 }
1109 }
ba87052f
RD
1110 %pythoncode { GetUniChar = GetUnicodeKey }
1111
d14a1e28
RD
1112
1113 // get the raw key code (platform-dependent)
1114 wxUint32 GetRawKeyCode() const;
1115
1116 // get the raw key flags (platform-dependent)
1117 wxUint32 GetRawKeyFlags() const;
1118
dd9f7fea
RD
1119
1120 DocStr(GetPosition, // sets the docstring for both
d07d2bc9 1121 "Find the position of the event.", "");
d14a1e28 1122 wxPoint GetPosition();
dd9f7fea
RD
1123
1124 DocDeclAName(
1125 void, GetPosition(long *OUTPUT, long *OUTPUT),
1126 "GetPositionTuple() -> (x,y)",
1127 GetPositionTuple);
d14a1e28
RD
1128
1129 // Get X position
1130 wxCoord GetX() const;
1131
1132 // Get Y position
1133 wxCoord GetY() const;
1134
1135public:
1136 wxCoord m_x, m_y;
1137
1138 long m_keyCode;
1139
1140 bool m_controlDown;
1141 bool m_shiftDown;
1142 bool m_altDown;
1143 bool m_metaDown;
1144 bool m_scanCode;
1145
1146 // these fields contain the platform-specific information about
1147 // key that was pressed
1148 wxUint32 m_rawCode;
1149 wxUint32 m_rawFlags;
1150};
1151
1152//---------------------------------------------------------------------------
1153%newgroup;
1154
1155// Size event class
1156class wxSizeEvent : public wxEvent
1157{
1158public:
1159 wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0);
1160
1161 wxSize GetSize() const;
1162 wxRect GetRect() const;
1163 void SetRect(wxRect rect);
1164 %extend {
1165 void SetSize(wxSize size) {
1166 self->m_size = size;
1167 }
1168 }
1169
1170public:
1171 wxSize m_size;
1172 wxRect m_rect; // Used for wxEVT_SIZING
1173};
1174
1175
1176//---------------------------------------------------------------------------
1177%newgroup;
1178
1179// Move event class
1180class wxMoveEvent : public wxEvent
1181{
1182public:
1183 wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0);
1184
1185 wxPoint GetPosition() const;
1186 wxRect GetRect() const;
aeee37c3
RD
1187 void SetRect(const wxRect& rect);
1188 void SetPosition(const wxPoint& pos);
d14a1e28 1189
aeee37c3
RD
1190 %pythoncode {
1191 m_pos = property(GetPosition, SetPosition)
1192 m_rect = property(GetRect, SetRect)
1193 }
d14a1e28
RD
1194};
1195
1196//---------------------------------------------------------------------------
1197%newgroup;
1198
1199// Paint event class
1200class wxPaintEvent : public wxEvent
1201{
1202public:
1203 wxPaintEvent(int Id = 0);
1204};
1205
1206
1207class wxNcPaintEvent : public wxEvent
1208{
1209public:
1210 wxNcPaintEvent(int winid = 0);
1211};
1212
1213//---------------------------------------------------------------------------
1214%newgroup;
1215
1216class wxEraseEvent : public wxEvent
1217{
1218public:
1219 wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL);
1220
1221 wxDC *GetDC() const;
1222};
1223
1224
1225//---------------------------------------------------------------------------
1226%newgroup;
1227
1228class wxFocusEvent : public wxEvent
1229{
1230public:
1231 wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0);
1232
1233 // The window associated with this event is the window which had focus
1234 // before for SET event and the window which will have focus for the KILL
1235 // one. NB: it may be NULL in both cases!
1236 wxWindow *GetWindow() const;
1237 void SetWindow(wxWindow *win);
1238};
1239
1240//---------------------------------------------------------------------------
1241%newgroup;
1242
1243// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
1244// wxFocusEvent it is propagated upwards the window chain
1245class wxChildFocusEvent : public wxCommandEvent
1246{
1247public:
1248 wxChildFocusEvent(wxWindow *win = NULL);
1249
1250 wxWindow *GetWindow() const;
1251};
1252
1253//---------------------------------------------------------------------------
1254%newgroup;
1255
1256class wxActivateEvent : public wxEvent
1257{
1258public:
a72f4631 1259 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0);
d14a1e28
RD
1260 bool GetActive() const;
1261};
1262
1263
1264//---------------------------------------------------------------------------
1265%newgroup;
1266
1267class wxInitDialogEvent : public wxEvent
1268{
1269public:
1270 wxInitDialogEvent(int Id = 0);
1271};
1272
1273
1274//---------------------------------------------------------------------------
1275%newgroup;
1276
1277class wxMenuEvent : public wxEvent
1278{
1279public:
1280 wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL);
1281
1282 // only for wxEVT_MENU_HIGHLIGHT
1283 int GetMenuId() const;
1284
1285 // only for wxEVT_MENU_OPEN/CLOSE
1286 bool IsPopup() const;
1287
1288 // only for wxEVT_MENU_OPEN/CLOSE
1289 wxMenu* GetMenu() const;
1290};
1291
1292//---------------------------------------------------------------------------
1293%newgroup;
1294
1295// Window close or session close event class
1296class wxCloseEvent : public wxEvent
1297{
1298public:
1299 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0);
1300
1301 void SetLoggingOff(bool logOff);
1302 bool GetLoggingOff() const;
1303
a72f4631 1304 void Veto(bool veto = true);
d14a1e28
RD
1305 void SetCanVeto(bool canVeto);
1306
1307 bool CanVeto() const;
1308 bool GetVeto() const;
1309};
1310
1311
1312//---------------------------------------------------------------------------
1313%newgroup;
1314
1315class wxShowEvent : public wxEvent
1316{
1317public:
a72f4631 1318 wxShowEvent(int winid = 0, bool show = false);
d14a1e28
RD
1319
1320 void SetShow(bool show);
1321 bool GetShow() const;
1322
1323};
1324
1325
1326//---------------------------------------------------------------------------
1327%newgroup;
1328
1329class wxIconizeEvent: public wxEvent
1330{
1331public:
a72f4631 1332 wxIconizeEvent(int id = 0, bool iconized = true);
d14a1e28
RD
1333 bool Iconized();
1334};
1335
1336
1337//---------------------------------------------------------------------------
1338%newgroup;
1339
1340class wxMaximizeEvent: public wxEvent
1341{
1342public:
1343 wxMaximizeEvent(int id = 0);
1344};
1345
1346//---------------------------------------------------------------------------
1347%newgroup;
1348
1349class wxDropFilesEvent: public wxEvent
1350{
1351public:
1352 wxPoint GetPosition();
1353 int GetNumberOfFiles();
1354
1355 %extend {
1356 PyObject* GetFiles() {
1357 int count = self->GetNumberOfFiles();
1358 wxString* files = self->GetFiles();
1359 PyObject* list = PyList_New(count);
1360
1361 if (!list) {
1362 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
1363 return NULL;
1364 }
1365
1366 for (int i=0; i<count; i++) {
1fc9204a 1367 PyList_SetItem(list, i, wx2PyString(files[i]));
d14a1e28
RD
1368 }
1369 return list;
1370 }
1371 }
1372};
1373
1374
1375
1376//---------------------------------------------------------------------------
1377%newgroup;
1378
1379
1380// Whether to always send update events to windows, or
1381// to only send update events to those with the
1382// wxWS_EX_PROCESS_UI_UPDATES style.
1383
1384enum wxUpdateUIMode
1385{
1386 // Send UI update events to all windows
1387 wxUPDATE_UI_PROCESS_ALL,
1388
1389 // Send UI update events to windows that have
1390 // the wxWS_EX_PROCESS_UI_UPDATES flag specified
1391 wxUPDATE_UI_PROCESS_SPECIFIED
1392};
1393
64e8a1f0
RD
1394
1395
d14a1e28
RD
1396class wxUpdateUIEvent : public wxCommandEvent
1397{
1398public:
1399 wxUpdateUIEvent(wxWindowID commandId = 0);
1400
1401 bool GetChecked() const;
1402 bool GetEnabled() const;
1403 wxString GetText() const;
1404 bool GetSetText() const;
1405 bool GetSetChecked() const;
1406 bool GetSetEnabled() const;
1407
1408 void Check(bool check);
1409 void Enable(bool enable);
1410 void SetText(const wxString& text);
1411
1412 // Sets the interval between updates in milliseconds.
1413 // Set to -1 to disable updates, or to 0 to update as frequently as possible.
1414 static void SetUpdateInterval(long updateInterval);
1415
1416 // Returns the current interval between updates in milliseconds
1417 static long GetUpdateInterval();
1418
1419 // Can we update this window?
1420 static bool CanUpdate(wxWindow *win);
1421
1422 // Reset the update time to provide a delay until the next
1423 // time we should update
1424 static void ResetUpdateTime();
1425
1426 // Specify how wxWindows will send update events: to
1427 // all windows, or only to those which specify that they
1428 // will process the events.
1429 static void SetMode(wxUpdateUIMode mode);
1430
1431 // Returns the UI update mode
1432 static wxUpdateUIMode GetMode();
1433};
1434
d14a1e28
RD
1435//---------------------------------------------------------------------------
1436%newgroup;
1437
1438class wxSysColourChangedEvent: public wxEvent {
1439public:
1440 wxSysColourChangedEvent();
1441};
1442
1443//---------------------------------------------------------------------------
1444%newgroup;
1445
1446
1447// wxEVT_MOUSE_CAPTURE_CHANGED
1448// The window losing the capture receives this message
1449// (even if it released the capture itself).
1450class wxMouseCaptureChangedEvent : public wxEvent
1451{
1452public:
1453 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL);
1454
1455 wxWindow* GetCapturedWindow() const;
1456};
1457
1458//---------------------------------------------------------------------------
1459%newgroup;
1460
1461class wxDisplayChangedEvent : public wxEvent
1462{
1463public:
1464 wxDisplayChangedEvent();
1465};
1466
1467//---------------------------------------------------------------------------
1468%newgroup;
1469
1470class wxPaletteChangedEvent : public wxEvent
1471{
1472public:
1473 wxPaletteChangedEvent(wxWindowID id = 0);
1474
1475 void SetChangedWindow(wxWindow* win);
1476 wxWindow* GetChangedWindow();
1477
1478};
1479
1480//---------------------------------------------------------------------------
1481%newgroup;
1482
1483
1484// wxEVT_QUERY_NEW_PALETTE
1485// Indicates the window is getting keyboard focus and should re-do its palette.
1486class wxQueryNewPaletteEvent : public wxEvent
1487{
1488public:
1489 wxQueryNewPaletteEvent(wxWindowID winid = 0);
1490
1491 // App sets this if it changes the palette.
1492 void SetPaletteRealized(bool realized);
1493 bool GetPaletteRealized() const;
1494};
1495
1496//---------------------------------------------------------------------------
1497%newgroup;
1498
1499
1500// Event generated by dialog navigation keys
1501// wxEVT_NAVIGATION_KEY
1502
1503class wxNavigationKeyEvent : public wxEvent
1504{
1505public:
1506 wxNavigationKeyEvent();
1507
dd9f7fea 1508 // direction: forward (True) or backward (False)
d14a1e28 1509 bool GetDirection() const;
3b74f194 1510 void SetDirection(bool forward);
d14a1e28
RD
1511
1512 // it may be a window change event (MDI, notebook pages...) or a control
1513 // change event
1514 bool IsWindowChange() const;
3b74f194 1515 void SetWindowChange(bool ischange);
d14a1e28 1516
b7189025
RD
1517 // Set to true under MSW if the event was generated using the tab key.
1518 // This is required for proper navogation over radio buttons
1519 bool IsFromTab() const;
1520 void SetFromTab(bool bIs);
1521
3b74f194
RD
1522 void SetFlags(long flags);
1523
d14a1e28
RD
1524 // the child which has the focus currently (may be NULL - use
1525 // wxWindow::FindFocus then)
1526 wxWindow* GetCurrentFocus() const;
1527 void SetCurrentFocus(wxWindow *win);
3b74f194
RD
1528
1529 enum {
5a319c5c 1530 IsBackward,
3b74f194 1531 IsForward,
b7189025
RD
1532 WinChange,
1533 FromTab
3b74f194 1534 };
d14a1e28
RD
1535};
1536
1537
1538//---------------------------------------------------------------------------
1539%newgroup;
1540
1541// Window creation/destruction events: the first is sent as soon as window is
1542// created (i.e. the underlying GUI object exists), but when the C++ object is
1543// fully initialized (so virtual functions may be called). The second,
1544// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
1545// still safe to call virtual functions at this moment
1546
1547class wxWindowCreateEvent : public wxCommandEvent
1548{
1549public:
1550 wxWindowCreateEvent(wxWindow *win = NULL);
1551 wxWindow *GetWindow() const;
1552};
1553
1554class wxWindowDestroyEvent : public wxCommandEvent
1555{
1556public:
1557 wxWindowDestroyEvent(wxWindow *win = NULL);
1558 wxWindow *GetWindow() const;
1559};
1560
1561
1562//---------------------------------------------------------------------------
1563%newgroup;
1564
1565// A Context event is sent when the user right clicks on a window or
1566// presses Shift-F10
1567// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
1568// Under other systems it may have to be generated from a right click event
1569/*
1570 wxEVT_CONTEXT_MENU
1571*/
1572
1573class wxContextMenuEvent : public wxCommandEvent
1574{
1575public:
1576 wxContextMenuEvent(wxEventType type = wxEVT_NULL,
1577 wxWindowID winid = 0,
1578 const wxPoint& pt = wxDefaultPosition);
1579
1580 // Position of event (in screen coordinates)
1581 const wxPoint& GetPosition() const;
1582 void SetPosition(const wxPoint& pos);
1583};
1584
1585//---------------------------------------------------------------------------
1586%newgroup;
1587
1588// Whether to always send idle events to windows, or
1589// to only send update events to those with the
1590// wxWS_EX_PROCESS_IDLE style.
1591
1592enum wxIdleMode
1593{
1594 // Send idle events to all windows
1595 wxIDLE_PROCESS_ALL,
1596
1597 // Send idle events to windows that have
1598 // the wxWS_EX_PROCESS_IDLE flag specified
1599 wxIDLE_PROCESS_SPECIFIED
1600};
1601
64e8a1f0 1602
d14a1e28
RD
1603class wxIdleEvent : public wxEvent
1604{
1605public:
1606 wxIdleEvent();
1607
a72f4631 1608 void RequestMore(bool needMore = true);
d14a1e28
RD
1609 bool MoreRequested() const;
1610
1611 // Specify how wxWindows will send idle events: to
1612 // all windows, or only to those which specify that they
1613 // will process the events.
1614 static void SetMode(wxIdleMode mode);
1615
1616 // Returns the idle event mode
1617 static wxIdleMode GetMode();
1618
1619 // Can we send an idle event?
1620 static bool CanSend(wxWindow* win);
1621};
1622
1623//---------------------------------------------------------------------------
1624%newgroup;
1625
1626// These classes can be derived from in Python and passed through the event
1627// system without loosing anything. They do this by keeping a reference to
1628// themselves and some special case handling in wxPyCallback::EventThunker.
1629
1630class wxPyEvent : public wxEvent {
1631public:
2b9048c5 1632 %pythonAppend wxPyEvent "self.SetSelf(self)"
d14a1e28
RD
1633 wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL );
1634 ~wxPyEvent();
1635
1636
1637 void SetSelf(PyObject* self);
1638 PyObject* GetSelf();
1639};
1640
1641
1642class wxPyCommandEvent : public wxCommandEvent {
1643public:
2b9048c5 1644 %pythonAppend wxPyCommandEvent "self.SetSelf(self)"
d14a1e28
RD
1645 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
1646 ~wxPyCommandEvent();
1647
1648 void SetSelf(PyObject* self);
1649 PyObject* GetSelf();
1650};
1651
1652
1653
1654//---------------------------------------------------------------------------
1655
1656
b3b61cda
RD
1657class wxDateEvent : public wxCommandEvent
1658{
1659public:
1660 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type);
1661
1662 const wxDateTime& GetDate() const;
1663 void SetDate(const wxDateTime &date);
1664
1665};
1666
d14a1e28 1667
b3b61cda
RD
1668%constant wxEventType wxEVT_DATE_CHANGED;
1669
1670%pythoncode {
1671 EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
1672}
1673
1674
1675//---------------------------------------------------------------------------