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