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