X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..594f0f5bf1355fb8d58f403d3ebacc1c1767c429:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 897280b804..02c63cc4fa 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -52,9 +52,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) #if wxUSE_GUI + IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) @@ -67,6 +67,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) + IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent) @@ -120,8 +121,6 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER) DEFINE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED) @@ -152,6 +151,7 @@ DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK) DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK) DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS) DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS) +DEFINE_EVENT_TYPE(wxEVT_CHILD_FOCUS) DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL) // Non-client mouse events @@ -724,8 +724,6 @@ wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win) SetEventObject(win); } -#endif // wxUSE_GUI - void wxIdleEvent::CopyObject(wxObject& obj_d) const { wxIdleEvent *obj = (wxIdleEvent *)&obj_d; @@ -734,6 +732,18 @@ void wxIdleEvent::CopyObject(wxObject& obj_d) const obj->m_requestMore = m_requestMore; } +wxChildFocusEvent::wxChildFocusEvent(wxWindow *win) + : wxCommandEvent(wxEVT_CHILD_FOCUS) +{ + SetEventObject(win); +} + +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxEvtHandler +// ---------------------------------------------------------------------------- + /* * Event handler */ @@ -890,9 +900,32 @@ void wxEvtHandler::ProcessPendingEvents() bool wxEvtHandler::ProcessEvent(wxEvent& event) { #if wxUSE_GUI + + // We have to use the actual window or processing events from wxWindowNative + // destructor won't work (we don't see the wxWindow class) +#ifdef __WXDEBUG__ // check that our flag corresponds to reality - wxASSERT_MSG( m_isWindow == IsKindOf(CLASSINFO(wxWindow)), + wxClassInfo* info = NULL; +#ifdef __WXUNIVERSAL__ +# if defined(__WXMSW__) + info = CLASSINFO(wxWindowMSW); +# elif defined(__WXGTK__) + info = CLASSINFO(wxWindowGTK); +# elif defined(__WXMGL__) + info = CLASSINFO(wxWindowMGL); +# elif defined(__WXMAC__) + info = CLASSINFO(wxWindowMac); +# elif defined(__WXMOTIF__) + info = CLASSINFO(wxWindowMotif); +# endif +#else + info = CLASSINFO(wxWindow); +#endif + + wxASSERT_MSG( m_isWindow == IsKindOf(info), _T("this should [not] be a window but it is [not]") ); +#endif + #endif // wxUSE_GUI // An event handler can be enabled or disabled @@ -968,12 +1001,14 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event) { wxWindow *win = (wxWindow *)this; - // also, don't propagate events beyond the first top level window: it - // doesn't make sense to process dialogs events in the parent frame - if ( !win->IsTopLevel() ) + // honour the requests to stop propagation at this window: this is + // used by the dialogs, for example, to prevent processing the events + // from the dialog controls in the parent frame which rarely, if ever, + // makes sense + if ( !(win->GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) ) { wxWindow *parent = win->GetParent(); - if (parent && !parent->IsBeingDeleted()) + if ( parent && !parent->IsBeingDeleted() ) return parent->GetEventHandler()->ProcessEvent(event); } }