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