]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_event.i
58e6e255fe725d2d37f4d41bcc8837a6ab351a68
[wxWidgets.git] / wxPython / src / _event.i
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
25 enum 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
38 wxEventType 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;
166 %constant wxEventType wxEVT_HIBERNATE;
167
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
184 EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE )
185 EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING )
186 EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE )
187 EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING )
188 EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW )
189 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
190 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
191 EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT )
192 EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT )
193 EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND )
194 EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR )
195 EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN )
196 EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP )
197 EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1)
198 EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK )
199 EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN )
200 EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE )
201 EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1)
202 EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT )
203 EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS )
204 EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS )
205 EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS )
206 EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE )
207 EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP )
208 EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE )
209 EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION )
210 EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION )
211 EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES )
212 EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG )
213 EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED )
214 EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED )
215 EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW )
216 EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE )
217 EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE )
218 EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY )
219 EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED )
220 EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE )
221 EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE )
222 EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY )
223 EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR )
224 EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED )
225
226 EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN )
227 EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP )
228 EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN )
229 EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP )
230 EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN )
231 EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP )
232 EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION )
233 EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK )
234 EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK )
235 EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK )
236 EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW )
237 EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW )
238 EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL )
239
240 EVT_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)
257 EVT_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
267 EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP )
268 EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM )
269 EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP )
270 EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN )
271 EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP )
272 EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN )
273 EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK )
274 EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE )
275
276 %# Scrolling from wx.Slider and wx.ScrollBar
277 EVT_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
288 EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP )
289 EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM )
290 EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP )
291 EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN )
292 EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP )
293 EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN )
294 EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK )
295 EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE )
296 EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL )
297
298 %# Scrolling from wx.Slider and wx.ScrollBar, with an id
299 EVT_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
310 EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1)
311 EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1)
312 EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1)
313 EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1)
314 EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1)
315 EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1)
316 EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1)
317 EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1)
318 EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1)
319
320 EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1)
321 EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1)
322 EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1)
323 EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1)
324 EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1)
325 EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1)
326 EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2)
327 EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1)
328 EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1)
329 EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1)
330
331 EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1)
332 EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1)
333 EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1)
334 EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1)
335 EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2)
336 EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1)
337 EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2)
338 EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1)
339 EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1)
340
341
342 EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1)
343 EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1)
344 EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1)
345 EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1)
346 EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1)
347 EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1)
348 EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1)
349
350 EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE )
351
352 EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1)
353 EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2)
354
355 EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU )
356
357
358 }
359
360 //---------------------------------------------------------------------------
361 %newgroup;
362
363 DocStr(wxEvent,
364 "An event is a structure holding information about an event passed to a
365 callback or member function. wx.Event is an abstract base class for
366 other event classes", "");
367
368 class wxEvent : public wxObject {
369 public:
370 // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC
371 ~wxEvent();
372
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
385 any.", "");
386
387 DocDeclStr(
388 void , SetEventObject(wxObject *obj),
389 "Sets the originating object, or in other words, obj is normally the
390 object that is sending the event.", "");
391
392 long GetTimestamp() const;
393 void SetTimestamp(long ts = 0);
394
395 DocDeclStr(
396 int , GetId() const,
397 "Returns the identifier associated with this event, such as a button
398 command 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
403 is sending the event, but it can also be a command id from a menu
404 item, etc.", "");
405
406
407
408 DocDeclStr(
409 bool , IsCommandEvent() const,
410 "Returns true if the event is or is derived from `wx.CommandEvent` else
411 it returns false. Note: Exists only for optimization purposes.", "");
412
413
414 DocDeclStr(
415 void , Skip(bool skip = true),
416 "Called by an event handler, it controls whether additional event
417 handlers bound to this event will be called after the current event
418 handler returns. Skip(false) (the default setting) will prevent
419 additional event handlers from being called and control will be
420 returned to the sender of the event immediately after the current
421 handler has finished. Skip(True) will cause the event processing
422 system to continue searching for a handler function for this event.
423 ", "");
424
425 DocDeclStr(
426 bool , GetSkipped() const,
427 "Returns true if the event handler should be skipped, false otherwise.
428 :see: `Skip`", "");
429
430
431 DocDeclStr(
432 bool , ShouldPropagate() const,
433 "Test if this event should be propagated to the parent window or not,
434 i.e. if the propagation level is currently greater than 0.", "");
435
436
437 // Stop an event from propagating to its parent window, returns the old
438 // propagation level value
439 DocDeclStr(
440 int , StopPropagation(),
441 "Stop the event from propagating to its parent window. Returns the old
442 propagation level value which may be later passed to
443 `ResumePropagation` to allow propagating the event again.", "");
444
445
446 DocDeclStr(
447 void , ResumePropagation(int propagationLevel),
448 "Resume the event propagation by restoring the propagation level. (For
449 example, you can use the value returned by an earlier call to
450 `StopPropagation`.)
451 ", "");
452
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
464 DocStr(wxPropagationDisabler,
465 "Helper class to temporarily change an event not to propagate. Simply
466 create an instance of this class and then whe it is destroyed the
467 propogation of the event will be restored.", "");
468 class wxPropagationDisabler
469 {
470 public:
471 wxPropagationDisabler(wxEvent& event);
472 ~wxPropagationDisabler();
473 };
474
475
476 DocStr( wxPropagateOnce,
477 "A helper class that will temporarily lower propagation level of an
478 event. Simply create an instance of this class and then whe it is
479 destroyed the propogation of the event will be restored.", "");
480 class wxPropagateOnce
481 {
482 public:
483 wxPropagateOnce(wxEvent& event);
484 ~wxPropagateOnce();
485 };
486
487 //---------------------------------------------------------------------------
488 %newgroup;
489
490 DocStr(wxCommandEvent,
491 "This event class contains information about command events, which
492 originate from a variety of simple controls, as well as menus and
493 toolbars.", "");
494
495 class wxCommandEvent : public wxEvent
496 {
497 public:
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
510 DocDeclStr(
511 int , GetSelection() const,
512 "Returns item index for a listbox or choice selection event (not valid
513 for a deselection).", "");
514
515
516 void SetString(const wxString& s);
517 DocDeclStr(
518 wxString , GetString() const,
519 "Returns item string for a listbox or choice selection event (not valid
520 for a deselection).", "");
521
522
523 DocDeclStr(
524 bool , IsChecked() const,
525 "This method can be used with checkbox and menu events: for the
526 checkboxes, the method returns true for a selection event and false
527 for a deselection one. For the menu events, this method indicates if
528 the menu item just has become checked or unchecked (and thus only
529 makes sense for checkable menu items).", "");
530
531 %pythoncode { Checked = IsChecked }
532
533 DocDeclStr(
534 bool , IsSelection() const,
535 "For a listbox or similar event, returns true if it is a selection,
536 false if it is a deselection.", "");
537
538
539 void SetExtraLong(long extraLong);
540 DocDeclStr(
541 long , GetExtraLong() const,
542 "Returns extra information dependant on the event objects type. If the event
543 comes from a listbox selection, it is a boolean determining whether the event
544 was a selection (true) or a deselection (false). A listbox deselection only
545 occurs for multiple-selection boxes, and in this case the index and string
546 values are indeterminate and the listbox must be examined by the application.", "");
547
548
549 void SetInt(int i);
550 DocDeclStr(
551 long , GetInt() const,
552 "Returns the integer identifier corresponding to a listbox, choice or radiobox
553 selection (only if the event was a selection, not a deselection), or a boolean
554 value representing the value of a checkbox.", "");
555
556
557 virtual wxEvent *Clone() const;
558
559 };
560
561 //---------------------------------------------------------------------------
562 %newgroup;
563
564 DocStr(wxNotifyEvent,
565 "An instance of this class (or one of its derived classes) is sent from
566 a control when the control's state is being changed and the control
567 allows that change to be prevented from happening. The event handler
568 can call `Veto` or `Allow` to tell the control what to do.", "");
569
570 class wxNotifyEvent : public wxCommandEvent
571 {
572 public:
573 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
574
575 DocDeclStr(
576 void , Veto(),
577 "Prevents the change announced by this event from happening.
578
579 It is in general a good idea to notify the user about the reasons for
580 vetoing the change because otherwise the applications behaviour (which
581 just 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
587 processed. For most events it is not necessary to call this method as
588 the events are allowed anyhow but some are forbidden by default (this
589 will be mentioned in the corresponding event description).", "");
590
591
592 DocDeclStr(
593 bool , IsAllowed(),
594 "Returns true if the change is allowed (`Veto` hasn't been called) or
595 false otherwise (if it was).", "");
596
597 };
598
599
600 //---------------------------------------------------------------------------
601 %newgroup;
602
603 DocStr(wxScrollEvent,
604 "A scroll event holds information about events sent from stand-alone
605 scrollbars and sliders. Note that scrolled windows do not send
606 instnaces of this event class, but send the `wx.ScrollWinEvent`
607 instead.", "
608
609 Events
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
625 Note
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
644 class wxScrollEvent : public wxCommandEvent
645 {
646 public:
647 DocCtorStr(
648 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
649 int winid = 0, int pos = 0, int orient = 0),
650 "", "");
651
652 DocDeclStr(
653 int , GetOrientation() const,
654 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
655 the scrollbar.", "");
656
657 DocDeclStr(
658 int , GetPosition() const,
659 "Returns the position of the scrollbar.", "");
660
661 void SetOrientation(int orient);
662 void SetPosition(int pos);
663 };
664
665
666 //---------------------------------------------------------------------------
667 %newgroup;
668
669 DocStr(wxScrollWinEvent,
670 "A wx.ScrollWinEvent holds information about scrolling and is sent from
671 scrolling windows.", "
672
673 Events
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
691 class wxScrollWinEvent : public wxEvent
692 {
693 public:
694 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
695 int pos = 0, int orient = 0);
696
697 DocDeclStr(
698 int , GetOrientation() const,
699 "Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of
700 the scrollbar.", "");
701
702 DocDeclStr(
703 int , GetPosition() const,
704 "Returns the position of the scrollbar for the thumb track and release
705 events. Note that this field can't be used for the other events, you
706 need to query the window itself for the current position in that case.", "");
707
708 void SetOrientation(int orient);
709 void SetPosition(int pos);
710 };
711
712 //---------------------------------------------------------------------------
713 %newgroup;
714
715
716 DocStr(wxMouseEvent,
717 "This event class contains information about the events generated by
718 the mouse: they include mouse buttons press and release events and
719 mouse move events.
720
721 All mouse events involving the buttons use ``wx.MOUSE_BTN_LEFT`` for
722 the 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
724 a middle button so a portable application should avoid relying on the
725 events from it.
726
727 Note the difference between methods like `LeftDown` and `LeftIsDown`:
728 the former returns true when the event corresponds to the left mouse
729 button click while the latter returns true if the left mouse button is
730 currently being pressed. For example, when the user is dragging the
731 mouse you can use `LeftIsDown` to test whether the left mouse button
732 is (still) depressed. Also, by convention, if `LeftDown` returns true,
733 `LeftIsDown` will also return true in wxWidgets whatever the
734 underlying GUI behaviour is (which is platform-dependent). The same
735 applies, of course, to other mouse buttons as well.", "
736
737 Events
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
764 // the symbolic names for the mouse buttons
765 enum
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
776 class wxMouseEvent : public wxEvent
777 {
778 public:
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 ", "");
796
797
798 DocDeclStr(
799 bool , IsButton() const,
800 "Returns true if the event was a mouse button event (not necessarily a
801 button down event - that may be tested using `ButtonDown`).", "");
802
803
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
807 button down event. Otherwise the argument specifies which button-down
808 event 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
814 mouse double click event. Otherwise the argument specifies which
815 double click event to check for (see `Button` for the possible
816 values).", "");
817
818
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
822 mouse button up event. Otherwise the argument specifies which
823 button up event to check for (see `Button` for the possible values).", "");
824
825
826 DocDeclStr(
827 bool , Button(int button) const,
828 "Returns true if the identified mouse button is changing state. Valid
829 values 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
839
840 // Was the given button in Down state?
841 bool ButtonIsDown(int but) const;
842
843 DocDeclStr(
844 int , GetButton() const,
845 "Returns the mouse button which generated this event or
846 wx.MOUSE_BTN_NONE if no button is involved (for mouse move, enter or
847 leave event, for example). Otherwise wx.MOUSE_BTN_LEFT is returned for
848 the left button down, up and double click events, wx.MOUSE_BTN_MIDDLE
849 and wx.MOUSE_BTN_RIGHT for the same events for the middle and the
850 right buttons respectively.", "");
851
852
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
870
871 DocDeclStr(
872 bool , CmdDown() const,
873 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
874 platforms but the special \"Apple\" (a.k.a as \"Command\") key on
875 Macs: it often makes sense to use it instead of, say, `ControlDown`
876 because Cmd key is used for the same thing under Mac as Ctrl
877 elsewhere. The Ctrl key still exists, it's just not used for this
878 purpose. So for non-Mac platforms this is the same as `ControlDown`
879 and Macs this is the same as `MetaDown`.", "");
880
881
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
928 of the current event type.
929
930 Please notice that it is not the same as LeftDown which returns true
931 if the left mouse button was just pressed. Rather, it describes the
932 state of the mouse button before the event happened.
933
934 This event is usually used in the mouse event handlers which process
935 \"move mouse\" messages to determine whether the user is (still)
936 dragging the mouse.", "");
937
938 DocDeclStr(
939 bool , MiddleIsDown(),
940 "Returns true if the middle mouse button is currently down, independent
941 of the current event type.", "");
942
943 DocDeclStr(
944 bool , RightIsDown(),
945 "Returns true if the right mouse button is currently down, independent
946 of the current event type.", "");
947
948
949
950 DocDeclStr(
951 bool , Dragging() const,
952 "Returns true if this was a dragging event (motion while a button is
953 depressed).", "");
954
955
956 DocDeclStr(
957 bool , Moving() const,
958 "Returns true if this was a motion event and no mouse buttons were
959 pressed. If any mouse button is held pressed, then this method returns
960 false and Dragging returns true.", "");
961
962
963 DocDeclStr(
964 bool , Entering() const,
965 "Returns true if the mouse was entering the window.", "");
966
967
968 DocDeclStr(
969 bool , Leaving() const,
970 "Returns true if the mouse was leaving the window.", "");
971
972
973
974 DocStr(GetPosition, // sets the docstring for both
975 "Returns the pixel position of the mouse in window coordinates when the
976 event happened.", "");
977 wxPoint GetPosition();
978
979 DocDeclAName(
980 void, GetPosition(long *OUTPUT, long *OUTPUT),
981 "GetPositionTuple() -> (x,y)",
982 GetPositionTuple);
983
984 DocDeclStr(
985 wxPoint , GetLogicalPosition(const wxDC& dc) const,
986 "Returns the logical mouse position in pixels (i.e. translated
987 according to the translation set for the DC, which usually indicates
988 that the window has been scrolled).", "");
989
990
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
999
1000 DocDeclStr(
1001 int , GetWheelRotation() const,
1002 "Get wheel rotation, positive or negative indicates direction of
1003 rotation. Current devices all send an event when rotation is equal to
1004 +/-WheelDelta, but this allows for finer resolution devices to be
1005 created in the future. Because of this you shouldn't assume that one
1006 event is equal to 1 line or whatever, but you should be able to either
1007 do partial line scrolling or wait until +/-WheelDelta rotation values
1008 have been accumulated before scrolling.", "");
1009
1010
1011 DocDeclStr(
1012 int , GetWheelDelta() const,
1013 "Get wheel delta, normally 120. This is the threshold for action to be
1014 taken, and one such action (for example, scrolling one increment)
1015 should occur for each delta.", "");
1016
1017
1018 DocDeclStr(
1019 int , GetLinesPerAction() const,
1020 "Returns the configured number of lines (or whatever) to be scrolled
1021 per 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
1027 the mouse wheel instead of line scrolling.", "");
1028
1029
1030 public:
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
1051 class wxSetCursorEvent : public wxEvent
1052 {
1053 public:
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
1069 class wxKeyEvent : public wxEvent
1070 {
1071 public:
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;
1079
1080 DocDeclStr(
1081 bool , CmdDown() const,
1082 "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix
1083 platforms but the special \"Apple\" (a.k.a as \"Command\") key on
1084 Macs: it makes often sense to use it instead of, say, `ControlDown`
1085 because Cmd key is used for the same thing under Mac as Ctrl
1086 elsewhere. The Ctrl still exists, it's just not used for this
1087 purpose. So for non-Mac platforms this is the same as `ControlDown`
1088 and Macs this is the same as `MetaDown`.", "");
1089
1090
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 {
1102 int GetUnicodeKey() {
1103 %#if wxUSE_UNICODE
1104 return self->GetUnicodeKey();
1105 %#else
1106 return 0;
1107 %#endif
1108 }
1109 }
1110 %pythoncode { GetUniChar = GetUnicodeKey }
1111
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
1119
1120 DocStr(GetPosition, // sets the docstring for both
1121 "Find the position of the event.", "");
1122 wxPoint GetPosition();
1123
1124 DocDeclAName(
1125 void, GetPosition(long *OUTPUT, long *OUTPUT),
1126 "GetPositionTuple() -> (x,y)",
1127 GetPositionTuple);
1128
1129 // Get X position
1130 wxCoord GetX() const;
1131
1132 // Get Y position
1133 wxCoord GetY() const;
1134
1135 public:
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
1156 class wxSizeEvent : public wxEvent
1157 {
1158 public:
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
1170 public:
1171 wxSize m_size;
1172 wxRect m_rect; // Used for wxEVT_SIZING
1173 };
1174
1175
1176 //---------------------------------------------------------------------------
1177 %newgroup;
1178
1179 // Move event class
1180 class wxMoveEvent : public wxEvent
1181 {
1182 public:
1183 wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0);
1184
1185 wxPoint GetPosition() const;
1186 wxRect GetRect() const;
1187 void SetRect(const wxRect& rect);
1188 void SetPosition(const wxPoint& pos);
1189
1190 %pythoncode {
1191 m_pos = property(GetPosition, SetPosition)
1192 m_rect = property(GetRect, SetRect)
1193 }
1194 };
1195
1196 //---------------------------------------------------------------------------
1197 %newgroup;
1198
1199 // Paint event class
1200 class wxPaintEvent : public wxEvent
1201 {
1202 public:
1203 wxPaintEvent(int Id = 0);
1204 };
1205
1206
1207 class wxNcPaintEvent : public wxEvent
1208 {
1209 public:
1210 wxNcPaintEvent(int winid = 0);
1211 };
1212
1213 //---------------------------------------------------------------------------
1214 %newgroup;
1215
1216 class wxEraseEvent : public wxEvent
1217 {
1218 public:
1219 wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL);
1220
1221 wxDC *GetDC() const;
1222 };
1223
1224
1225 //---------------------------------------------------------------------------
1226 %newgroup;
1227
1228 class wxFocusEvent : public wxEvent
1229 {
1230 public:
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
1245 class wxChildFocusEvent : public wxCommandEvent
1246 {
1247 public:
1248 wxChildFocusEvent(wxWindow *win = NULL);
1249
1250 wxWindow *GetWindow() const;
1251 };
1252
1253 //---------------------------------------------------------------------------
1254 %newgroup;
1255
1256 class wxActivateEvent : public wxEvent
1257 {
1258 public:
1259 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0);
1260 bool GetActive() const;
1261 };
1262
1263
1264 //---------------------------------------------------------------------------
1265 %newgroup;
1266
1267 class wxInitDialogEvent : public wxEvent
1268 {
1269 public:
1270 wxInitDialogEvent(int Id = 0);
1271 };
1272
1273
1274 //---------------------------------------------------------------------------
1275 %newgroup;
1276
1277 class wxMenuEvent : public wxEvent
1278 {
1279 public:
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
1296 class wxCloseEvent : public wxEvent
1297 {
1298 public:
1299 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0);
1300
1301 void SetLoggingOff(bool logOff);
1302 bool GetLoggingOff() const;
1303
1304 void Veto(bool veto = true);
1305 void SetCanVeto(bool canVeto);
1306
1307 bool CanVeto() const;
1308 bool GetVeto() const;
1309 };
1310
1311
1312 //---------------------------------------------------------------------------
1313 %newgroup;
1314
1315 class wxShowEvent : public wxEvent
1316 {
1317 public:
1318 wxShowEvent(int winid = 0, bool show = false);
1319
1320 void SetShow(bool show);
1321 bool GetShow() const;
1322
1323 };
1324
1325
1326 //---------------------------------------------------------------------------
1327 %newgroup;
1328
1329 class wxIconizeEvent: public wxEvent
1330 {
1331 public:
1332 wxIconizeEvent(int id = 0, bool iconized = true);
1333 bool Iconized();
1334 };
1335
1336
1337 //---------------------------------------------------------------------------
1338 %newgroup;
1339
1340 class wxMaximizeEvent: public wxEvent
1341 {
1342 public:
1343 wxMaximizeEvent(int id = 0);
1344 };
1345
1346 //---------------------------------------------------------------------------
1347 %newgroup;
1348
1349 class wxDropFilesEvent: public wxEvent
1350 {
1351 public:
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++) {
1367 PyList_SetItem(list, i, wx2PyString(files[i]));
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
1384 enum 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
1394
1395
1396 class wxUpdateUIEvent : public wxCommandEvent
1397 {
1398 public:
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
1435 //---------------------------------------------------------------------------
1436 %newgroup;
1437
1438 class wxSysColourChangedEvent: public wxEvent {
1439 public:
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).
1450 class wxMouseCaptureChangedEvent : public wxEvent
1451 {
1452 public:
1453 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL);
1454
1455 wxWindow* GetCapturedWindow() const;
1456 };
1457
1458 //---------------------------------------------------------------------------
1459 %newgroup;
1460
1461 class wxDisplayChangedEvent : public wxEvent
1462 {
1463 public:
1464 wxDisplayChangedEvent();
1465 };
1466
1467 //---------------------------------------------------------------------------
1468 %newgroup;
1469
1470 class wxPaletteChangedEvent : public wxEvent
1471 {
1472 public:
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.
1486 class wxQueryNewPaletteEvent : public wxEvent
1487 {
1488 public:
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
1503 class wxNavigationKeyEvent : public wxEvent
1504 {
1505 public:
1506 wxNavigationKeyEvent();
1507
1508 // direction: forward (True) or backward (False)
1509 bool GetDirection() const;
1510 void SetDirection(bool forward);
1511
1512 // it may be a window change event (MDI, notebook pages...) or a control
1513 // change event
1514 bool IsWindowChange() const;
1515 void SetWindowChange(bool ischange);
1516
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
1522 void SetFlags(long flags);
1523
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);
1528
1529 enum {
1530 IsBackward,
1531 IsForward,
1532 WinChange,
1533 FromTab
1534 };
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
1547 class wxWindowCreateEvent : public wxCommandEvent
1548 {
1549 public:
1550 wxWindowCreateEvent(wxWindow *win = NULL);
1551 wxWindow *GetWindow() const;
1552 };
1553
1554 class wxWindowDestroyEvent : public wxCommandEvent
1555 {
1556 public:
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
1573 class wxContextMenuEvent : public wxCommandEvent
1574 {
1575 public:
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
1592 enum 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
1602
1603 class wxIdleEvent : public wxEvent
1604 {
1605 public:
1606 wxIdleEvent();
1607
1608 void RequestMore(bool needMore = true);
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
1630 class wxPyEvent : public wxEvent {
1631 public:
1632 %pythonAppend wxPyEvent "self.SetSelf(self)"
1633 wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL );
1634 ~wxPyEvent();
1635
1636
1637 void SetSelf(PyObject* self);
1638 PyObject* GetSelf();
1639 };
1640
1641
1642 class wxPyCommandEvent : public wxCommandEvent {
1643 public:
1644 %pythonAppend wxPyCommandEvent "self.SetSelf(self)"
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
1657 class wxDateEvent : public wxCommandEvent
1658 {
1659 public:
1660 wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type);
1661
1662 const wxDateTime& GetDate() const;
1663 void SetDate(const wxDateTime &date);
1664
1665 };
1666
1667
1668 %constant wxEventType wxEVT_DATE_CHANGED;
1669
1670 %pythoncode {
1671 EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 )
1672 }
1673
1674
1675 //---------------------------------------------------------------------------