]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: _event.i | |
3 | // Purpose: SWIG interface for common event classes and event binders | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 24-May-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | // Include some extra python code here | |
18 | %pythoncode "_event_ex.py" | |
19 | ||
20 | //--------------------------------------------------------------------------- | |
21 | %newgroup; | |
22 | ||
23 | // the predefined constants for the number of times we propagate event | |
24 | // upwards window child-parent chain | |
25 | enum Propagation_state | |
26 | { | |
27 | // don't propagate it at all | |
28 | wxEVENT_PROPAGATE_NONE = 0, | |
29 | ||
30 | // propagate it until it is processed | |
31 | wxEVENT_PROPAGATE_MAX = INT_MAX | |
32 | }; | |
33 | ||
34 | ||
35 | //--------------------------------------------------------------------------- | |
36 | // Event types | |
37 | ||
38 | wxEventType wxNewEventType(); | |
39 | ||
40 | ||
41 | %constant wxEventType wxEVT_NULL; | |
42 | %constant wxEventType wxEVT_FIRST; | |
43 | %constant wxEventType wxEVT_USER_FIRST; | |
44 | ||
45 | %constant wxEventType wxEVT_COMMAND_BUTTON_CLICKED; | |
46 | %constant wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED; | |
47 | %constant wxEventType wxEVT_COMMAND_CHOICE_SELECTED; | |
48 | %constant wxEventType wxEVT_COMMAND_LISTBOX_SELECTED; | |
49 | %constant wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED; | |
50 | %constant wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED; | |
51 | ||
52 | %constant wxEventType wxEVT_COMMAND_MENU_SELECTED; | |
53 | %constant wxEventType wxEVT_COMMAND_TOOL_CLICKED; | |
54 | %constant wxEventType wxEVT_COMMAND_SLIDER_UPDATED; | |
55 | %constant wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED; | |
56 | %constant wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED; | |
57 | ||
58 | %constant wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED; | |
59 | %constant wxEventType wxEVT_COMMAND_VLBOX_SELECTED; | |
60 | %constant wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED; | |
61 | %constant wxEventType wxEVT_COMMAND_TOOL_RCLICKED; | |
62 | %constant wxEventType wxEVT_COMMAND_TOOL_ENTER; | |
63 | ||
64 | // Mouse event types | |
65 | %constant wxEventType wxEVT_LEFT_DOWN; | |
66 | %constant wxEventType wxEVT_LEFT_UP; | |
67 | %constant wxEventType wxEVT_MIDDLE_DOWN; | |
68 | %constant wxEventType wxEVT_MIDDLE_UP; | |
69 | %constant wxEventType wxEVT_RIGHT_DOWN; | |
70 | %constant wxEventType wxEVT_RIGHT_UP; | |
71 | %constant wxEventType wxEVT_MOTION; | |
72 | %constant wxEventType wxEVT_ENTER_WINDOW; | |
73 | %constant wxEventType wxEVT_LEAVE_WINDOW; | |
74 | %constant wxEventType wxEVT_LEFT_DCLICK; | |
75 | %constant wxEventType wxEVT_MIDDLE_DCLICK; | |
76 | %constant wxEventType wxEVT_RIGHT_DCLICK; | |
77 | %constant wxEventType wxEVT_SET_FOCUS; | |
78 | %constant wxEventType wxEVT_KILL_FOCUS; | |
79 | %constant wxEventType wxEVT_CHILD_FOCUS; | |
80 | %constant wxEventType wxEVT_MOUSEWHEEL; | |
81 | ||
82 | // Non-client mouse events | |
83 | %constant wxEventType wxEVT_NC_LEFT_DOWN; | |
84 | %constant wxEventType wxEVT_NC_LEFT_UP; | |
85 | %constant wxEventType wxEVT_NC_MIDDLE_DOWN; | |
86 | %constant wxEventType wxEVT_NC_MIDDLE_UP; | |
87 | %constant wxEventType wxEVT_NC_RIGHT_DOWN; | |
88 | %constant wxEventType wxEVT_NC_RIGHT_UP; | |
89 | %constant wxEventType wxEVT_NC_MOTION; | |
90 | %constant wxEventType wxEVT_NC_ENTER_WINDOW; | |
91 | %constant wxEventType wxEVT_NC_LEAVE_WINDOW; | |
92 | %constant wxEventType wxEVT_NC_LEFT_DCLICK; | |
93 | %constant wxEventType wxEVT_NC_MIDDLE_DCLICK; | |
94 | %constant wxEventType wxEVT_NC_RIGHT_DCLICK; | |
95 | ||
96 | // Character input event type | |
97 | %constant wxEventType wxEVT_CHAR; | |
98 | %constant wxEventType wxEVT_CHAR_HOOK; | |
99 | %constant wxEventType wxEVT_NAVIGATION_KEY; | |
100 | %constant wxEventType wxEVT_KEY_DOWN; | |
101 | %constant wxEventType wxEVT_KEY_UP; | |
102 | %constant wxEventType wxEVT_HOTKEY; | |
103 | ||
104 | // Set cursor event | |
105 | %constant wxEventType wxEVT_SET_CURSOR; | |
106 | ||
107 | // wxScrollBar and wxSlider event identifiers | |
108 | %constant wxEventType wxEVT_SCROLL_TOP; | |
109 | %constant wxEventType wxEVT_SCROLL_BOTTOM; | |
110 | %constant wxEventType wxEVT_SCROLL_LINEUP; | |
111 | %constant wxEventType wxEVT_SCROLL_LINEDOWN; | |
112 | %constant wxEventType wxEVT_SCROLL_PAGEUP; | |
113 | %constant wxEventType wxEVT_SCROLL_PAGEDOWN; | |
114 | %constant wxEventType wxEVT_SCROLL_THUMBTRACK; | |
115 | %constant wxEventType wxEVT_SCROLL_THUMBRELEASE; | |
116 | %constant wxEventType wxEVT_SCROLL_ENDSCROLL; | |
117 | ||
118 | // Scroll events from wxWindow | |
119 | %constant wxEventType wxEVT_SCROLLWIN_TOP; | |
120 | %constant wxEventType wxEVT_SCROLLWIN_BOTTOM; | |
121 | %constant wxEventType wxEVT_SCROLLWIN_LINEUP; | |
122 | %constant wxEventType wxEVT_SCROLLWIN_LINEDOWN; | |
123 | %constant wxEventType wxEVT_SCROLLWIN_PAGEUP; | |
124 | %constant wxEventType wxEVT_SCROLLWIN_PAGEDOWN; | |
125 | %constant wxEventType wxEVT_SCROLLWIN_THUMBTRACK; | |
126 | %constant wxEventType wxEVT_SCROLLWIN_THUMBRELEASE; | |
127 | ||
128 | // System events | |
129 | %constant wxEventType wxEVT_SIZE; | |
130 | %constant wxEventType wxEVT_MOVE; | |
131 | %constant wxEventType wxEVT_CLOSE_WINDOW; | |
132 | %constant wxEventType wxEVT_END_SESSION; | |
133 | %constant wxEventType wxEVT_QUERY_END_SESSION; | |
134 | %constant wxEventType wxEVT_ACTIVATE_APP; | |
135 | %constant wxEventType wxEVT_POWER; | |
136 | %constant wxEventType wxEVT_ACTIVATE; | |
137 | %constant wxEventType wxEVT_CREATE; | |
138 | %constant wxEventType wxEVT_DESTROY; | |
139 | %constant wxEventType wxEVT_SHOW; | |
140 | %constant wxEventType wxEVT_ICONIZE; | |
141 | %constant wxEventType wxEVT_MAXIMIZE; | |
142 | %constant wxEventType wxEVT_MOUSE_CAPTURE_CHANGED; | |
143 | %constant wxEventType wxEVT_PAINT; | |
144 | %constant wxEventType wxEVT_ERASE_BACKGROUND; | |
145 | %constant wxEventType wxEVT_NC_PAINT; | |
146 | %constant wxEventType wxEVT_PAINT_ICON; | |
147 | %constant wxEventType wxEVT_MENU_OPEN; | |
148 | %constant wxEventType wxEVT_MENU_CLOSE; | |
149 | %constant wxEventType wxEVT_MENU_HIGHLIGHT; | |
150 | ||
151 | %constant wxEventType wxEVT_CONTEXT_MENU; | |
152 | %constant wxEventType wxEVT_SYS_COLOUR_CHANGED; | |
153 | %constant wxEventType wxEVT_DISPLAY_CHANGED; | |
154 | %constant wxEventType wxEVT_SETTING_CHANGED; | |
155 | %constant wxEventType wxEVT_QUERY_NEW_PALETTE; | |
156 | %constant wxEventType wxEVT_PALETTE_CHANGED; | |
157 | %constant wxEventType wxEVT_DROP_FILES; | |
158 | %constant wxEventType wxEVT_DRAW_ITEM; | |
159 | %constant wxEventType wxEVT_MEASURE_ITEM; | |
160 | %constant wxEventType wxEVT_COMPARE_ITEM; | |
161 | %constant wxEventType wxEVT_INIT_DIALOG; | |
162 | %constant wxEventType wxEVT_IDLE; | |
163 | %constant wxEventType wxEVT_UPDATE_UI; | |
164 | %constant wxEventType wxEVT_SIZING; | |
165 | %constant wxEventType wxEVT_MOVING; | |
166 | %constant wxEventType wxEVT_HIBERNATE; | |
167 | ||
168 | ||
169 | // Generic command events | |
170 | // Note: a click is a higher-level event than button down/up | |
171 | %constant wxEventType wxEVT_COMMAND_LEFT_CLICK; | |
172 | %constant wxEventType wxEVT_COMMAND_LEFT_DCLICK; | |
173 | %constant wxEventType wxEVT_COMMAND_RIGHT_CLICK; | |
174 | %constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK; | |
175 | %constant wxEventType wxEVT_COMMAND_SET_FOCUS; | |
176 | %constant wxEventType wxEVT_COMMAND_KILL_FOCUS; | |
177 | %constant wxEventType wxEVT_COMMAND_ENTER; | |
178 | ||
179 | ||
180 | ||
181 | %pythoncode { | |
182 | %# | |
183 | %# Create some event binders | |
184 | EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE ) | |
185 | EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING ) | |
186 | EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE ) | |
187 | EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING ) | |
188 | EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW ) | |
189 | EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) | |
190 | EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) | |
191 | EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT ) | |
192 | EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT ) | |
193 | EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND ) | |
194 | EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR ) | |
195 | EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN ) | |
196 | EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP ) | |
197 | EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1) | |
198 | EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK ) | |
199 | EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN ) | |
200 | EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE ) | |
201 | EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1) | |
202 | EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT ) | |
203 | EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS ) | |
204 | EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS ) | |
205 | EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS ) | |
206 | EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE ) | |
207 | EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP ) | |
208 | EVT_HIBERNATE = wx.PyEventBinder( wxEVT_HIBERNATE ) | |
209 | EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) | |
210 | EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) | |
211 | EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES ) | |
212 | EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG ) | |
213 | EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED ) | |
214 | EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED ) | |
215 | EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW ) | |
216 | EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE ) | |
217 | EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE ) | |
218 | EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY ) | |
219 | EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED ) | |
220 | EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE ) | |
221 | EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE ) | |
222 | EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY ) | |
223 | EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR ) | |
224 | EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED ) | |
225 | ||
226 | EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN ) | |
227 | EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP ) | |
228 | EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN ) | |
229 | EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP ) | |
230 | EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN ) | |
231 | EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP ) | |
232 | EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION ) | |
233 | EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK ) | |
234 | EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK ) | |
235 | EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK ) | |
236 | EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW ) | |
237 | EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW ) | |
238 | EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL ) | |
239 | ||
240 | EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN, | |
241 | wxEVT_LEFT_UP, | |
242 | wxEVT_MIDDLE_DOWN, | |
243 | wxEVT_MIDDLE_UP, | |
244 | wxEVT_RIGHT_DOWN, | |
245 | wxEVT_RIGHT_UP, | |
246 | wxEVT_MOTION, | |
247 | wxEVT_LEFT_DCLICK, | |
248 | wxEVT_MIDDLE_DCLICK, | |
249 | wxEVT_RIGHT_DCLICK, | |
250 | wxEVT_ENTER_WINDOW, | |
251 | wxEVT_LEAVE_WINDOW, | |
252 | wxEVT_MOUSEWHEEL | |
253 | ]) | |
254 | ||
255 | ||
256 | %# Scrolling from wxWindow (sent to wxScrolledWindow) | |
257 | EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP, | |
258 | wxEVT_SCROLLWIN_BOTTOM, | |
259 | wxEVT_SCROLLWIN_LINEUP, | |
260 | wxEVT_SCROLLWIN_LINEDOWN, | |
261 | wxEVT_SCROLLWIN_PAGEUP, | |
262 | wxEVT_SCROLLWIN_PAGEDOWN, | |
263 | wxEVT_SCROLLWIN_THUMBTRACK, | |
264 | wxEVT_SCROLLWIN_THUMBRELEASE, | |
265 | ]) | |
266 | ||
267 | EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP ) | |
268 | EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM ) | |
269 | EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP ) | |
270 | EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN ) | |
271 | EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP ) | |
272 | EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN ) | |
273 | EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK ) | |
274 | EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE ) | |
275 | ||
276 | %# Scrolling from wxSlider and wxScrollBar | |
277 | EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, | |
278 | wxEVT_SCROLL_BOTTOM, | |
279 | wxEVT_SCROLL_LINEUP, | |
280 | wxEVT_SCROLL_LINEDOWN, | |
281 | wxEVT_SCROLL_PAGEUP, | |
282 | wxEVT_SCROLL_PAGEDOWN, | |
283 | wxEVT_SCROLL_THUMBTRACK, | |
284 | wxEVT_SCROLL_THUMBRELEASE, | |
285 | wxEVT_SCROLL_ENDSCROLL, | |
286 | ]) | |
287 | ||
288 | EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP ) | |
289 | EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM ) | |
290 | EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP ) | |
291 | EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN ) | |
292 | EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP ) | |
293 | EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN ) | |
294 | EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK ) | |
295 | EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE ) | |
296 | EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL ) | |
297 | ||
298 | %# Scrolling from wxSlider and wxScrollBar, with an id | |
299 | EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, | |
300 | wxEVT_SCROLL_BOTTOM, | |
301 | wxEVT_SCROLL_LINEUP, | |
302 | wxEVT_SCROLL_LINEDOWN, | |
303 | wxEVT_SCROLL_PAGEUP, | |
304 | wxEVT_SCROLL_PAGEDOWN, | |
305 | wxEVT_SCROLL_THUMBTRACK, | |
306 | wxEVT_SCROLL_THUMBRELEASE, | |
307 | wxEVT_SCROLL_ENDSCROLL, | |
308 | ], 1) | |
309 | ||
310 | EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1) | |
311 | EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1) | |
312 | EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1) | |
313 | EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1) | |
314 | EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1) | |
315 | EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1) | |
316 | EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1) | |
317 | EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1) | |
318 | EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1) | |
319 | ||
320 | EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1) | |
321 | EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1) | |
322 | EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1) | |
323 | EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1) | |
324 | EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1) | |
325 | EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1) | |
326 | EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2) | |
327 | EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1) | |
328 | EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1) | |
329 | EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1) | |
330 | ||
331 | EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1) | |
332 | EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1) | |
333 | EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1) | |
334 | EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1) | |
335 | EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2) | |
336 | EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1) | |
337 | EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2) | |
338 | EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1) | |
339 | EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1) | |
340 | ||
341 | ||
342 | EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1) | |
343 | EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1) | |
344 | EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1) | |
345 | EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1) | |
346 | EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1) | |
347 | EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1) | |
348 | EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1) | |
349 | ||
350 | EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE ) | |
351 | ||
352 | EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1) | |
353 | EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2) | |
354 | ||
355 | EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU ) | |
356 | ||
357 | ||
358 | } | |
359 | ||
360 | //--------------------------------------------------------------------------- | |
361 | %newgroup; | |
362 | ||
363 | class wxEvent : public wxObject { | |
364 | public: | |
365 | // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC | |
366 | ~wxEvent(); | |
367 | ||
368 | void SetEventType(wxEventType typ); | |
369 | wxEventType GetEventType() const; | |
370 | wxObject *GetEventObject() const; | |
371 | void SetEventObject(wxObject *obj); | |
372 | long GetTimestamp() const; | |
373 | void SetTimestamp(long ts = 0); | |
374 | int GetId() const; | |
375 | void SetId(int Id); | |
376 | ||
377 | ||
378 | bool IsCommandEvent() const; | |
379 | ||
380 | DocDeclStr( | |
381 | void , Skip(bool skip = true), | |
382 | "Called by an event handler, it controls whether additional event | |
383 | handlers bound to this event will be called after the current event | |
384 | handler returns. Skip(false) (the default setting) will prevent | |
385 | additional event handlers from being called and control will be | |
386 | returned to the sender of the event immediately after the current | |
387 | handler has finished. Skip(True) will cause the event processing | |
388 | system to continue searching for a handler function for this event. | |
389 | ", ""); | |
390 | ||
391 | bool GetSkipped() const; | |
392 | ||
393 | // Determine if this event should be propagating to the parent window. | |
394 | bool ShouldPropagate() const; | |
395 | ||
396 | // Stop an event from propagating to its parent window, returns the old | |
397 | // propagation level value | |
398 | int StopPropagation(); | |
399 | ||
400 | // Resume the event propagation by restoring the propagation level | |
401 | // (returned by StopPropagation()) | |
402 | void ResumePropagation(int propagationLevel); | |
403 | ||
404 | // this function is used to create a copy of the event polymorphically and | |
405 | // all derived classes must implement it because otherwise wxPostEvent() | |
406 | // for them wouldn't work (it needs to do a copy of the event) | |
407 | virtual wxEvent *Clone() /* =0*/; | |
408 | }; | |
409 | ||
410 | ||
411 | //--------------------------------------------------------------------------- | |
412 | %newgroup; | |
413 | ||
414 | // Helper class to temporarily change an event not to propagate. | |
415 | class wxPropagationDisabler | |
416 | { | |
417 | public: | |
418 | wxPropagationDisabler(wxEvent& event); | |
419 | ~wxPropagationDisabler(); | |
420 | }; | |
421 | ||
422 | ||
423 | // Another one to temporarily lower propagation level. | |
424 | class wxPropagateOnce | |
425 | { | |
426 | public: | |
427 | wxPropagateOnce(wxEvent& event); | |
428 | ~wxPropagateOnce(); | |
429 | }; | |
430 | ||
431 | //--------------------------------------------------------------------------- | |
432 | %newgroup; | |
433 | ||
434 | class wxCommandEvent : public wxEvent | |
435 | { | |
436 | public: | |
437 | wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
438 | ||
439 | ||
440 | // // Set/Get client data from controls | |
441 | // void SetClientData(void* clientData) { m_clientData = clientData; } | |
442 | // void *GetClientData() const { return m_clientData; } | |
443 | ||
444 | // // Set/Get client object from controls | |
445 | // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } | |
446 | // void *GetClientObject() const { return m_clientObject; } | |
447 | ||
448 | ||
449 | // Get listbox selection if single-choice | |
450 | int GetSelection() const; | |
451 | ||
452 | // Set/Get listbox/choice selection string | |
453 | void SetString(const wxString& s); | |
454 | wxString GetString() const; | |
455 | ||
456 | // Get checkbox value | |
457 | bool IsChecked() const; | |
458 | %pythoncode { Checked = IsChecked } | |
459 | ||
460 | // True if the listbox event was a selection. | |
461 | bool IsSelection() const; | |
462 | ||
463 | void SetExtraLong(long extraLong); | |
464 | long GetExtraLong() const; | |
465 | ||
466 | void SetInt(int i); | |
467 | long GetInt() const; | |
468 | ||
469 | virtual wxEvent *Clone() const; | |
470 | ||
471 | }; | |
472 | ||
473 | //--------------------------------------------------------------------------- | |
474 | %newgroup; | |
475 | ||
476 | // this class adds a possibility to react (from the user) code to a control | |
477 | // notification: allow or veto the operation being reported. | |
478 | class wxNotifyEvent : public wxCommandEvent | |
479 | { | |
480 | public: | |
481 | wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
482 | ||
483 | // veto the operation (usually it's allowed by default) | |
484 | void Veto(); | |
485 | ||
486 | // allow the operation if it was disabled by default | |
487 | void Allow(); | |
488 | ||
489 | // for implementation code only: is the operation allowed? | |
490 | bool IsAllowed(); | |
491 | }; | |
492 | ||
493 | ||
494 | //--------------------------------------------------------------------------- | |
495 | %newgroup; | |
496 | ||
497 | // Scroll event class, derived form wxCommandEvent. wxScrollEvents are | |
498 | // sent by wxSlider and wxScrollBar. | |
499 | class wxScrollEvent : public wxCommandEvent | |
500 | { | |
501 | public: | |
502 | wxScrollEvent(wxEventType commandType = wxEVT_NULL, | |
503 | int winid = 0, int pos = 0, int orient = 0); | |
504 | ||
505 | int GetOrientation() const; | |
506 | int GetPosition() const; | |
507 | void SetOrientation(int orient); | |
508 | void SetPosition(int pos); | |
509 | }; | |
510 | ||
511 | ||
512 | //--------------------------------------------------------------------------- | |
513 | %newgroup; | |
514 | ||
515 | // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents | |
516 | // are sent by wxWindow. | |
517 | class wxScrollWinEvent : public wxEvent | |
518 | { | |
519 | public: | |
520 | wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, | |
521 | int pos = 0, int orient = 0); | |
522 | ||
523 | int GetOrientation() const; | |
524 | int GetPosition() const; | |
525 | void SetOrientation(int orient); | |
526 | void SetPosition(int pos); | |
527 | }; | |
528 | ||
529 | //--------------------------------------------------------------------------- | |
530 | %newgroup; | |
531 | ||
532 | // the symbolic names for the mouse buttons | |
533 | enum | |
534 | { | |
535 | wxMOUSE_BTN_ANY = -1, | |
536 | wxMOUSE_BTN_NONE = -1, | |
537 | wxMOUSE_BTN_LEFT = 0, | |
538 | wxMOUSE_BTN_MIDDLE = 1, | |
539 | wxMOUSE_BTN_RIGHT = 2 | |
540 | }; | |
541 | ||
542 | ||
543 | // Mouse event class | |
544 | class wxMouseEvent : public wxEvent | |
545 | { | |
546 | public: | |
547 | wxMouseEvent(wxEventType mouseType = wxEVT_NULL); | |
548 | ||
549 | // Was it a button event? (*doesn't* mean: is any button *down*?) | |
550 | bool IsButton() const; | |
551 | ||
552 | // Was it a down event from this (or any) button? | |
553 | bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; | |
554 | ||
555 | // Was it a dclick event from this (or any) button? | |
556 | bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; | |
557 | ||
558 | // Was it a up event from this (or any) button? | |
559 | bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; | |
560 | ||
561 | // Was the given button changing state? | |
562 | bool Button(int but) const; | |
563 | ||
564 | // Was the given button in Down state? | |
565 | bool ButtonIsDown(int but) const; | |
566 | ||
567 | // Get the button which is changing state (wxMOUSE_BTN_NONE if none) | |
568 | int GetButton() const; | |
569 | ||
570 | // Find state of shift/control keys | |
571 | bool ControlDown() const; | |
572 | bool MetaDown() const; | |
573 | bool AltDown() const; | |
574 | bool ShiftDown() const; | |
575 | ||
576 | DocDeclStr( | |
577 | bool , CmdDown() const, | |
578 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
579 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
580 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
581 | because Cmd key is used for the same thing under Mac as Ctrl | |
582 | elsewhere. The Ctrl still exists, it's just not used for this | |
583 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
584 | and Macs this is the same as `MetaDown`.", ""); | |
585 | ||
586 | // Find which event was just generated | |
587 | bool LeftDown() const; | |
588 | bool MiddleDown() const; | |
589 | bool RightDown() const; | |
590 | ||
591 | bool LeftUp() const; | |
592 | bool MiddleUp() const; | |
593 | bool RightUp() const; | |
594 | ||
595 | bool LeftDClick() const; | |
596 | bool MiddleDClick() const; | |
597 | bool RightDClick() const; | |
598 | ||
599 | // Find the current state of the mouse buttons (regardless | |
600 | // of current event type) | |
601 | bool LeftIsDown(); | |
602 | bool MiddleIsDown(); | |
603 | bool RightIsDown(); | |
604 | ||
605 | // True if a button is down and the mouse is moving | |
606 | bool Dragging() const; | |
607 | ||
608 | // True if the mouse is moving, and no button is down | |
609 | bool Moving() const; | |
610 | ||
611 | // True if the mouse is just entering the window | |
612 | bool Entering() const; | |
613 | ||
614 | // True if the mouse is just leaving the window | |
615 | bool Leaving() const; | |
616 | ||
617 | ||
618 | DocStr(GetPosition, // sets the docstring for both | |
619 | "Returns the position of the mouse in window coordinates when the event | |
620 | happened.", ""); | |
621 | wxPoint GetPosition(); | |
622 | ||
623 | DocDeclAName( | |
624 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
625 | "GetPositionTuple() -> (x,y)", | |
626 | GetPositionTuple); | |
627 | ||
628 | // Find the logical position of the event given the DC | |
629 | wxPoint GetLogicalPosition(const wxDC& dc) const; | |
630 | ||
631 | // Get X position | |
632 | wxCoord GetX() const; | |
633 | ||
634 | // Get Y position | |
635 | wxCoord GetY() const; | |
636 | ||
637 | // Get wheel rotation, positive or negative indicates direction of | |
638 | // rotation. Current devices all send an event when rotation is equal to | |
639 | // +/-WheelDelta, but this allows for finer resolution devices to be | |
640 | // created in the future. Because of this you shouldn't assume that one | |
641 | // event is equal to 1 line or whatever, but you should be able to either | |
642 | // do partial line scrolling or wait until +/-WheelDelta rotation values | |
643 | // have been accumulated before scrolling. | |
644 | int GetWheelRotation() const; | |
645 | ||
646 | // Get wheel delta, normally 120. This is the threshold for action to be | |
647 | // taken, and one such action (for example, scrolling one increment) | |
648 | // should occur for each delta. | |
649 | int GetWheelDelta() const; | |
650 | ||
651 | // Returns the configured number of lines (or whatever) to be scrolled per | |
652 | // wheel action. Defaults to one. | |
653 | int GetLinesPerAction() const; | |
654 | ||
655 | // Is the system set to do page scrolling? | |
656 | bool IsPageScroll() const; | |
657 | ||
658 | public: | |
659 | wxCoord m_x, m_y; | |
660 | ||
661 | bool m_leftDown; | |
662 | bool m_middleDown; | |
663 | bool m_rightDown; | |
664 | ||
665 | bool m_controlDown; | |
666 | bool m_shiftDown; | |
667 | bool m_altDown; | |
668 | bool m_metaDown; | |
669 | ||
670 | int m_wheelRotation; | |
671 | int m_wheelDelta; | |
672 | int m_linesPerAction; | |
673 | }; | |
674 | ||
675 | //--------------------------------------------------------------------------- | |
676 | %newgroup; | |
677 | ||
678 | // Cursor set event | |
679 | class wxSetCursorEvent : public wxEvent | |
680 | { | |
681 | public: | |
682 | wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); | |
683 | ||
684 | wxCoord GetX() const; | |
685 | wxCoord GetY() const; | |
686 | ||
687 | void SetCursor(const wxCursor& cursor); | |
688 | const wxCursor& GetCursor() const; | |
689 | bool HasCursor() const; | |
690 | }; | |
691 | ||
692 | //--------------------------------------------------------------------------- | |
693 | %newgroup; | |
694 | ||
695 | // Keyboard input event class | |
696 | ||
697 | class wxKeyEvent : public wxEvent | |
698 | { | |
699 | public: | |
700 | wxKeyEvent(wxEventType keyType = wxEVT_NULL); | |
701 | ||
702 | // Find state of shift/control keys | |
703 | bool ControlDown() const; | |
704 | bool MetaDown() const; | |
705 | bool AltDown() const; | |
706 | bool ShiftDown() const; | |
707 | ||
708 | DocDeclStr( | |
709 | bool , CmdDown() const, | |
710 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
711 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
712 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
713 | because Cmd key is used for the same thing under Mac as Ctrl | |
714 | elsewhere. The Ctrl still exists, it's just not used for this | |
715 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
716 | and Macs this is the same as `MetaDown`.", ""); | |
717 | ||
718 | ||
719 | ||
720 | // exclude MetaDown() from HasModifiers() because NumLock under X is often | |
721 | // configured as mod2 modifier, yet the key events even when it is pressed | |
722 | // should be processed normally, not like Ctrl- or Alt-key | |
723 | bool HasModifiers() const; | |
724 | ||
725 | // get the key code: an ASCII7 char or an element of wxKeyCode enum | |
726 | int GetKeyCode() const; | |
727 | %pythoncode { KeyCode = GetKeyCode } | |
728 | ||
729 | %extend { | |
730 | int GetUnicodeKey() { | |
731 | %#if wxUSE_UNICODE | |
732 | return self->GetUnicodeKey(); | |
733 | %#else | |
734 | return 0; | |
735 | %#endif | |
736 | } | |
737 | } | |
738 | %pythoncode { GetUniChar = GetUnicodeKey } | |
739 | ||
740 | ||
741 | // get the raw key code (platform-dependent) | |
742 | wxUint32 GetRawKeyCode() const; | |
743 | ||
744 | // get the raw key flags (platform-dependent) | |
745 | wxUint32 GetRawKeyFlags() const; | |
746 | ||
747 | ||
748 | DocStr(GetPosition, // sets the docstring for both | |
749 | "Find the position of the event.", ""); | |
750 | wxPoint GetPosition(); | |
751 | ||
752 | DocDeclAName( | |
753 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
754 | "GetPositionTuple() -> (x,y)", | |
755 | GetPositionTuple); | |
756 | ||
757 | // Get X position | |
758 | wxCoord GetX() const; | |
759 | ||
760 | // Get Y position | |
761 | wxCoord GetY() const; | |
762 | ||
763 | public: | |
764 | wxCoord m_x, m_y; | |
765 | ||
766 | long m_keyCode; | |
767 | ||
768 | bool m_controlDown; | |
769 | bool m_shiftDown; | |
770 | bool m_altDown; | |
771 | bool m_metaDown; | |
772 | bool m_scanCode; | |
773 | ||
774 | // these fields contain the platform-specific information about | |
775 | // key that was pressed | |
776 | wxUint32 m_rawCode; | |
777 | wxUint32 m_rawFlags; | |
778 | }; | |
779 | ||
780 | //--------------------------------------------------------------------------- | |
781 | %newgroup; | |
782 | ||
783 | // Size event class | |
784 | class wxSizeEvent : public wxEvent | |
785 | { | |
786 | public: | |
787 | wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0); | |
788 | ||
789 | wxSize GetSize() const; | |
790 | wxRect GetRect() const; | |
791 | void SetRect(wxRect rect); | |
792 | %extend { | |
793 | void SetSize(wxSize size) { | |
794 | self->m_size = size; | |
795 | } | |
796 | } | |
797 | ||
798 | public: | |
799 | wxSize m_size; | |
800 | wxRect m_rect; // Used for wxEVT_SIZING | |
801 | }; | |
802 | ||
803 | ||
804 | //--------------------------------------------------------------------------- | |
805 | %newgroup; | |
806 | ||
807 | // Move event class | |
808 | class wxMoveEvent : public wxEvent | |
809 | { | |
810 | public: | |
811 | wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0); | |
812 | ||
813 | wxPoint GetPosition() const; | |
814 | wxRect GetRect() const; | |
815 | void SetRect(const wxRect& rect); | |
816 | void SetPosition(const wxPoint& pos); | |
817 | ||
818 | %pythoncode { | |
819 | m_pos = property(GetPosition, SetPosition) | |
820 | m_rect = property(GetRect, SetRect) | |
821 | } | |
822 | }; | |
823 | ||
824 | //--------------------------------------------------------------------------- | |
825 | %newgroup; | |
826 | ||
827 | // Paint event class | |
828 | class wxPaintEvent : public wxEvent | |
829 | { | |
830 | public: | |
831 | wxPaintEvent(int Id = 0); | |
832 | }; | |
833 | ||
834 | ||
835 | class wxNcPaintEvent : public wxEvent | |
836 | { | |
837 | public: | |
838 | wxNcPaintEvent(int winid = 0); | |
839 | }; | |
840 | ||
841 | //--------------------------------------------------------------------------- | |
842 | %newgroup; | |
843 | ||
844 | class wxEraseEvent : public wxEvent | |
845 | { | |
846 | public: | |
847 | wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL); | |
848 | ||
849 | wxDC *GetDC() const; | |
850 | }; | |
851 | ||
852 | ||
853 | //--------------------------------------------------------------------------- | |
854 | %newgroup; | |
855 | ||
856 | class wxFocusEvent : public wxEvent | |
857 | { | |
858 | public: | |
859 | wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
860 | ||
861 | // The window associated with this event is the window which had focus | |
862 | // before for SET event and the window which will have focus for the KILL | |
863 | // one. NB: it may be NULL in both cases! | |
864 | wxWindow *GetWindow() const; | |
865 | void SetWindow(wxWindow *win); | |
866 | }; | |
867 | ||
868 | //--------------------------------------------------------------------------- | |
869 | %newgroup; | |
870 | ||
871 | // wxChildFocusEvent notifies the parent that a child has got the focus: unlike | |
872 | // wxFocusEvent it is propagated upwards the window chain | |
873 | class wxChildFocusEvent : public wxCommandEvent | |
874 | { | |
875 | public: | |
876 | wxChildFocusEvent(wxWindow *win = NULL); | |
877 | ||
878 | wxWindow *GetWindow() const; | |
879 | }; | |
880 | ||
881 | //--------------------------------------------------------------------------- | |
882 | %newgroup; | |
883 | ||
884 | class wxActivateEvent : public wxEvent | |
885 | { | |
886 | public: | |
887 | wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0); | |
888 | bool GetActive() const; | |
889 | }; | |
890 | ||
891 | ||
892 | //--------------------------------------------------------------------------- | |
893 | %newgroup; | |
894 | ||
895 | class wxInitDialogEvent : public wxEvent | |
896 | { | |
897 | public: | |
898 | wxInitDialogEvent(int Id = 0); | |
899 | }; | |
900 | ||
901 | ||
902 | //--------------------------------------------------------------------------- | |
903 | %newgroup; | |
904 | ||
905 | class wxMenuEvent : public wxEvent | |
906 | { | |
907 | public: | |
908 | wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL); | |
909 | ||
910 | // only for wxEVT_MENU_HIGHLIGHT | |
911 | int GetMenuId() const; | |
912 | ||
913 | // only for wxEVT_MENU_OPEN/CLOSE | |
914 | bool IsPopup() const; | |
915 | ||
916 | // only for wxEVT_MENU_OPEN/CLOSE | |
917 | wxMenu* GetMenu() const; | |
918 | }; | |
919 | ||
920 | //--------------------------------------------------------------------------- | |
921 | %newgroup; | |
922 | ||
923 | // Window close or session close event class | |
924 | class wxCloseEvent : public wxEvent | |
925 | { | |
926 | public: | |
927 | wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
928 | ||
929 | void SetLoggingOff(bool logOff); | |
930 | bool GetLoggingOff() const; | |
931 | ||
932 | void Veto(bool veto = true); | |
933 | void SetCanVeto(bool canVeto); | |
934 | ||
935 | bool CanVeto() const; | |
936 | bool GetVeto() const; | |
937 | }; | |
938 | ||
939 | ||
940 | //--------------------------------------------------------------------------- | |
941 | %newgroup; | |
942 | ||
943 | class wxShowEvent : public wxEvent | |
944 | { | |
945 | public: | |
946 | wxShowEvent(int winid = 0, bool show = false); | |
947 | ||
948 | void SetShow(bool show); | |
949 | bool GetShow() const; | |
950 | ||
951 | }; | |
952 | ||
953 | ||
954 | //--------------------------------------------------------------------------- | |
955 | %newgroup; | |
956 | ||
957 | class wxIconizeEvent: public wxEvent | |
958 | { | |
959 | public: | |
960 | wxIconizeEvent(int id = 0, bool iconized = true); | |
961 | bool Iconized(); | |
962 | }; | |
963 | ||
964 | ||
965 | //--------------------------------------------------------------------------- | |
966 | %newgroup; | |
967 | ||
968 | class wxMaximizeEvent: public wxEvent | |
969 | { | |
970 | public: | |
971 | wxMaximizeEvent(int id = 0); | |
972 | }; | |
973 | ||
974 | //--------------------------------------------------------------------------- | |
975 | %newgroup; | |
976 | ||
977 | class wxDropFilesEvent: public wxEvent | |
978 | { | |
979 | public: | |
980 | wxPoint GetPosition(); | |
981 | int GetNumberOfFiles(); | |
982 | ||
983 | %extend { | |
984 | PyObject* GetFiles() { | |
985 | int count = self->GetNumberOfFiles(); | |
986 | wxString* files = self->GetFiles(); | |
987 | PyObject* list = PyList_New(count); | |
988 | ||
989 | if (!list) { | |
990 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
991 | return NULL; | |
992 | } | |
993 | ||
994 | for (int i=0; i<count; i++) { | |
995 | PyList_SetItem(list, i, wx2PyString(files[i])); | |
996 | } | |
997 | return list; | |
998 | } | |
999 | } | |
1000 | }; | |
1001 | ||
1002 | ||
1003 | ||
1004 | //--------------------------------------------------------------------------- | |
1005 | %newgroup; | |
1006 | ||
1007 | ||
1008 | // Whether to always send update events to windows, or | |
1009 | // to only send update events to those with the | |
1010 | // wxWS_EX_PROCESS_UI_UPDATES style. | |
1011 | ||
1012 | enum wxUpdateUIMode | |
1013 | { | |
1014 | // Send UI update events to all windows | |
1015 | wxUPDATE_UI_PROCESS_ALL, | |
1016 | ||
1017 | // Send UI update events to windows that have | |
1018 | // the wxWS_EX_PROCESS_UI_UPDATES flag specified | |
1019 | wxUPDATE_UI_PROCESS_SPECIFIED | |
1020 | }; | |
1021 | ||
1022 | ||
1023 | ||
1024 | class wxUpdateUIEvent : public wxCommandEvent | |
1025 | { | |
1026 | public: | |
1027 | wxUpdateUIEvent(wxWindowID commandId = 0); | |
1028 | ||
1029 | bool GetChecked() const; | |
1030 | bool GetEnabled() const; | |
1031 | wxString GetText() const; | |
1032 | bool GetSetText() const; | |
1033 | bool GetSetChecked() const; | |
1034 | bool GetSetEnabled() const; | |
1035 | ||
1036 | void Check(bool check); | |
1037 | void Enable(bool enable); | |
1038 | void SetText(const wxString& text); | |
1039 | ||
1040 | // Sets the interval between updates in milliseconds. | |
1041 | // Set to -1 to disable updates, or to 0 to update as frequently as possible. | |
1042 | static void SetUpdateInterval(long updateInterval); | |
1043 | ||
1044 | // Returns the current interval between updates in milliseconds | |
1045 | static long GetUpdateInterval(); | |
1046 | ||
1047 | // Can we update this window? | |
1048 | static bool CanUpdate(wxWindow *win); | |
1049 | ||
1050 | // Reset the update time to provide a delay until the next | |
1051 | // time we should update | |
1052 | static void ResetUpdateTime(); | |
1053 | ||
1054 | // Specify how wxWindows will send update events: to | |
1055 | // all windows, or only to those which specify that they | |
1056 | // will process the events. | |
1057 | static void SetMode(wxUpdateUIMode mode); | |
1058 | ||
1059 | // Returns the UI update mode | |
1060 | static wxUpdateUIMode GetMode(); | |
1061 | }; | |
1062 | ||
1063 | //--------------------------------------------------------------------------- | |
1064 | %newgroup; | |
1065 | ||
1066 | class wxSysColourChangedEvent: public wxEvent { | |
1067 | public: | |
1068 | wxSysColourChangedEvent(); | |
1069 | }; | |
1070 | ||
1071 | //--------------------------------------------------------------------------- | |
1072 | %newgroup; | |
1073 | ||
1074 | ||
1075 | // wxEVT_MOUSE_CAPTURE_CHANGED | |
1076 | // The window losing the capture receives this message | |
1077 | // (even if it released the capture itself). | |
1078 | class wxMouseCaptureChangedEvent : public wxEvent | |
1079 | { | |
1080 | public: | |
1081 | wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL); | |
1082 | ||
1083 | wxWindow* GetCapturedWindow() const; | |
1084 | }; | |
1085 | ||
1086 | //--------------------------------------------------------------------------- | |
1087 | %newgroup; | |
1088 | ||
1089 | class wxDisplayChangedEvent : public wxEvent | |
1090 | { | |
1091 | public: | |
1092 | wxDisplayChangedEvent(); | |
1093 | }; | |
1094 | ||
1095 | //--------------------------------------------------------------------------- | |
1096 | %newgroup; | |
1097 | ||
1098 | class wxPaletteChangedEvent : public wxEvent | |
1099 | { | |
1100 | public: | |
1101 | wxPaletteChangedEvent(wxWindowID id = 0); | |
1102 | ||
1103 | void SetChangedWindow(wxWindow* win); | |
1104 | wxWindow* GetChangedWindow(); | |
1105 | ||
1106 | }; | |
1107 | ||
1108 | //--------------------------------------------------------------------------- | |
1109 | %newgroup; | |
1110 | ||
1111 | ||
1112 | // wxEVT_QUERY_NEW_PALETTE | |
1113 | // Indicates the window is getting keyboard focus and should re-do its palette. | |
1114 | class wxQueryNewPaletteEvent : public wxEvent | |
1115 | { | |
1116 | public: | |
1117 | wxQueryNewPaletteEvent(wxWindowID winid = 0); | |
1118 | ||
1119 | // App sets this if it changes the palette. | |
1120 | void SetPaletteRealized(bool realized); | |
1121 | bool GetPaletteRealized() const; | |
1122 | }; | |
1123 | ||
1124 | //--------------------------------------------------------------------------- | |
1125 | %newgroup; | |
1126 | ||
1127 | ||
1128 | // Event generated by dialog navigation keys | |
1129 | // wxEVT_NAVIGATION_KEY | |
1130 | ||
1131 | class wxNavigationKeyEvent : public wxEvent | |
1132 | { | |
1133 | public: | |
1134 | wxNavigationKeyEvent(); | |
1135 | ||
1136 | // direction: forward (True) or backward (False) | |
1137 | bool GetDirection() const; | |
1138 | void SetDirection(bool forward); | |
1139 | ||
1140 | // it may be a window change event (MDI, notebook pages...) or a control | |
1141 | // change event | |
1142 | bool IsWindowChange() const; | |
1143 | void SetWindowChange(bool ischange); | |
1144 | ||
1145 | // Set to true under MSW if the event was generated using the tab key. | |
1146 | // This is required for proper navogation over radio buttons | |
1147 | bool IsFromTab() const; | |
1148 | void SetFromTab(bool bIs); | |
1149 | ||
1150 | void SetFlags(long flags); | |
1151 | ||
1152 | // the child which has the focus currently (may be NULL - use | |
1153 | // wxWindow::FindFocus then) | |
1154 | wxWindow* GetCurrentFocus() const; | |
1155 | void SetCurrentFocus(wxWindow *win); | |
1156 | ||
1157 | enum { | |
1158 | IsBackward, | |
1159 | IsForward, | |
1160 | WinChange, | |
1161 | FromTab | |
1162 | }; | |
1163 | }; | |
1164 | ||
1165 | ||
1166 | //--------------------------------------------------------------------------- | |
1167 | %newgroup; | |
1168 | ||
1169 | // Window creation/destruction events: the first is sent as soon as window is | |
1170 | // created (i.e. the underlying GUI object exists), but when the C++ object is | |
1171 | // fully initialized (so virtual functions may be called). The second, | |
1172 | // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's | |
1173 | // still safe to call virtual functions at this moment | |
1174 | ||
1175 | class wxWindowCreateEvent : public wxCommandEvent | |
1176 | { | |
1177 | public: | |
1178 | wxWindowCreateEvent(wxWindow *win = NULL); | |
1179 | wxWindow *GetWindow() const; | |
1180 | }; | |
1181 | ||
1182 | class wxWindowDestroyEvent : public wxCommandEvent | |
1183 | { | |
1184 | public: | |
1185 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
1186 | wxWindow *GetWindow() const; | |
1187 | }; | |
1188 | ||
1189 | ||
1190 | //--------------------------------------------------------------------------- | |
1191 | %newgroup; | |
1192 | ||
1193 | // A Context event is sent when the user right clicks on a window or | |
1194 | // presses Shift-F10 | |
1195 | // NOTE : Under windows this is a repackaged WM_CONTETXMENU message | |
1196 | // Under other systems it may have to be generated from a right click event | |
1197 | /* | |
1198 | wxEVT_CONTEXT_MENU | |
1199 | */ | |
1200 | ||
1201 | class wxContextMenuEvent : public wxCommandEvent | |
1202 | { | |
1203 | public: | |
1204 | wxContextMenuEvent(wxEventType type = wxEVT_NULL, | |
1205 | wxWindowID winid = 0, | |
1206 | const wxPoint& pt = wxDefaultPosition); | |
1207 | ||
1208 | // Position of event (in screen coordinates) | |
1209 | const wxPoint& GetPosition() const; | |
1210 | void SetPosition(const wxPoint& pos); | |
1211 | }; | |
1212 | ||
1213 | //--------------------------------------------------------------------------- | |
1214 | %newgroup; | |
1215 | ||
1216 | // Whether to always send idle events to windows, or | |
1217 | // to only send update events to those with the | |
1218 | // wxWS_EX_PROCESS_IDLE style. | |
1219 | ||
1220 | enum wxIdleMode | |
1221 | { | |
1222 | // Send idle events to all windows | |
1223 | wxIDLE_PROCESS_ALL, | |
1224 | ||
1225 | // Send idle events to windows that have | |
1226 | // the wxWS_EX_PROCESS_IDLE flag specified | |
1227 | wxIDLE_PROCESS_SPECIFIED | |
1228 | }; | |
1229 | ||
1230 | ||
1231 | class wxIdleEvent : public wxEvent | |
1232 | { | |
1233 | public: | |
1234 | wxIdleEvent(); | |
1235 | ||
1236 | void RequestMore(bool needMore = true); | |
1237 | bool MoreRequested() const; | |
1238 | ||
1239 | // Specify how wxWindows will send idle events: to | |
1240 | // all windows, or only to those which specify that they | |
1241 | // will process the events. | |
1242 | static void SetMode(wxIdleMode mode); | |
1243 | ||
1244 | // Returns the idle event mode | |
1245 | static wxIdleMode GetMode(); | |
1246 | ||
1247 | // Can we send an idle event? | |
1248 | static bool CanSend(wxWindow* win); | |
1249 | }; | |
1250 | ||
1251 | //--------------------------------------------------------------------------- | |
1252 | %newgroup; | |
1253 | ||
1254 | // These classes can be derived from in Python and passed through the event | |
1255 | // system without loosing anything. They do this by keeping a reference to | |
1256 | // themselves and some special case handling in wxPyCallback::EventThunker. | |
1257 | ||
1258 | class wxPyEvent : public wxEvent { | |
1259 | public: | |
1260 | %pythonAppend wxPyEvent "self.SetSelf(self)" | |
1261 | wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL ); | |
1262 | ~wxPyEvent(); | |
1263 | ||
1264 | ||
1265 | void SetSelf(PyObject* self); | |
1266 | PyObject* GetSelf(); | |
1267 | }; | |
1268 | ||
1269 | ||
1270 | class wxPyCommandEvent : public wxCommandEvent { | |
1271 | public: | |
1272 | %pythonAppend wxPyCommandEvent "self.SetSelf(self)" | |
1273 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); | |
1274 | ~wxPyCommandEvent(); | |
1275 | ||
1276 | void SetSelf(PyObject* self); | |
1277 | PyObject* GetSelf(); | |
1278 | }; | |
1279 | ||
1280 | ||
1281 | ||
1282 | //--------------------------------------------------------------------------- | |
1283 | ||
1284 | ||
1285 | class wxDateEvent : public wxCommandEvent | |
1286 | { | |
1287 | public: | |
1288 | wxDateEvent(wxWindow *win, const wxDateTime& dt, wxEventType type); | |
1289 | ||
1290 | const wxDateTime& GetDate() const; | |
1291 | void SetDate(const wxDateTime &date); | |
1292 | ||
1293 | }; | |
1294 | ||
1295 | ||
1296 | %constant wxEventType wxEVT_DATE_CHANGED; | |
1297 | ||
1298 | %pythoncode { | |
1299 | EVT_DATE_CHANGED = wx.PyEventBinder( wxEVT_DATE_CHANGED, 1 ) | |
1300 | } | |
1301 | ||
1302 | ||
1303 | //--------------------------------------------------------------------------- |