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