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 #if !USE_SHARED_LIBRARY
54 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler
, wxObject
)
55 IMPLEMENT_ABSTRACT_CLASS(wxEvent
, wxObject
)
56 IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent
, wxEvent
)
59 IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent
, wxEvent
)
60 IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent
, wxCommandEvent
)
61 IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent
, wxCommandEvent
)
62 IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent
, wxEvent
)
63 IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent
, wxEvent
)
64 IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent
, wxEvent
)
65 IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent
, wxEvent
)
66 IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent
, wxEvent
)
67 IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent
, wxEvent
)
68 IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent
, wxEvent
)
69 IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent
, wxEvent
)
70 IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent
, wxEvent
)
71 IMPLEMENT_DYNAMIC_CLASS(wxShowEvent
, wxEvent
)
72 IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent
, wxEvent
)
73 IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent
, wxEvent
)
74 IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent
, wxEvent
)
75 IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent
, wxEvent
)
76 IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent
, wxEvent
)
77 IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent
, wxEvent
)
78 IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent
, wxEvent
)
79 IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent
, wxEvent
)
80 IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent
, wxCommandEvent
)
81 IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent
, wxCommandEvent
)
82 IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent
, wxEvent
)
83 IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent
, wxEvent
)
84 IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent
, wxEvent
)
85 IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent
, wxEvent
)
88 const wxEventTable
*wxEvtHandler::GetEventTable() const
89 { return &wxEvtHandler::sm_eventTable
; }
91 const wxEventTable
wxEvtHandler::sm_eventTable
=
92 { (const wxEventTable
*)NULL
, &wxEvtHandler::sm_eventTableEntries
[0] };
94 const wxEventTableEntry
wxEvtHandler::sm_eventTableEntries
[] =
95 { { 0, 0, 0, (wxObjectEventFunction
) NULL
, (wxObject
*) NULL
} };
97 #endif // !USE_SHARED_LIBRARY
99 // ----------------------------------------------------------------------------
101 // ----------------------------------------------------------------------------
103 // To put pending event handlers
104 wxList
*wxPendingEvents
= (wxList
*)NULL
;
107 // protects wxPendingEvents list
108 wxCriticalSection
*wxPendingEventsLocker
= (wxCriticalSection
*)NULL
;
111 // ============================================================================
113 // ============================================================================
115 // ----------------------------------------------------------------------------
117 // ----------------------------------------------------------------------------
120 * General wxWindows events, covering
121 * all interesting things that might happen (button clicking, resizing,
122 * setting text in widgets, etc.).
124 * For each completely new event type, derive a new event class.
128 wxEvent::wxEvent(int theId
)
130 m_eventType
= wxEVT_NULL
;
131 m_eventObject
= (wxObject
*) NULL
;
135 m_callbackUserData
= (wxObject
*) NULL
;
136 m_isCommandEvent
= FALSE
;
139 void wxEvent::CopyObject(wxObject
& object_dest
) const
141 wxEvent
*obj
= (wxEvent
*)&object_dest
;
142 wxObject::CopyObject(object_dest
);
144 obj
->m_eventType
= m_eventType
;
145 obj
->m_eventObject
= m_eventObject
;
146 obj
->m_timeStamp
= m_timeStamp
;
148 obj
->m_skipped
= m_skipped
;
149 obj
->m_callbackUserData
= m_callbackUserData
;
150 obj
->m_isCommandEvent
= m_isCommandEvent
;
160 wxCommandEvent::wxCommandEvent(wxEventType commandType
, int theId
)
162 m_eventType
= commandType
;
163 m_clientData
= (char *) NULL
;
164 m_clientObject
= (wxClientData
*) NULL
;
168 m_commandString
= wxEmptyString
;
169 m_isCommandEvent
= TRUE
;
172 void wxCommandEvent::CopyObject(wxObject
& obj_d
) const
174 wxCommandEvent
*obj
= (wxCommandEvent
*)&obj_d
;
176 wxEvent::CopyObject(obj_d
);
178 obj
->m_clientData
= m_clientData
;
179 obj
->m_clientObject
= m_clientObject
;
180 obj
->m_extraLong
= m_extraLong
;
181 obj
->m_commandInt
= m_commandInt
;
188 wxScrollEvent::wxScrollEvent(wxEventType commandType
,
192 : wxCommandEvent(commandType
, id
)
194 m_extraLong
= orient
;
202 wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType
,
206 m_eventType
= commandType
;
207 m_extraLong
= orient
;
211 void wxScrollWinEvent::CopyObject(wxObject
& obj_d
) const
213 wxScrollWinEvent
*obj
= (wxScrollWinEvent
*)&obj_d
;
215 wxEvent::CopyObject(obj_d
);
217 obj
->m_extraLong
= m_extraLong
;
218 obj
->m_commandInt
= m_commandInt
;
226 wxMouseEvent::wxMouseEvent(wxEventType commandType
)
228 m_eventType
= commandType
;
231 m_controlDown
= FALSE
;
235 m_middleDown
= FALSE
;
240 void wxMouseEvent::CopyObject(wxObject
& obj_d
) const
242 wxMouseEvent
*obj
= (wxMouseEvent
*)&obj_d
;
244 wxEvent::CopyObject(obj_d
);
246 obj
->m_metaDown
= m_metaDown
;
247 obj
->m_altDown
= m_altDown
;
248 obj
->m_controlDown
= m_controlDown
;
249 obj
->m_shiftDown
= m_shiftDown
;
250 obj
->m_leftDown
= m_leftDown
;
251 obj
->m_rightDown
= m_rightDown
;
252 obj
->m_middleDown
= m_middleDown
;
257 // True if was a button dclick event (1 = left, 2 = middle, 3 = right)
258 // or any button dclick event (but = -1)
259 bool wxMouseEvent::ButtonDClick(int but
) const
264 return (LeftDClick() || MiddleDClick() || RightDClick());
268 return MiddleDClick();
270 return RightDClick();
272 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
278 // True if was a button down event (1 = left, 2 = middle, 3 = right)
279 // or any button down event (but = -1)
280 bool wxMouseEvent::ButtonDown(int but
) const
285 return (LeftDown() || MiddleDown() || RightDown());
293 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
299 // True if was a button up event (1 = left, 2 = middle, 3 = right)
300 // or any button up event (but = -1)
301 bool wxMouseEvent::ButtonUp(int but
) const
305 return (LeftUp() || MiddleUp() || RightUp());
313 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
319 // True if the given button is currently changing state
320 bool wxMouseEvent::Button(int but
) const
324 return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1));
326 return (LeftDown() || LeftUp() || LeftDClick());
328 return (MiddleDown() || MiddleUp() || MiddleDClick());
330 return (RightDown() || RightUp() || RightDClick());
332 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button"));
338 bool wxMouseEvent::ButtonIsDown(int but
) const
342 return (LeftIsDown() || MiddleIsDown() || RightIsDown());
346 return MiddleIsDown();
348 return RightIsDown();
350 wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
356 // Find the logical position of the event given the DC
357 wxPoint
wxMouseEvent::GetLogicalPosition(const wxDC
& dc
) const
359 wxPoint
pt(dc
.DeviceToLogicalX(m_x
), dc
.DeviceToLogicalY(m_y
));
369 wxKeyEvent::wxKeyEvent(wxEventType type
)
373 m_controlDown
= FALSE
;
380 void wxKeyEvent::CopyObject(wxObject
& obj_d
) const
382 wxKeyEvent
*obj
= (wxKeyEvent
*)&obj_d
;
383 wxEvent::CopyObject(obj_d
);
385 obj
->m_shiftDown
= m_shiftDown
;
386 obj
->m_controlDown
= m_controlDown
;
387 obj
->m_metaDown
= m_metaDown
;
388 obj
->m_altDown
= m_altDown
;
389 obj
->m_keyCode
= m_keyCode
;
397 void wxSizeEvent::CopyObject(wxObject
& obj_d
) const
399 wxSizeEvent
*obj
= (wxSizeEvent
*)&obj_d
;
400 wxEvent::CopyObject(obj_d
);
402 obj
->m_size
= m_size
;
405 void wxMoveEvent::CopyObject(wxObject
& obj_d
) const
407 wxMoveEvent
*obj
= (wxMoveEvent
*)&obj_d
;
408 wxEvent::CopyObject(obj_d
);
413 void wxEraseEvent::CopyObject(wxObject
& obj_d
) const
415 wxEraseEvent
*obj
= (wxEraseEvent
*)&obj_d
;
416 wxEvent::CopyObject(obj_d
);
421 void wxActivateEvent::CopyObject(wxObject
& obj_d
) const
423 wxActivateEvent
*obj
= (wxActivateEvent
*)&obj_d
;
424 wxEvent::CopyObject(obj_d
);
426 obj
->m_active
= m_active
;
429 void wxMenuEvent::CopyObject(wxObject
& obj_d
) const
431 wxMenuEvent
*obj
= (wxMenuEvent
*)&obj_d
;
432 wxEvent::CopyObject(obj_d
);
434 obj
->m_menuId
= m_menuId
;
437 void wxCloseEvent::CopyObject(wxObject
& obj_d
) const
439 wxCloseEvent
*obj
= (wxCloseEvent
*)&obj_d
;
440 wxEvent::CopyObject(obj_d
);
442 obj
->m_loggingOff
= m_loggingOff
;
443 obj
->m_veto
= m_veto
;
444 #if WXWIN_COMPATIBILITY
445 obj
->m_force
= m_force
;
447 obj
->m_canVeto
= m_canVeto
;
450 void wxShowEvent::CopyObject(wxObject
& obj_d
) const
452 wxShowEvent
*obj
= (wxShowEvent
*)&obj_d
;
453 wxEvent::CopyObject(obj_d
);
455 obj
->m_show
= m_show
;
458 void wxJoystickEvent::CopyObject(wxObject
& obj_d
) const
460 wxJoystickEvent
*obj
= (wxJoystickEvent
*)&obj_d
;
461 wxEvent::CopyObject(obj_d
);
464 obj
->m_zPosition
= m_zPosition
;
465 obj
->m_buttonChange
= m_buttonChange
;
466 obj
->m_buttonState
= m_buttonState
;
467 obj
->m_joyStick
= m_joyStick
;
470 void wxDropFilesEvent::CopyObject(wxObject
& obj_d
) const
472 wxDropFilesEvent
*obj
= (wxDropFilesEvent
*)&obj_d
;
473 wxEvent::CopyObject(obj_d
);
475 obj
->m_noFiles
= m_noFiles
;
477 // TODO: Problem with obj->m_files. It should be deallocated by the
478 // destructor of the event.
481 void wxUpdateUIEvent::CopyObject(wxObject
&obj_d
) const
483 wxUpdateUIEvent
*obj
= (wxUpdateUIEvent
*)&obj_d
;
484 wxEvent::CopyObject(obj_d
);
486 obj
->m_checked
= m_checked
;
487 obj
->m_enabled
= m_enabled
;
488 obj
->m_text
= m_text
;
489 obj
->m_setText
= m_setText
;
490 obj
->m_setChecked
= m_setChecked
;
491 obj
->m_setEnabled
= m_setEnabled
;
494 void wxPaletteChangedEvent::CopyObject(wxObject
&obj_d
) const
496 wxPaletteChangedEvent
*obj
= (wxPaletteChangedEvent
*)&obj_d
;
497 wxEvent::CopyObject(obj_d
);
499 obj
->m_changedWindow
= m_changedWindow
;
502 void wxQueryNewPaletteEvent::CopyObject(wxObject
& obj_d
) const
504 wxQueryNewPaletteEvent
*obj
= (wxQueryNewPaletteEvent
*)&obj_d
;
505 wxEvent::CopyObject(obj_d
);
507 obj
->m_paletteRealized
= m_paletteRealized
;
510 wxWindowCreateEvent::wxWindowCreateEvent(wxWindow
*win
)
511 : wxEvent(wxEVT_CREATE
)
516 wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow
*win
)
517 : wxEvent(wxEVT_DESTROY
)
524 void wxIdleEvent::CopyObject(wxObject
& obj_d
) const
526 wxIdleEvent
*obj
= (wxIdleEvent
*)&obj_d
;
527 wxEvent::CopyObject(obj_d
);
529 obj
->m_requestMore
= m_requestMore
;
536 wxEvtHandler::wxEvtHandler()
538 m_nextHandler
= (wxEvtHandler
*) NULL
;
539 m_previousHandler
= (wxEvtHandler
*) NULL
;
541 m_dynamicEvents
= (wxList
*) NULL
;
543 m_pendingEvents
= (wxList
*) NULL
;
545 # if !defined(__VISAGECPP__)
546 m_eventsLocker
= new wxCriticalSection
;
551 wxEvtHandler::~wxEvtHandler()
553 // Takes itself out of the list of handlers
554 if (m_previousHandler
)
555 m_previousHandler
->m_nextHandler
= m_nextHandler
;
558 m_nextHandler
->m_previousHandler
= m_previousHandler
;
562 wxNode
*node
= m_dynamicEvents
->First();
565 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
566 if (entry
->m_callbackUserData
) delete entry
->m_callbackUserData
;
570 delete m_dynamicEvents
;
573 delete m_pendingEvents
;
576 # if !defined(__VISAGECPP__)
577 delete m_eventsLocker
;
584 bool wxEvtHandler::ProcessThreadEvent(wxEvent
& event
)
586 // check that we are really in a child thread
587 wxASSERT_MSG( !wxThread::IsMain(),
588 wxT("use ProcessEvent() in main thread") );
590 AddPendingEvent(event
);
595 #endif // wxUSE_THREADS
597 void wxEvtHandler::AddPendingEvent(wxEvent
& event
)
599 // 1) Add event to list of pending events of this event handler
601 #if defined(__VISAGECPP__)
602 wxENTER_CRIT_SECT( m_eventsLocker
);
604 wxENTER_CRIT_SECT( *m_eventsLocker
);
607 if ( !m_pendingEvents
)
608 m_pendingEvents
= new wxList
;
610 wxEvent
*event2
= (wxEvent
*)event
.Clone();
612 m_pendingEvents
->Append(event2
);
614 #if defined(__VISAGECPP__)
615 wxLEAVE_CRIT_SECT( m_eventsLocker
);
617 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
620 // 2) Add this event handler to list of event handlers that
621 // have pending events.
623 wxENTER_CRIT_SECT(*wxPendingEventsLocker
);
625 if ( !wxPendingEvents
)
626 wxPendingEvents
= new wxList
;
627 wxPendingEvents
->Append(this);
629 wxLEAVE_CRIT_SECT(*wxPendingEventsLocker
);
631 // 3) Inform the system that new pending events are somwehere,
632 // and that these should be processed in idle time.
637 void wxEvtHandler::ProcessPendingEvents()
639 #if defined(__VISAGECPP__)
640 wxENTER_CRIT_SECT( m_eventsLocker
);
642 wxENTER_CRIT_SECT( *m_eventsLocker
);
645 wxNode
*node
= m_pendingEvents
->First();
648 wxEvent
*event
= (wxEvent
*)node
->Data();
651 // In ProcessEvent, new events might get added and
652 // we can safely leave the crtical section here.
653 #if defined(__VISAGECPP__)
654 wxLEAVE_CRIT_SECT( m_eventsLocker
);
656 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
658 ProcessEvent(*event
);
660 #if defined(__VISAGECPP__)
661 wxENTER_CRIT_SECT( m_eventsLocker
);
663 wxENTER_CRIT_SECT( *m_eventsLocker
);
666 node
= m_pendingEvents
->First();
669 #if defined(__VISAGECPP__)
670 wxLEAVE_CRIT_SECT( m_eventsLocker
);
672 wxLEAVE_CRIT_SECT( *m_eventsLocker
);
680 bool wxEvtHandler::ProcessEvent(wxEvent
& event
)
683 // check that our flag corresponds to reality
684 wxASSERT( m_isWindow
== IsKindOf(CLASSINFO(wxWindow
)) );
687 // An event handler can be enabled or disabled
688 if ( GetEvtHandlerEnabled() )
691 // Check whether we are in a child thread.
692 if ( !wxThread::IsMain() )
693 return ProcessThreadEvent(event
);
694 #endif // wxUSE_THREADS
696 // Handle per-instance dynamic event tables first
697 if ( m_dynamicEvents
&& SearchDynamicEventTable(event
) )
700 // Then static per-class event tables
701 const wxEventTable
*table
= GetEventTable();
703 #if wxUSE_GUI && wxUSE_VALIDATORS
704 // Try the associated validator first, if this is a window.
705 // Problem: if the event handler of the window has been replaced,
706 // this wxEvtHandler may no longer be a window.
707 // Therefore validators won't be processed if the handler
708 // has been replaced with SetEventHandler.
709 // THIS CAN BE CURED if PushEventHandler is used instead of
710 // SetEventHandler, and then processing will be passed down the
711 // chain of event handlers.
714 wxWindow
*win
= (wxWindow
*)this;
716 // Can only use the validator of the window which
717 // is receiving the event
718 if ( win
== event
.GetEventObject() )
720 wxValidator
*validator
= win
->GetValidator();
721 if ( validator
&& validator
->ProcessEvent(event
) )
729 // Search upwards through the inheritance hierarchy
732 if ( SearchEventTable((wxEventTable
&)*table
, event
) )
734 table
= table
->baseTable
;
738 // Try going down the event handler chain
739 if ( GetNextHandler() )
741 if ( GetNextHandler()->ProcessEvent(event
) )
746 // Carry on up the parent-child hierarchy,
747 // but only if event is a command event: it wouldn't
748 // make sense for a parent to receive a child's size event, for example
749 if ( m_isWindow
&& event
.IsCommandEvent() )
751 wxWindow
*win
= (wxWindow
*)this;
752 wxWindow
*parent
= win
->GetParent();
753 if (parent
&& !parent
->IsBeingDeleted())
754 return parent
->GetEventHandler()->ProcessEvent(event
);
758 // Last try - application object.
759 if ( wxTheApp
&& (this != wxTheApp
) )
761 // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
762 // swallow it. wxEVT_IDLE is sent explicitly to wxApp so it will be
763 // processed appropriately via SearchEventTable.
764 if ( event
.GetEventType() != wxEVT_IDLE
)
766 if ( wxTheApp
->ProcessEvent(event
) )
774 bool wxEvtHandler::SearchEventTable(wxEventTable
& table
, wxEvent
& event
)
777 int commandId
= event
.GetId();
779 // BC++ doesn't like while (table.entries[i].m_fn)
782 while (table
.entries
[i
].m_fn
!= 0)
784 while (table
.entries
[i
].m_fn
!= 0L)
787 if ((event
.GetEventType() == table
.entries
[i
].m_eventType
) &&
788 (table
.entries
[i
].m_id
== -1 || // Match, if event spec says any id will do (id == -1)
789 (table
.entries
[i
].m_lastId
== -1 && commandId
== table
.entries
[i
].m_id
) ||
790 (table
.entries
[i
].m_lastId
!= -1 &&
791 (commandId
>= table
.entries
[i
].m_id
&& commandId
<= table
.entries
[i
].m_lastId
))))
794 event
.m_callbackUserData
= table
.entries
[i
].m_callbackUserData
;
796 (this->*((wxEventFunction
) (table
.entries
[i
].m_fn
)))(event
);
798 if ( event
.GetSkipped() )
808 void wxEvtHandler::Connect( int id
, int lastId
,
809 wxEventType eventType
,
810 wxObjectEventFunction func
,
813 wxEventTableEntry
*entry
= new wxEventTableEntry
;
815 entry
->m_lastId
= lastId
;
816 entry
->m_eventType
= eventType
;
818 entry
->m_callbackUserData
= userData
;
820 if (!m_dynamicEvents
)
821 m_dynamicEvents
= new wxList
;
823 m_dynamicEvents
->Append( (wxObject
*) entry
);
826 bool wxEvtHandler::Disconnect( int id
, int lastId
, wxEventType eventType
,
827 wxObjectEventFunction func
,
830 if (!m_dynamicEvents
)
833 wxNode
*node
= m_dynamicEvents
->First();
836 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
837 if ((entry
->m_id
== id
) &&
838 ((entry
->m_lastId
== lastId
) || (lastId
== -1)) &&
839 ((entry
->m_eventType
== eventType
) || (eventType
== wxEVT_NULL
)) &&
840 ((entry
->m_fn
== func
) || (func
== (wxObjectEventFunction
)NULL
)) &&
841 ((entry
->m_callbackUserData
== userData
) || (userData
== (wxObject
*)NULL
)))
843 if (entry
->m_callbackUserData
) delete entry
->m_callbackUserData
;
844 m_dynamicEvents
->DeleteNode( node
);
853 bool wxEvtHandler::SearchDynamicEventTable( wxEvent
& event
)
855 wxCHECK_MSG( m_dynamicEvents
, FALSE
,
856 wxT("caller should check that we have dynamic events") );
858 int commandId
= event
.GetId();
860 wxNode
*node
= m_dynamicEvents
->First();
863 wxEventTableEntry
*entry
= (wxEventTableEntry
*)node
->Data();
867 // Match, if event spec says any id will do (id == -1)
868 if ( (event
.GetEventType() == entry
->m_eventType
) &&
869 (entry
->m_id
== -1 ||
870 (entry
->m_lastId
== -1 && commandId
== entry
->m_id
) ||
871 (entry
->m_lastId
!= -1 &&
872 (commandId
>= entry
->m_id
&& commandId
<= entry
->m_lastId
))) )
875 event
.m_callbackUserData
= entry
->m_callbackUserData
;
877 (this->*((wxEventFunction
) (entry
->m_fn
)))(event
);
879 if (event
.GetSkipped())
890 #if WXWIN_COMPATIBILITY
891 bool wxEvtHandler::OnClose()
893 if (GetNextHandler())
894 return GetNextHandler()->OnClose();
898 #endif // WXWIN_COMPATIBILITY
902 // Find a window with the focus, that is also a descendant of the given window.
903 // This is used to determine the window to initially send commands to.
904 wxWindow
* wxFindFocusDescendant(wxWindow
* ancestor
)
906 // Process events starting with the window with the focus, if any.
907 wxWindow
* focusWin
= wxWindow::FindFocus();
908 wxWindow
* win
= focusWin
;
910 // Check if this is a descendant of this frame.
911 // If not, win will be set to NULL.
917 win
= win
->GetParent();
919 if (win
== (wxWindow
*) NULL
)
920 focusWin
= (wxWindow
*) NULL
;