]> git.saurik.com Git - wxWidgets.git/blame - src/common/event.cpp
toplevel code transferred to wxTopLevelWindow
[wxWidgets.git] / src / common / event.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: event.cpp
3// Purpose: Event classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
e90c1d2a 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
8e193f38
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
c801d85f 20#ifdef __GNUG__
0b746ba8 21 #pragma implementation "event.h"
c801d85f
KB
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
0b746ba8 28 #pragma hdrstop
c801d85f
KB
29#endif
30
31#ifndef WX_PRECOMP
0b746ba8 32 #include "wx/defs.h"
0b746ba8 33 #include "wx/app.h"
e90c1d2a
VZ
34 #include "wx/list.h"
35
36 #if wxUSE_GUI
37 #include "wx/control.h"
38 #include "wx/utils.h"
39 #include "wx/dc.h"
40 #endif // wxUSE_GUI
c801d85f
KB
41#endif
42
43#include "wx/event.h"
e90c1d2a
VZ
44
45#if wxUSE_GUI
46 #include "wx/validate.h"
47#endif // wxUSE_GUI
c801d85f 48
8e193f38
VZ
49// ----------------------------------------------------------------------------
50// wxWin macros
51// ----------------------------------------------------------------------------
52
23f681ec
VZ
53IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
54IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
e90c1d2a 55
23f681ec 56#if wxUSE_GUI
6b55490a 57 IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
23f681ec
VZ
58 IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
59 IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
60 IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
61 IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent)
62 IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
63 IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)
64 IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent)
65 IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent)
1e6feb95 66 IMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent, wxEvent)
23f681ec
VZ
67 IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
68 IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
69 IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
456bc6d9 70 IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent)
23f681ec
VZ
71 IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent)
72 IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent)
73 IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent)
74 IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent, wxEvent)
75 IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent)
76 IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent)
77 IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent)
78 IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent)
79 IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
8e72b8b5 80 IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent)
23f681ec
VZ
81 IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
82 IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent)
83 IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent)
84 IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent)
85 IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent)
86 IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent)
87 IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent)
b96340e6 88 IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent)
69231000 89 IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent)
23f681ec 90#endif // wxUSE_GUI
0b746ba8 91
23f681ec
VZ
92const wxEventTable *wxEvtHandler::GetEventTable() const
93 { return &wxEvtHandler::sm_eventTable; }
0b746ba8 94
23f681ec
VZ
95const wxEventTable wxEvtHandler::sm_eventTable =
96 { (const wxEventTable *)NULL, &wxEvtHandler::sm_eventTableEntries[0] };
0b746ba8 97
23f681ec 98const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] =
9aaf9bed 99 { DECLARE_EVENT_TABLE_ENTRY(wxEVT_NULL, 0, 0, (wxObjectEventFunction)NULL, NULL) };
c801d85f 100
8e193f38
VZ
101// ----------------------------------------------------------------------------
102// global variables
103// ----------------------------------------------------------------------------
104
105// To put pending event handlers
106wxList *wxPendingEvents = (wxList *)NULL;
107
7214297d 108#if wxUSE_THREADS
8e193f38
VZ
109 // protects wxPendingEvents list
110 wxCriticalSection *wxPendingEventsLocker = (wxCriticalSection *)NULL;
7214297d
GL
111#endif
112
cbee8f8d
VZ
113#if !WXWIN_COMPATIBILITY_EVENT_TYPES
114
2e4df4bf
VZ
115// common event types are defined here, other event types are defined by the
116// components which use them
117
461697c2 118DEFINE_EVENT_TYPE(wxEVT_NULL)
2e4df4bf
VZ
119DEFINE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED)
120DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED)
121DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED)
122DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED)
123DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED)
124DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED)
2e4df4bf
VZ
125DEFINE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED)
126DEFINE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED)
127DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED)
128DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED)
129DEFINE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED)
130DEFINE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED)
131DEFINE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED)
132DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED)
133DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER)
134DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED)
0b5eceb6
VZ
135
136// Sockets and timers send events, too
2e4df4bf
VZ
137DEFINE_EVENT_TYPE(wxEVT_SOCKET)
138DEFINE_EVENT_TYPE(wxEVT_TIMER)
0b5eceb6
VZ
139
140// Mouse event types
2e4df4bf
VZ
141DEFINE_EVENT_TYPE(wxEVT_LEFT_DOWN)
142DEFINE_EVENT_TYPE(wxEVT_LEFT_UP)
143DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DOWN)
144DEFINE_EVENT_TYPE(wxEVT_MIDDLE_UP)
145DEFINE_EVENT_TYPE(wxEVT_RIGHT_DOWN)
146DEFINE_EVENT_TYPE(wxEVT_RIGHT_UP)
147DEFINE_EVENT_TYPE(wxEVT_MOTION)
148DEFINE_EVENT_TYPE(wxEVT_ENTER_WINDOW)
149DEFINE_EVENT_TYPE(wxEVT_LEAVE_WINDOW)
150DEFINE_EVENT_TYPE(wxEVT_LEFT_DCLICK)
151DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK)
152DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK)
153DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS)
154DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS)
456bc6d9 155DEFINE_EVENT_TYPE(wxEVT_CHILD_FOCUS)
d2c52078 156DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL)
0b5eceb6
VZ
157
158// Non-client mouse events
2e4df4bf
VZ
159DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN)
160DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_UP)
161DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN)
162DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP)
163DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN)
164DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_UP)
165DEFINE_EVENT_TYPE(wxEVT_NC_MOTION)
166DEFINE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW)
167DEFINE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW)
168DEFINE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK)
169DEFINE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK)
170DEFINE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK)
0b5eceb6
VZ
171
172// Character input event type
2e4df4bf
VZ
173DEFINE_EVENT_TYPE(wxEVT_CHAR)
174DEFINE_EVENT_TYPE(wxEVT_CHAR_HOOK)
175DEFINE_EVENT_TYPE(wxEVT_NAVIGATION_KEY)
176DEFINE_EVENT_TYPE(wxEVT_KEY_DOWN)
177DEFINE_EVENT_TYPE(wxEVT_KEY_UP)
0b5eceb6
VZ
178
179// Set cursor event
2e4df4bf 180DEFINE_EVENT_TYPE(wxEVT_SET_CURSOR)
0b5eceb6
VZ
181
182// wxScrollbar and wxSlider event identifiers
2e4df4bf
VZ
183DEFINE_EVENT_TYPE(wxEVT_SCROLL_TOP)
184DEFINE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM)
185DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEUP)
186DEFINE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN)
187DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP)
188DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN)
189DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK)
190DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE)
0b5eceb6
VZ
191
192// Scroll events from wxWindow
2e4df4bf
VZ
193DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP)
194DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM)
195DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP)
196DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN)
197DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP)
198DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN)
199DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK)
200DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE)
0b5eceb6
VZ
201
202// System events
2e4df4bf
VZ
203DEFINE_EVENT_TYPE(wxEVT_SIZE)
204DEFINE_EVENT_TYPE(wxEVT_MOVE)
205DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW)
206DEFINE_EVENT_TYPE(wxEVT_END_SESSION)
207DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION)
208DEFINE_EVENT_TYPE(wxEVT_ACTIVATE_APP)
209DEFINE_EVENT_TYPE(wxEVT_POWER)
210DEFINE_EVENT_TYPE(wxEVT_ACTIVATE)
211DEFINE_EVENT_TYPE(wxEVT_CREATE)
212DEFINE_EVENT_TYPE(wxEVT_DESTROY)
213DEFINE_EVENT_TYPE(wxEVT_SHOW)
214DEFINE_EVENT_TYPE(wxEVT_ICONIZE)
215DEFINE_EVENT_TYPE(wxEVT_MAXIMIZE)
216DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED)
217DEFINE_EVENT_TYPE(wxEVT_PAINT)
218DEFINE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND)
219DEFINE_EVENT_TYPE(wxEVT_NC_PAINT)
220DEFINE_EVENT_TYPE(wxEVT_PAINT_ICON)
221DEFINE_EVENT_TYPE(wxEVT_MENU_CHAR)
222DEFINE_EVENT_TYPE(wxEVT_MENU_INIT)
223DEFINE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT)
224DEFINE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT)
225DEFINE_EVENT_TYPE(wxEVT_CONTEXT_MENU)
226DEFINE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED)
227DEFINE_EVENT_TYPE(wxEVT_SETTING_CHANGED)
228DEFINE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE)
229DEFINE_EVENT_TYPE(wxEVT_PALETTE_CHANGED)
230DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN)
231DEFINE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP)
232DEFINE_EVENT_TYPE(wxEVT_JOY_MOVE)
233DEFINE_EVENT_TYPE(wxEVT_JOY_ZMOVE)
234DEFINE_EVENT_TYPE(wxEVT_DROP_FILES)
235DEFINE_EVENT_TYPE(wxEVT_DRAW_ITEM)
236DEFINE_EVENT_TYPE(wxEVT_MEASURE_ITEM)
237DEFINE_EVENT_TYPE(wxEVT_COMPARE_ITEM)
238DEFINE_EVENT_TYPE(wxEVT_INIT_DIALOG)
239DEFINE_EVENT_TYPE(wxEVT_IDLE)
240DEFINE_EVENT_TYPE(wxEVT_UPDATE_UI)
0b5eceb6
VZ
241
242// Generic command events
243// Note: a click is a higher-level event than button down/up
2e4df4bf
VZ
244DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK)
245DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK)
246DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK)
247DEFINE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK)
248DEFINE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS)
249DEFINE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS)
250DEFINE_EVENT_TYPE(wxEVT_COMMAND_ENTER)
0b5eceb6
VZ
251
252// Help events
2e4df4bf
VZ
253DEFINE_EVENT_TYPE(wxEVT_HELP)
254DEFINE_EVENT_TYPE(wxEVT_DETAILED_HELP)
6164f93c
VZ
255
256#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
257
258// ============================================================================
259// implementation
260// ============================================================================
0b5eceb6 261
0b5eceb6
VZ
262// ----------------------------------------------------------------------------
263// event initialization
264// ----------------------------------------------------------------------------
265
266int wxNewEventType()
267{
268 // MT-FIXME
269 static int s_lastUsedEventType = wxEVT_FIRST;
270
cbee8f8d
VZ
271#if WXWIN_COMPATIBILITY_2
272 // check that we don't overlap with the user-defined types: if it does
273 // happen, the best solution is probably to update the existing code to
274 // use wxNewEventType() instead of wxEVT_USER_FIRST
6164f93c
VZ
275 //
276 // due to the uncertainty
cbee8f8d
VZ
277 wxASSERT_MSG( s_lastUsedEventType < wxEVT_USER_FIRST - 1,
278 _T("possible event type conflict") );
279#endif // WXWIN_COMPATIBILITY_2
280
0b5eceb6
VZ
281 return s_lastUsedEventType++;
282}
283
8e193f38
VZ
284// ----------------------------------------------------------------------------
285// wxEvent
286// ----------------------------------------------------------------------------
287
c801d85f
KB
288/*
289 * General wxWindows events, covering
290 * all interesting things that might happen (button clicking, resizing,
291 * setting text in widgets, etc.).
292 *
293 * For each completely new event type, derive a new event class.
294 *
295 */
296
8e72b8b5 297wxEvent::wxEvent(int theId, wxEventType commandType )
c801d85f 298{
8e72b8b5 299 m_eventType = commandType;
0b746ba8 300 m_eventObject = (wxObject *) NULL;
0b746ba8
VZ
301 m_timeStamp = 0;
302 m_id = theId;
303 m_skipped = FALSE;
304 m_callbackUserData = (wxObject *) NULL;
193bf013 305 m_isCommandEvent = FALSE;
c801d85f
KB
306}
307
8e72b8b5 308wxEvent::wxEvent(const wxEvent &src)
a737331d 309{
8e72b8b5
RR
310 m_eventType = src.m_eventType;
311 m_eventObject = src.m_eventObject;
312 m_timeStamp = src.m_timeStamp;
313 m_id = src.m_id;
314 m_skipped = src.m_skipped;
315 m_callbackUserData = src.m_callbackUserData;
316 m_isCommandEvent = src.m_isCommandEvent;
a737331d
GL
317}
318
e90c1d2a
VZ
319#if wxUSE_GUI
320
c801d85f
KB
321/*
322 * Command events
323 *
324 */
325
7798a18e 326wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId)
8e72b8b5 327 : wxEvent( theId, commandType )
c801d85f 328{
0b746ba8
VZ
329 m_clientData = (char *) NULL;
330 m_clientObject = (wxClientData *) NULL;
331 m_extraLong = 0;
332 m_commandInt = 0;
04392d70 333 m_commandString = wxEmptyString;
193bf013 334 m_isCommandEvent = TRUE;
c801d85f
KB
335}
336
337/*
338 * Scroll events
339 */
340
0b746ba8
VZ
341wxScrollEvent::wxScrollEvent(wxEventType commandType,
342 int id,
343 int pos,
344 int orient)
345 : wxCommandEvent(commandType, id)
c801d85f 346{
0b746ba8
VZ
347 m_extraLong = orient;
348 m_commandInt = pos;
c801d85f
KB
349}
350
d1367c3d
RR
351/*
352 * ScrollWin events
353 */
354
355wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType,
356 int pos,
357 int orient)
d1367c3d 358{
c5b42c87 359 m_eventType = commandType;
d1367c3d
RR
360 m_extraLong = orient;
361 m_commandInt = pos;
362}
363
c801d85f
KB
364/*
365 * Mouse events
366 *
367 */
368
7798a18e 369wxMouseEvent::wxMouseEvent(wxEventType commandType)
c801d85f 370{
0b746ba8
VZ
371 m_eventType = commandType;
372 m_metaDown = FALSE;
373 m_altDown = FALSE;
374 m_controlDown = FALSE;
375 m_shiftDown = FALSE;
376 m_leftDown = FALSE;
377 m_rightDown = FALSE;
378 m_middleDown = FALSE;
379 m_x = 0;
380 m_y = 0;
d2c52078
RD
381 m_wheelRotation = 0;
382 m_wheelDelta = 0;
383 m_linesPerAction = 0;
c801d85f
KB
384}
385
386// True if was a button dclick event (1 = left, 2 = middle, 3 = right)
387// or any button dclick event (but = -1)
388bool wxMouseEvent::ButtonDClick(int but) const
389{
0b746ba8
VZ
390 switch (but)
391 {
392 case -1:
393 return (LeftDClick() || MiddleDClick() || RightDClick());
394 case 1:
395 return LeftDClick();
396 case 2:
397 return MiddleDClick();
398 case 3:
399 return RightDClick();
400 default:
223d09f6 401 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
0b746ba8
VZ
402 }
403
404 return FALSE;
c801d85f
KB
405}
406
407// True if was a button down event (1 = left, 2 = middle, 3 = right)
408// or any button down event (but = -1)
409bool wxMouseEvent::ButtonDown(int but) const
410{
0b746ba8
VZ
411 switch (but)
412 {
413 case -1:
414 return (LeftDown() || MiddleDown() || RightDown());
415 case 1:
416 return LeftDown();
417 case 2:
418 return MiddleDown();
419 case 3:
420 return RightDown();
421 default:
223d09f6 422 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
0b746ba8
VZ
423 }
424
425 return FALSE;
c801d85f
KB
426}
427
428// True if was a button up event (1 = left, 2 = middle, 3 = right)
429// or any button up event (but = -1)
430bool wxMouseEvent::ButtonUp(int but) const
431{
1e6feb95
VZ
432 switch (but)
433 {
0b746ba8
VZ
434 case -1:
435 return (LeftUp() || MiddleUp() || RightUp());
436 case 1:
437 return LeftUp();
438 case 2:
439 return MiddleUp();
440 case 3:
441 return RightUp();
442 default:
223d09f6 443 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
0b746ba8
VZ
444 }
445
446 return FALSE;
c801d85f
KB
447}
448
449// True if the given button is currently changing state
450bool wxMouseEvent::Button(int but) const
451{
1e6feb95
VZ
452 switch (but)
453 {
0b746ba8 454 case -1:
72cdf4c9 455 return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1));
0b746ba8
VZ
456 case 1:
457 return (LeftDown() || LeftUp() || LeftDClick());
458 case 2:
459 return (MiddleDown() || MiddleUp() || MiddleDClick());
460 case 3:
461 return (RightDown() || RightUp() || RightDClick());
462 default:
223d09f6 463 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button"));
0b746ba8
VZ
464 }
465
466 return FALSE;
c801d85f
KB
467}
468
469bool wxMouseEvent::ButtonIsDown(int but) const
470{
1e6feb95
VZ
471 switch (but)
472 {
0b746ba8
VZ
473 case -1:
474 return (LeftIsDown() || MiddleIsDown() || RightIsDown());
475 case 1:
476 return LeftIsDown();
477 case 2:
478 return MiddleIsDown();
479 case 3:
480 return RightIsDown();
481 default:
223d09f6 482 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
0b746ba8
VZ
483 }
484
485 return FALSE;
c801d85f
KB
486}
487
1e6feb95
VZ
488int wxMouseEvent::GetButton() const
489{
490 for ( int i = 1; i <= 3; i++ )
491 {
492 if ( Button(i) )
493 {
494 return i;
495 }
496 }
497
498 return -1;
499}
500
c801d85f
KB
501// Find the logical position of the event given the DC
502wxPoint wxMouseEvent::GetLogicalPosition(const wxDC& dc) const
503{
0757d27c
JS
504 wxPoint pt(dc.DeviceToLogicalX(m_x), dc.DeviceToLogicalY(m_y));
505 return pt;
c801d85f
KB
506}
507
508
509/*
8e72b8b5 510 * Keyboard event
c801d85f
KB
511 *
512 */
513
7798a18e 514wxKeyEvent::wxKeyEvent(wxEventType type)
c801d85f 515{
0b746ba8
VZ
516 m_eventType = type;
517 m_shiftDown = FALSE;
518 m_controlDown = FALSE;
519 m_metaDown = FALSE;
520 m_altDown = FALSE;
521 m_keyCode = 0;
b0e813a0 522 m_scanCode = 0;
c801d85f
KB
523}
524
aadbdf11 525
42e69d6b 526wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
42e69d6b 527{
cfe17b74 528 SetEventType(wxEVT_CREATE);
42e69d6b
VZ
529 SetEventObject(win);
530}
531
532wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win)
42e69d6b 533{
cfe17b74 534 SetEventType(wxEVT_DESTROY);
42e69d6b
VZ
535 SetEventObject(win);
536}
537
456bc6d9
VZ
538wxChildFocusEvent::wxChildFocusEvent(wxWindow *win)
539 : wxCommandEvent(wxEVT_CHILD_FOCUS)
540{
541 SetEventObject(win);
542}
543
dd070522
VZ
544#endif // wxUSE_GUI
545
456bc6d9
VZ
546// ----------------------------------------------------------------------------
547// wxEvtHandler
548// ----------------------------------------------------------------------------
549
c801d85f
KB
550/*
551 * Event handler
552 */
553
0b746ba8 554wxEvtHandler::wxEvtHandler()
c801d85f 555{
0b746ba8
VZ
556 m_nextHandler = (wxEvtHandler *) NULL;
557 m_previousHandler = (wxEvtHandler *) NULL;
558 m_enabled = TRUE;
559 m_dynamicEvents = (wxList *) NULL;
193bf013 560 m_isWindow = FALSE;
8e193f38 561 m_pendingEvents = (wxList *) NULL;
7214297d 562#if wxUSE_THREADS
41404da7 563# if !defined(__VISAGECPP__)
8e193f38 564 m_eventsLocker = new wxCriticalSection;
41404da7 565# endif
7214297d 566#endif
b88c44e7
RD
567 // no client data (yet)
568 m_clientData = NULL;
569 m_clientDataType = wxClientData_None;
c801d85f
KB
570}
571
0b746ba8 572wxEvtHandler::~wxEvtHandler()
c801d85f 573{
0b746ba8
VZ
574 // Takes itself out of the list of handlers
575 if (m_previousHandler)
576 m_previousHandler->m_nextHandler = m_nextHandler;
577
578 if (m_nextHandler)
579 m_nextHandler->m_previousHandler = m_previousHandler;
580
581 if (m_dynamicEvents)
fe71f65c 582 {
0b746ba8
VZ
583 wxNode *node = m_dynamicEvents->First();
584 while (node)
585 {
2e4df4bf
VZ
586#if WXWIN_COMPATIBILITY_EVENT_TYPES
587 wxEventTableEntry *entry = (wxEventTableEntry*)node->Data();
588#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
77d4384e 589 wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data();
2e4df4bf
VZ
590#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
591
592 if (entry->m_callbackUserData)
593 delete entry->m_callbackUserData;
0b746ba8
VZ
594 delete entry;
595 node = node->Next();
596 }
597 delete m_dynamicEvents;
598 };
7214297d 599
8e193f38 600 delete m_pendingEvents;
7214297d 601
8e193f38 602#if wxUSE_THREADS
41404da7 603# if !defined(__VISAGECPP__)
7214297d 604 delete m_eventsLocker;
41404da7 605# endif
7214297d 606#endif
b88c44e7
RD
607
608 // we only delete object data, not untyped
609 if ( m_clientDataType == wxClientData_Object )
610 delete m_clientObject;
c801d85f
KB
611}
612
7214297d 613#if wxUSE_THREADS
aadbdf11 614
7214297d
GL
615bool wxEvtHandler::ProcessThreadEvent(wxEvent& event)
616{
7214297d 617 // check that we are really in a child thread
8e193f38
VZ
618 wxASSERT_MSG( !wxThread::IsMain(),
619 wxT("use ProcessEvent() in main thread") );
620
621 AddPendingEvent(event);
7214297d 622
8e193f38
VZ
623 return TRUE;
624}
625
626#endif // wxUSE_THREADS
627
628void wxEvtHandler::AddPendingEvent(wxEvent& event)
629{
16c1f79c
RR
630 // 1) Add event to list of pending events of this event handler
631
7a5c8ac4
VZ
632 wxEvent *eventCopy = event.Clone();
633
634 // we must be able to copy the events here so the event class must
635 // implement Clone() properly instead of just providing a NULL stab for it
636 wxCHECK_RET( eventCopy,
637 _T("events of this type aren't supposed to be posted") );
638
16c1f79c
RR
639#if defined(__VISAGECPP__)
640 wxENTER_CRIT_SECT( m_eventsLocker);
641#else
642 wxENTER_CRIT_SECT( *m_eventsLocker);
643#endif
644
8e193f38
VZ
645 if ( !m_pendingEvents )
646 m_pendingEvents = new wxList;
7214297d 647
7a5c8ac4 648 m_pendingEvents->Append(eventCopy);
7214297d 649
16c1f79c
RR
650#if defined(__VISAGECPP__)
651 wxLEAVE_CRIT_SECT( m_eventsLocker);
652#else
653 wxLEAVE_CRIT_SECT( *m_eventsLocker);
654#endif
655
656 // 2) Add this event handler to list of event handlers that
657 // have pending events.
cfe17b74 658
b568d04f 659 wxENTER_CRIT_SECT(*wxPendingEventsLocker);
72cdf4c9 660
8e193f38
VZ
661 if ( !wxPendingEvents )
662 wxPendingEvents = new wxList;
4d3a259a 663 wxPendingEvents->Append(this);
72cdf4c9 664
ce6d2511 665 wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
6164f93c 666
16c1f79c
RR
667 // 3) Inform the system that new pending events are somwehere,
668 // and that these should be processed in idle time.
bf9e3e73 669 wxWakeUpIdle();
7214297d
GL
670}
671
672void wxEvtHandler::ProcessPendingEvents()
673{
41404da7 674#if defined(__VISAGECPP__)
16c1f79c 675 wxENTER_CRIT_SECT( m_eventsLocker);
b568d04f 676#else
16c1f79c 677 wxENTER_CRIT_SECT( *m_eventsLocker);
41404da7 678#endif
8e193f38 679
7214297d 680 wxNode *node = m_pendingEvents->First();
8e193f38
VZ
681 while ( node )
682 {
16c1f79c
RR
683 wxEvent *event = (wxEvent *)node->Data();
684 delete node;
cfe17b74 685
16c1f79c 686 // In ProcessEvent, new events might get added and
6164f93c 687 // we can safely leave the crtical section here.
16c1f79c
RR
688#if defined(__VISAGECPP__)
689 wxLEAVE_CRIT_SECT( m_eventsLocker);
690#else
691 wxLEAVE_CRIT_SECT( *m_eventsLocker);
692#endif
8e193f38 693 ProcessEvent(*event);
9779893b 694 delete event;
16c1f79c
RR
695#if defined(__VISAGECPP__)
696 wxENTER_CRIT_SECT( m_eventsLocker);
697#else
698 wxENTER_CRIT_SECT( *m_eventsLocker);
699#endif
cfe17b74 700
8e193f38 701 node = m_pendingEvents->First();
7214297d 702 }
cfe17b74 703
16c1f79c
RR
704#if defined(__VISAGECPP__)
705 wxLEAVE_CRIT_SECT( m_eventsLocker);
706#else
707 wxLEAVE_CRIT_SECT( *m_eventsLocker);
708#endif
7214297d 709}
7214297d 710
c801d85f
KB
711/*
712 * Event table stuff
713 */
714
715bool wxEvtHandler::ProcessEvent(wxEvent& event)
716{
e90c1d2a 717#if wxUSE_GUI
1a77875b 718
01f944e6
GD
719 // We have to use the actual window or processing events from
720 // wxWindowNative destructor won't work (we don't see the wxWindow class)
1a77875b 721#ifdef __WXDEBUG__
8e193f38 722 // check that our flag corresponds to reality
1a77875b
JS
723 wxClassInfo* info = NULL;
724#ifdef __WXUNIVERSAL__
725# if defined(__WXMSW__)
726 info = CLASSINFO(wxWindowMSW);
727# elif defined(__WXGTK__)
728 info = CLASSINFO(wxWindowGTK);
729# elif defined(__WXMGL__)
730 info = CLASSINFO(wxWindowMGL);
19193a2c
KB
731# elif defined(__WXPM__)
732 info = CLASSINFO(wxWindowOS2);
1a77875b
JS
733# elif defined(__WXMAC__)
734 info = CLASSINFO(wxWindowMac);
735# elif defined(__WXMOTIF__)
736 info = CLASSINFO(wxWindowMotif);
737# endif
738#else
739 info = CLASSINFO(wxWindow);
740#endif
741
742 wxASSERT_MSG( m_isWindow == IsKindOf(info),
01f944e6 743 wxString(GetClassInfo()->GetClassName()) + _T(" should [not] be a window but it is [not]") );
1a77875b
JS
744#endif
745
e90c1d2a 746#endif // wxUSE_GUI
0b746ba8 747
8e193f38 748 // An event handler can be enabled or disabled
0b746ba8 749 if ( GetEvtHandlerEnabled() )
c801d85f 750 {
6164f93c 751
924ef850
RR
752#if 0
753/*
754 What is this? When using GUI threads, a non main
755 threads can send an event and process it itself.
756 This breaks GTK's GUI threads, so please explain.
757*/
758
8e193f38
VZ
759 // Check whether we are in a child thread.
760 if ( !wxThread::IsMain() )
7214297d 761 return ProcessThreadEvent(event);
924ef850 762#endif
0757d27c 763
8e193f38 764 // Handle per-instance dynamic event tables first
193bf013 765 if ( m_dynamicEvents && SearchDynamicEventTable(event) )
0757d27c 766 return TRUE;
0b746ba8 767
8e193f38 768 // Then static per-class event tables
0b746ba8
VZ
769 const wxEventTable *table = GetEventTable();
770
e90c1d2a 771#if wxUSE_GUI && wxUSE_VALIDATORS
0b746ba8
VZ
772 // Try the associated validator first, if this is a window.
773 // Problem: if the event handler of the window has been replaced,
774 // this wxEvtHandler may no longer be a window.
775 // Therefore validators won't be processed if the handler
776 // has been replaced with SetEventHandler.
777 // THIS CAN BE CURED if PushEventHandler is used instead of
778 // SetEventHandler, and then processing will be passed down the
779 // chain of event handlers.
ce4169a4 780 if (m_isWindow)
0b746ba8
VZ
781 {
782 wxWindow *win = (wxWindow *)this;
783
784 // Can only use the validator of the window which
785 // is receiving the event
193bf013 786 if ( win == event.GetEventObject() )
0b746ba8 787 {
193bf013
VZ
788 wxValidator *validator = win->GetValidator();
789 if ( validator && validator->ProcessEvent(event) )
790 {
791 return TRUE;
792 }
0b746ba8
VZ
793 }
794 }
ce4169a4 795#endif
0b746ba8
VZ
796
797 // Search upwards through the inheritance hierarchy
ce4169a4 798 while (table)
0b746ba8 799 {
193bf013 800 if ( SearchEventTable((wxEventTable&)*table, event) )
0b746ba8
VZ
801 return TRUE;
802 table = table->baseTable;
803 }
c801d85f
KB
804 }
805
0b746ba8
VZ
806 // Try going down the event handler chain
807 if ( GetNextHandler() )
c801d85f 808 {
0b746ba8
VZ
809 if ( GetNextHandler()->ProcessEvent(event) )
810 return TRUE;
c801d85f 811 }
c801d85f 812
e90c1d2a 813#if wxUSE_GUI
3bdc265d
VZ
814 // Carry on up the parent-child hierarchy, but only if event is a command
815 // event: it wouldn't make sense for a parent to receive a child's size
816 // event, for example
193bf013 817 if ( m_isWindow && event.IsCommandEvent() )
0b746ba8
VZ
818 {
819 wxWindow *win = (wxWindow *)this;
3bdc265d 820
e4b713a2
VZ
821 // honour the requests to stop propagation at this window: this is
822 // used by the dialogs, for example, to prevent processing the events
823 // from the dialog controls in the parent frame which rarely, if ever,
824 // makes sense
825 if ( !(win->GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
3bdc265d
VZ
826 {
827 wxWindow *parent = win->GetParent();
e4b713a2 828 if ( parent && !parent->IsBeingDeleted() )
3bdc265d
VZ
829 return parent->GetEventHandler()->ProcessEvent(event);
830 }
0b746ba8 831 }
e90c1d2a 832#endif // wxUSE_GUI
0b746ba8
VZ
833
834 // Last try - application object.
193bf013 835 if ( wxTheApp && (this != wxTheApp) )
0b746ba8 836 {
193bf013
VZ
837 // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
838 // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be
839 // processed appropriately via SearchEventTable.
840 if ( event.GetEventType() != wxEVT_IDLE )
841 {
842 if ( wxTheApp->ProcessEvent(event) )
843 return TRUE;
844 }
0b746ba8
VZ
845 }
846
c801d85f
KB
847 return FALSE;
848}
849
850bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event)
851{
68662769
VZ
852 wxEventType eventType = event.GetEventType();
853 int eventId = event.GetId();
0b746ba8 854
68662769
VZ
855 // BC++ doesn't like testing for m_fn without != 0
856 for ( int i = 0; table.entries[i].m_fn != 0; i++ )
c801d85f 857 {
6e58645e
VZ
858 // the line using reference exposes a bug in gcc: although it _seems_
859 // to work, it leads to weird crashes later on during program
860 // execution
861#ifdef __GNUG__
862 wxEventTableEntry entry = table.entries[i];
863#else
68662769 864 const wxEventTableEntry& entry = table.entries[i];
6e58645e 865#endif
68662769
VZ
866
867 // match only if the event type is the same and the id is either -1 in
868 // the event table (meaning "any") or the event id matches the id
869 // specified in the event table either exactly or by falling into
870 // range between first and last
871 if ( eventType == entry.m_eventType )
0b746ba8 872 {
68662769
VZ
873 int tableId1 = entry.m_id,
874 tableId2 = entry.m_lastId;
875
876 if ( (tableId1 == -1) ||
877 (tableId2 == -1 && eventId == tableId1) ||
878 (tableId2 != -1 &&
879 (eventId >= tableId1 && eventId <= tableId2)) )
880 {
881 event.Skip(FALSE);
882 event.m_callbackUserData = entry.m_callbackUserData;
0b746ba8 883
68662769 884 (this->*((wxEventFunction) (entry.m_fn)))(event);
0b746ba8 885
68662769
VZ
886 return !event.GetSkipped();
887 }
0b746ba8 888 }
c801d85f 889 }
68662769 890
0b746ba8 891 return FALSE;
c801d85f 892}
97d7bfb8 893
debe6624 894void wxEvtHandler::Connect( int id, int lastId,
77d4384e 895 int eventType,
0b746ba8
VZ
896 wxObjectEventFunction func,
897 wxObject *userData )
fe71f65c 898{
cbee8f8d 899#if WXWIN_COMPATIBILITY_EVENT_TYPES
2e4df4bf 900 wxEventTableEntry *entry = new wxEventTableEntry;
cbee8f8d
VZ
901 entry->m_eventType = eventType;
902 entry->m_id = id;
903 entry->m_lastId = lastId;
904 entry->m_fn = func;
905 entry->m_callbackUserData = userData;
906#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
0b5eceb6
VZ
907 wxDynamicEventTableEntry *entry =
908 new wxDynamicEventTableEntry(eventType, id, lastId, func, userData);
cbee8f8d 909#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
0b746ba8
VZ
910
911 if (!m_dynamicEvents)
912 m_dynamicEvents = new wxList;
913
914 m_dynamicEvents->Append( (wxObject*) entry );
fe71f65c 915}
97d7bfb8
RR
916
917bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType,
918 wxObjectEventFunction func,
919 wxObject *userData )
920{
921 if (!m_dynamicEvents)
922 return FALSE;
cfe17b74 923
97d7bfb8
RR
924 wxNode *node = m_dynamicEvents->First();
925 while (node)
926 {
2e4df4bf
VZ
927#if WXWIN_COMPATIBILITY_EVENT_TYPES
928 wxEventTableEntry *entry = (wxEventTableEntry*)node->Data();
929#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
930 wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data();
931#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
932
97d7bfb8
RR
933 if ((entry->m_id == id) &&
934 ((entry->m_lastId == lastId) || (lastId == -1)) &&
935 ((entry->m_eventType == eventType) || (eventType == wxEVT_NULL)) &&
936 ((entry->m_fn == func) || (func == (wxObjectEventFunction)NULL)) &&
937 ((entry->m_callbackUserData == userData) || (userData == (wxObject*)NULL)))
938 {
2e4df4bf
VZ
939 if (entry->m_callbackUserData)
940 delete entry->m_callbackUserData;
97d7bfb8
RR
941 m_dynamicEvents->DeleteNode( node );
942 delete entry;
943 return TRUE;
944 }
945 node = node->Next();
946 }
947 return FALSE;
948}
fe71f65c
RR
949
950bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
951{
193bf013 952 wxCHECK_MSG( m_dynamicEvents, FALSE,
223d09f6 953 wxT("caller should check that we have dynamic events") );
0b746ba8
VZ
954
955 int commandId = event.GetId();
956
957 wxNode *node = m_dynamicEvents->First();
958 while (node)
fe71f65c 959 {
2e4df4bf
VZ
960#if WXWIN_COMPATIBILITY_EVENT_TYPES
961 wxEventTableEntry *entry = (wxEventTableEntry*)node->Data();
962#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
963 wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data();
964#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
0b746ba8
VZ
965
966 if (entry->m_fn)
967 {
968 // Match, if event spec says any id will do (id == -1)
969 if ( (event.GetEventType() == entry->m_eventType) &&
970 (entry->m_id == -1 ||
971 (entry->m_lastId == -1 && commandId == entry->m_id) ||
972 (entry->m_lastId != -1 &&
973 (commandId >= entry->m_id && commandId <= entry->m_lastId))) )
974 {
975 event.Skip(FALSE);
976 event.m_callbackUserData = entry->m_callbackUserData;
977
978 (this->*((wxEventFunction) (entry->m_fn)))(event);
979
980 if (event.GetSkipped())
981 return FALSE;
982 else
983 return TRUE;
984 }
985 }
986 node = node->Next();
7b678698 987 }
0b746ba8 988 return FALSE;
fe71f65c
RR
989};
990
b88c44e7
RD
991void wxEvtHandler::DoSetClientObject( wxClientData *data )
992{
993 wxASSERT_MSG( m_clientDataType != wxClientData_Void,
994 wxT("can't have both object and void client data") );
995
996 if ( m_clientObject )
997 delete m_clientObject;
998
999 m_clientObject = data;
1000 m_clientDataType = wxClientData_Object;
1001}
1002
1003wxClientData *wxEvtHandler::DoGetClientObject() const
1004{
1005 // it's not an error to call GetClientObject() on a window which doesn't
1006 // have client data at all - NULL will be returned
1007 wxASSERT_MSG( m_clientDataType != wxClientData_Void,
1008 wxT("this window doesn't have object client data") );
1009
1010 return m_clientObject;
1011}
1012
1013void wxEvtHandler::DoSetClientData( void *data )
1014{
1015 wxASSERT_MSG( m_clientDataType != wxClientData_Object,
1016 wxT("can't have both object and void client data") );
1017
1018 m_clientData = data;
1019 m_clientDataType = wxClientData_Void;
1020}
1021
1022void *wxEvtHandler::DoGetClientData() const
1023{
1024 // it's not an error to call GetClientData() on a window which doesn't have
1025 // client data at all - NULL will be returned
1026 wxASSERT_MSG( m_clientDataType != wxClientData_Object,
1027 wxT("this window doesn't have void client data") );
1028
1029 return m_clientData;
1030}
1031
1032
e3065973 1033#if WXWIN_COMPATIBILITY
0b746ba8 1034bool wxEvtHandler::OnClose()
c801d85f 1035{
0b746ba8
VZ
1036 if (GetNextHandler())
1037 return GetNextHandler()->OnClose();
1038 else
1039 return FALSE;
c801d85f 1040}
193bf013 1041#endif // WXWIN_COMPATIBILITY
e3065973 1042
e90c1d2a
VZ
1043#if wxUSE_GUI
1044
e702ff0f
JS
1045// Find a window with the focus, that is also a descendant of the given window.
1046// This is used to determine the window to initially send commands to.
1047wxWindow* wxFindFocusDescendant(wxWindow* ancestor)
1048{
1049 // Process events starting with the window with the focus, if any.
1050 wxWindow* focusWin = wxWindow::FindFocus();
1051 wxWindow* win = focusWin;
1052
1053 // Check if this is a descendant of this frame.
1054 // If not, win will be set to NULL.
1055 while (win)
1056 {
1057 if (win == ancestor)
1058 break;
1059 else
1060 win = win->GetParent();
1061 }
1062 if (win == (wxWindow*) NULL)
1063 focusWin = (wxWindow*) NULL;
1064
1065 return focusWin;
1066}
1067
e90c1d2a 1068#endif // wxUSE_GUI