1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Event classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "event.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
37 #include "wx/control.h"
46 #include "wx/validate.h"
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler
, wxObject
)
54 IMPLEMENT_ABSTRACT_CLASS(wxEvent
, wxObject
)
55 IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent
, wxEvent
)
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
)
66 IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent
, wxEvent
)
67 IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent
, wxEvent
)
68 IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent
, wxEvent
)
69 IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent
, wxEvent
)
70 IMPLEMENT_DYNAMIC_CLASS(wxShowEvent
, wxEvent
)
71 IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent
, wxEvent
)
72 IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent
, wxEvent
)
73 IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent
, wxEvent
)
74 IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent
, wxEvent
)
75 IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent
, wxEvent
)
76 IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent
, wxEvent
)
77 IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent
, wxEvent
)
78 IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent
, wxEvent
)
79 IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent
, wxCommandEvent
)
80 IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent
, wxCommandEvent
)
81 IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent
, wxEvent
)
82 IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent
, wxEvent
)
83 IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent
, wxEvent
)
84 IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent
, wxEvent
)
87 const wxEventTable
*wxEvtHandler::GetEventTable() const
88 { return &wxEvtHandler::sm_eventTable
; }
90 const wxEventTable
wxEvtHandler::sm_eventTable
=
91 { (const wxEventTable
*)NULL
, &wxEvtHandler::sm_eventTableEntries
[0] };
93 const wxEventTableEntry
wxEvtHandler::sm_eventTableEntries
[] =
94 { { 0, 0, 0, (wxObjectEventFunction
) NULL
, (wxObject
*) NULL
} };
97 // ----------------------------------------------------------------------------
99 // ----------------------------------------------------------------------------
101 // To put pending event handlers
102 wxList
*wxPendingEvents
= (wxList
*)NULL
;
105 // protects wxPendingEvents list
106 wxCriticalSection
*wxPendingEventsLocker
= (wxCriticalSection
*)NULL
;
109 // ============================================================================
111 // ============================================================================
113 // ----------------------------------------------------------------------------
115 // ----------------------------------------------------------------------------
118 * General wxWindows events, covering
119 * all interesting things that might happen (button clicking, resizing,
120 * setting text in widgets, etc.).
122 * For each completely new event type, derive a new event class.
126 wxEvent::wxEvent(int theId
)
128 m_eventType
= wxEVT_NULL
;
129 m_eventObject
= (wxObject
*) NULL
;
133 m_callbackUserData
= (wxObject
*) NULL
;
134 m_isCommandEvent
= FALSE
;
137 void wxEvent::CopyObject(wxObject
& object_dest
) const
139 wxEvent
*obj
= (wxEvent
*)&object_dest
;
140 wxObject::CopyObject(object_dest
);
142 obj
->m_eventType
= m_eventType
;
143 obj
->m_eventObject
= m_eventObject
;
144 obj
->m_timeStamp
= m_timeStamp
;
146 obj
->m_skipped
= m_skipped
;
147 obj
->m_callbackUserData
= m_callbackUserData
;
148 obj
->m_isCommandEvent
= m_isCommandEvent
;
158 wxCommandEvent::wxCommandEvent(wxEventType commandType
, int theId
)
160 m_eventType
= commandType
;
161 m_clientData
= (char *) NULL
;
162 m_clientObject
= (wxClientData
*) NULL
;
166 m_commandString
= wxEmptyString
;
167 m_isCommandEvent
= TRUE
;
170 void wxCommandEvent::CopyObject(wxObject
& obj_d
) const
172 wxCommandEvent
*obj
= (wxCommandEvent
*)&obj_d
;
174 wxEvent::CopyObject(obj_d
);
176 obj
->m_clientData
= m_clientData
;
177 obj
->m_clientObject
= m_clientObject
;
178 obj
->m_extraLong
= m_extraLong
;
179 obj
->m_commandInt
= m_commandInt
;
186 wxScrollEvent::wxScrollEvent(wxEventType commandType
,
190 : wxCommandEvent(commandType
, id
)
192 m_extraLong
= orient
;
200 wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType
,
204 m_eventType
= commandType
;
205 m_extraLong
= orient
;
209 void wxScrollWinEvent::CopyObject(wxObject
& obj_d
) const
211 wxScrollWinEvent
*obj
= (wxScrollWinEvent
*)&obj_d
;
213 wxEvent::CopyObject(obj_d
);
215 obj
->m_extraLong
= m_extraLong
;
216 obj
->m_commandInt
= m_commandInt
;
224 wxMouseEvent::wxMouseEvent(wxEventType commandType
)
226 m_eventType
= commandType
;
229 m_controlDown
= FALSE
;
233 m_middleDown
= FALSE
;
238 void wxMouseEvent::CopyObject(wxObject
& obj_d
) const
240 wxMouseEvent
*obj
= (wxMouseEvent
*)&obj_d
;
242 wxEvent::CopyObject(obj_d
);
244 obj
->m_metaDown
= m_metaDown
;
245 obj
->m_altDown
= m_altDown
;
246 obj
->m_controlDown
= m_controlDown
;
247 obj
->m_shiftDown
= m_shiftDown
;
248 obj
->m_leftDown
= m_leftDown
;
249 obj
->m_rightDown
= m_rightDown
;
250 obj
->m_middleDown
= m_middleDown
;
255 // True if was a button dclick event (1 = left, 2 = middle, 3 = right)
256 // or any button dclick event (but = -1)
257 bool wxMouseEvent::ButtonDClick(int but
) const
262 return (LeftDClick() || MiddleDClick() || RightDClick());
266 return MiddleDClick();
268 return RightDClick();
270 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
276 // True if was a button down event (1 = left, 2 = middle, 3 = right)
277 // or any button down event (but = -1)
278 bool wxMouseEvent::ButtonDown(int but
) const
283 return (LeftDown() || MiddleDown() || RightDown());
291 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
297 // True if was a button up event (1 = left, 2 = middle, 3 = right)
298 // or any button up event (but = -1)
299 bool wxMouseEvent::ButtonUp(int but
) const
303 return (LeftUp() || MiddleUp() || RightUp());
311 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
317 // True if the given button is currently changing state
318 bool wxMouseEvent::Button(int but
) const
322 return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1));
324 return (LeftDown() || LeftUp() || LeftDClick());
326 return (MiddleDown() || MiddleUp() || MiddleDClick());
328 return (RightDown() || RightUp() || RightDClick());
330 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button"));
336 bool wxMouseEvent::ButtonIsDown(int but
) const
340 return (LeftIsDown() || MiddleIsDown() || RightIsDown());
344 return MiddleIsDown();
346 return RightIsDown();
348 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
354 // Find the logical position of the event given the DC
355 wxPoint
wxMouseEvent::GetLogicalPosition(const wxDC
& dc
) const
357 wxPoint
pt(dc
.DeviceToLogicalX(m_x
), dc
.DeviceToLogicalY(m_y
));
367 wxKeyEvent::wxKeyEvent(wxEventType type
)
371 m_controlDown
= FALSE
;
378 void wxKeyEvent::CopyObject(wxObject
& obj_d
) const
380 wxKeyEvent
*obj
= (wxKeyEvent
*)&obj_d
;
381 wxEvent::CopyObject(obj_d
);
383 obj
->m_shiftDown
= m_shiftDown
;
384 obj
->m_controlDown
= m_controlDown
;
385 obj
->m_metaDown
= m_metaDown
;
386 obj
->m_altDown
= m_altDown
;
387 obj
->m_keyCode
= m_keyCode
;
395 void wxSizeEvent::CopyObject(wxObject
& obj_d
) const
397 wxSizeEvent
*obj
= (wxSizeEvent
*)&obj_d
;
398 wxEvent::CopyObject(obj_d
);
400 obj
->m_size
= m_size
;
403 void wxMoveEvent::CopyObject(wxObject
& obj_d
) const
405 wxMoveEvent
*obj
= (wxMoveEvent
*)&obj_d
;
406 wxEvent::CopyObject(obj_d
);
411 void wxEraseEvent::CopyObject(wxObject
& obj_d
) const
413 wxEraseEvent
*obj
= (wxEraseEvent
*)&obj_d
;
414 wxEvent::CopyObject(obj_d
);
419 void wxActivateEvent::CopyObject(wxObject
& obj_d
) const
421 wxActivateEvent
*obj
= (wxActivateEvent
*)&obj_d
;
422 wxEvent::CopyObject(obj_d
);
424 obj
->m_active
= m_active
;
427 void wxMenuEvent::CopyObject(wxObject
& obj_d
) const
429 wxMenuEvent
*obj
= (wxMenuEvent
*)&obj_d
;
430 wxEvent::CopyObject(obj_d
);
432 obj
->m_menuId
= m_menuId
;
435 void wxCloseEvent::CopyObject(wxObject
& obj_d
) const
437 wxCloseEvent
*obj
= (wxCloseEvent
*)&obj_d
;
438 wxEvent::CopyObject(obj_d
);
440 obj
->m_loggingOff
= m_loggingOff
;
441 obj
->m_veto
= m_veto
;
442 #if WXWIN_COMPATIBILITY
443 obj
->m_force
= m_force
;
445 obj
->m_canVeto
= m_canVeto
;
448 void wxShowEvent::CopyObject(wxObject
& obj_d
) const
450 wxShowEvent
*obj
= (wxShowEvent
*)&obj_d
;
451 wxEvent::CopyObject(obj_d
);
453 obj
->m_show
= m_show
;
456 void wxJoystickEvent::CopyObject(wxObject
& obj_d
) const
458 wxJoystickEvent
*obj
= (wxJoystickEvent
*)&obj_d
;
459 wxEvent::CopyObject(obj_d
);
462 obj
->m_zPosition
= m_zPosition
;
463 obj
->m_buttonChange
= m_buttonChange
;
464 obj
->m_buttonState
= m_buttonState
;
465 obj
->m_joyStick
= m_joyStick
;
468 void wxDropFilesEvent::CopyObject(wxObject
& obj_d
) const
470 wxDropFilesEvent
*obj
= (wxDropFilesEvent
*)&obj_d
;
471 wxEvent::CopyObject(obj_d
);
473 obj
->m_noFiles
= m_noFiles
;
475 // TODO: Problem with obj->m_files. It should be deallocated by the
476 // destructor of the event.
479 void wxUpdateUIEvent::CopyObject(wxObject
&obj_d
) const
481 wxUpdateUIEvent
*obj
= (wxUpdateUIEvent
*)&obj_d
;
482 wxEvent::CopyObject(obj_d
);
484 obj
->m_checked
= m_checked
;
485 obj
->m_enabled
= m_enabled
;
486 obj
->m_text
= m_text
;
487 obj
->m_setText
= m_setText
;
488 obj
->m_setChecked
= m_setChecked
;
489 obj
->m_setEnabled
= m_setEnabled
;
492 void wxPaletteChangedEvent::CopyObject(wxObject
&obj_d
) const
494 wxPaletteChangedEvent
*obj
= (wxPaletteChangedEvent
*)&obj_d
;
495 wxEvent::CopyObject(obj_d
);
497 obj
->m_changedWindow
= m_changedWindow
;
500 void wxQueryNewPaletteEvent::CopyObject(wxObject
& obj_d
) const
502 wxQueryNewPaletteEvent
*obj
= (wxQueryNewPaletteEvent
*)&obj_d
;
503 wxEvent::CopyObject(obj_d
);
505 obj
->m_paletteRealized
= m_paletteRealized
;
508 wxWindowCreateEvent::wxWindowCreateEvent(wxWindow
*win
)
509 : wxEvent(wxEVT_CREATE
)
514 wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow
*win
)
515 : wxEvent(wxEVT_DESTROY
)
522 void wxIdleEvent::CopyObject(wxObject
& obj_d
) const
524 wxIdleEvent
*obj
= (wxIdleEvent
*)&obj_d
;
525 wxEvent::CopyObject(obj_d
);
527 obj
->m_requestMore
= m_requestMore
;
534 wxEvtHandler::wxEvtHandler()
536 m_nextHandler
= (wxEvtHandler
*) NULL
;
537 m_previousHandler
= (wxEvtHandler
*) NULL
;
539 m_dynamicEvents
= (wxList
*) NULL
;
541 m_pendingEvents
= (wxList
*) NULL
;
543 # if !defined(__VISAGECPP__)
544 m_eventsLocker
= new wxCriticalSection
;
549 wxEvtHandler::~wxEvtHandler()
551 // Takes itself out of the list of handlers
552 if (m_previousHandler
)
553 m_previousHandler
->m_nextHandler
= m_nextHandler
;
556 m_nextHandler
->m_previousHandler
= m_previousHandler
;
560 wxNode
*node
= m_dynamicEvents
->First();
563 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
564 if (entry
->m_callbackUserData
) delete entry
->m_callbackUserData
;
568 delete m_dynamicEvents
;
571 delete m_pendingEvents
;
574 # if !defined(__VISAGECPP__)
575 delete m_eventsLocker
;
582 bool wxEvtHandler::ProcessThreadEvent(wxEvent
& event
)
584 // check that we are really in a child thread
585 wxASSERT_MSG( !wxThread::IsMain(),
586 wxT("use ProcessEvent() in main thread") );
588 AddPendingEvent(event
);
593 #endif // wxUSE_THREADS
595 void wxEvtHandler::AddPendingEvent(wxEvent
& event
)
597 // 1) Add event to list of pending events of this event handler
599 #if defined(__VISAGECPP__)
600 wxENTER_CRIT_SECT( m_eventsLocker
);
602 wxENTER_CRIT_SECT( *m_eventsLocker
);
605 if ( !m_pendingEvents
)
606 m_pendingEvents
= new wxList
;
608 wxEvent
*event2
= (wxEvent
*)event
.Clone();
610 m_pendingEvents
->Append(event2
);
612 #if defined(__VISAGECPP__)
613 wxLEAVE_CRIT_SECT( m_eventsLocker
);
615 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
618 // 2) Add this event handler to list of event handlers that
619 // have pending events.
621 wxENTER_CRIT_SECT(*wxPendingEventsLocker
);
623 if ( !wxPendingEvents
)
624 wxPendingEvents
= new wxList
;
625 wxPendingEvents
->Append(this);
627 // 3) Inform the system that new pending events are somwehere,
628 // and that these should be processed in idle time.
632 wxLEAVE_CRIT_SECT(*wxPendingEventsLocker
);
635 void wxEvtHandler::ProcessPendingEvents()
637 #if defined(__VISAGECPP__)
638 wxENTER_CRIT_SECT( m_eventsLocker
);
640 wxENTER_CRIT_SECT( *m_eventsLocker
);
643 wxNode
*node
= m_pendingEvents
->First();
646 wxEvent
*event
= (wxEvent
*)node
->Data();
649 // In ProcessEvent, new events might get added and
650 // we can safely leave the crtical section here.
651 #if defined(__VISAGECPP__)
652 wxLEAVE_CRIT_SECT( m_eventsLocker
);
654 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
656 ProcessEvent(*event
);
658 #if defined(__VISAGECPP__)
659 wxENTER_CRIT_SECT( m_eventsLocker
);
661 wxENTER_CRIT_SECT( *m_eventsLocker
);
664 node
= m_pendingEvents
->First();
667 #if defined(__VISAGECPP__)
668 wxLEAVE_CRIT_SECT( m_eventsLocker
);
670 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
678 bool wxEvtHandler::ProcessEvent(wxEvent
& event
)
681 // check that our flag corresponds to reality
682 wxASSERT( m_isWindow
== IsKindOf(CLASSINFO(wxWindow
)) );
685 // An event handler can be enabled or disabled
686 if ( GetEvtHandlerEnabled() )
689 // Check whether we are in a child thread.
690 if ( !wxThread::IsMain() )
691 return ProcessThreadEvent(event
);
692 #endif // wxUSE_THREADS
694 // Handle per-instance dynamic event tables first
695 if ( m_dynamicEvents
&& SearchDynamicEventTable(event
) )
698 // Then static per-class event tables
699 const wxEventTable
*table
= GetEventTable();
701 #if wxUSE_GUI && wxUSE_VALIDATORS
702 // Try the associated validator first, if this is a window.
703 // Problem: if the event handler of the window has been replaced,
704 // this wxEvtHandler may no longer be a window.
705 // Therefore validators won't be processed if the handler
706 // has been replaced with SetEventHandler.
707 // THIS CAN BE CURED if PushEventHandler is used instead of
708 // SetEventHandler, and then processing will be passed down the
709 // chain of event handlers.
712 wxWindow
*win
= (wxWindow
*)this;
714 // Can only use the validator of the window which
715 // is receiving the event
716 if ( win
== event
.GetEventObject() )
718 wxValidator
*validator
= win
->GetValidator();
719 if ( validator
&& validator
->ProcessEvent(event
) )
727 // Search upwards through the inheritance hierarchy
730 if ( SearchEventTable((wxEventTable
&)*table
, event
) )
732 table
= table
->baseTable
;
736 // Try going down the event handler chain
737 if ( GetNextHandler() )
739 if ( GetNextHandler()->ProcessEvent(event
) )
744 // Carry on up the parent-child hierarchy,
745 // but only if event is a command event: it wouldn't
746 // make sense for a parent to receive a child's size event, for example
747 if ( m_isWindow
&& event
.IsCommandEvent() )
749 wxWindow
*win
= (wxWindow
*)this;
750 wxWindow
*parent
= win
->GetParent();
751 if (parent
&& !parent
->IsBeingDeleted())
752 return parent
->GetEventHandler()->ProcessEvent(event
);
756 // Last try - application object.
757 if ( wxTheApp
&& (this != wxTheApp
) )
759 // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
760 // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be
761 // processed appropriately via SearchEventTable.
762 if ( event
.GetEventType() != wxEVT_IDLE
)
764 if ( wxTheApp
->ProcessEvent(event
) )
772 bool wxEvtHandler::SearchEventTable(wxEventTable
& table
, wxEvent
& event
)
775 int commandId
= event
.GetId();
777 // BC++ doesn't like while (table.entries[i].m_fn)
780 while (table
.entries
[i
].m_fn
!= 0)
782 while (table
.entries
[i
].m_fn
!= 0L)
785 if ((event
.GetEventType() == table
.entries
[i
].m_eventType
) &&
786 (table
.entries
[i
].m_id
== -1 || // Match, if event spec says any id will do (id == -1)
787 (table
.entries
[i
].m_lastId
== -1 && commandId
== table
.entries
[i
].m_id
) ||
788 (table
.entries
[i
].m_lastId
!= -1 &&
789 (commandId
>= table
.entries
[i
].m_id
&& commandId
<= table
.entries
[i
].m_lastId
))))
792 event
.m_callbackUserData
= table
.entries
[i
].m_callbackUserData
;
794 (this->*((wxEventFunction
) (table
.entries
[i
].m_fn
)))(event
);
796 if ( event
.GetSkipped() )
806 void wxEvtHandler::Connect( int id
, int lastId
,
807 wxEventType eventType
,
808 wxObjectEventFunction func
,
811 wxEventTableEntry
*entry
= new wxEventTableEntry
;
813 entry
->m_lastId
= lastId
;
814 entry
->m_eventType
= eventType
;
816 entry
->m_callbackUserData
= userData
;
818 if (!m_dynamicEvents
)
819 m_dynamicEvents
= new wxList
;
821 m_dynamicEvents
->Append( (wxObject
*) entry
);
824 bool wxEvtHandler::Disconnect( int id
, int lastId
, wxEventType eventType
,
825 wxObjectEventFunction func
,
828 if (!m_dynamicEvents
)
831 wxNode
*node
= m_dynamicEvents
->First();
834 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
835 if ((entry
->m_id
== id
) &&
836 ((entry
->m_lastId
== lastId
) || (lastId
== -1)) &&
837 ((entry
->m_eventType
== eventType
) || (eventType
== wxEVT_NULL
)) &&
838 ((entry
->m_fn
== func
) || (func
== (wxObjectEventFunction
)NULL
)) &&
839 ((entry
->m_callbackUserData
== userData
) || (userData
== (wxObject
*)NULL
)))
841 if (entry
->m_callbackUserData
) delete entry
->m_callbackUserData
;
842 m_dynamicEvents
->DeleteNode( node
);
851 bool wxEvtHandler::SearchDynamicEventTable( wxEvent
& event
)
853 wxCHECK_MSG( m_dynamicEvents
, FALSE
,
854 wxT("caller should check that we have dynamic events") );
856 int commandId
= event
.GetId();
858 wxNode
*node
= m_dynamicEvents
->First();
861 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
865 // Match, if event spec says any id will do (id == -1)
866 if ( (event
.GetEventType() == entry
->m_eventType
) &&
867 (entry
->m_id
== -1 ||
868 (entry
->m_lastId
== -1 && commandId
== entry
->m_id
) ||
869 (entry
->m_lastId
!= -1 &&
870 (commandId
>= entry
->m_id
&& commandId
<= entry
->m_lastId
))) )
873 event
.m_callbackUserData
= entry
->m_callbackUserData
;
875 (this->*((wxEventFunction
) (entry
->m_fn
)))(event
);
877 if (event
.GetSkipped())
888 #if WXWIN_COMPATIBILITY
889 bool wxEvtHandler::OnClose()
891 if (GetNextHandler())
892 return GetNextHandler()->OnClose();
896 #endif // WXWIN_COMPATIBILITY
900 // Find a window with the focus, that is also a descendant of the given window.
901 // This is used to determine the window to initially send commands to.
902 wxWindow
* wxFindFocusDescendant(wxWindow
* ancestor
)
904 // Process events starting with the window with the focus, if any.
905 wxWindow
* focusWin
= wxWindow::FindFocus();
906 wxWindow
* win
= focusWin
;
908 // Check if this is a descendant of this frame.
909 // If not, win will be set to NULL.
915 win
= win
->GetParent();
917 if (win
== (wxWindow
*) NULL
)
918 focusWin
= (wxWindow
*) NULL
;