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