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