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