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