X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a0e9a5dfdeebc1d5e2d7e6e2146e63a26c8645a1..b404a8f3b072129c107c6d9a5e0f6f53cd34807b:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 98231a9f5a..31e6e6adef 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -62,11 +62,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) + IMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxEvent) #endif // wxUSE_BASE #if wxUSE_GUI IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent) @@ -155,6 +155,9 @@ const wxEventType wxEVT_NULL = wxNewEventType(); wxDEFINE_EVENT( wxEVT_IDLE, wxIdleEvent ); +// Thread event +wxDEFINE_EVENT( wxEVT_THREAD, wxThreadEvent ); + #endif // wxUSE_BASE #if wxUSE_GUI @@ -206,6 +209,7 @@ wxDEFINE_EVENT( wxEVT_AUX2_DCLICK, wxMouseEvent ); // Character input event type wxDEFINE_EVENT( wxEVT_CHAR, wxKeyEvent ); +wxDEFINE_EVENT( wxEVT_AFTER_CHAR, wxKeyEvent ); wxDEFINE_EVENT( wxEVT_CHAR_HOOK, wxKeyEvent ); wxDEFINE_EVENT( wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent ); wxDEFINE_EVENT( wxEVT_KEY_DOWN, wxKeyEvent ); @@ -311,9 +315,6 @@ wxDEFINE_EVENT( wxEVT_COMMAND_ENTER, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_HELP, wxHelpEvent ); wxDEFINE_EVENT( wxEVT_DETAILED_HELP, wxHelpEvent ); -// Thread event -wxDEFINE_EVENT( wxEVT_COMMAND_THREAD, wxThreadEvent ); - #endif // wxUSE_GUI #if wxUSE_BASE @@ -421,8 +422,6 @@ wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) { m_clientData = NULL; m_clientObject = NULL; - m_extraLong = 0; - m_commandInt = 0; m_isCommandEvent = true; // the command events are propagated upwards by default @@ -473,6 +472,13 @@ bool wxUpdateUIEvent::CanUpdate(wxWindowBase *win) ((win->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES) == 0))) return false; + // Don't update children of the hidden windows: this is useless as any + // change to their state won't be seen by the user anyhow. Notice that this + // argument doesn't apply to the hidden windows (with visible parent) + // themselves as they could be shown by their EVT_UPDATE_UI handler. + if ( win->GetParent() && !win->GetParent()->IsShownOnScreen() ) + return false; + if (sm_updateInterval == -1) return false; @@ -733,9 +739,9 @@ wxPoint wxMouseEvent::GetLogicalPosition(const wxDC& dc) const wxKeyEvent::wxKeyEvent(wxEventType type) { m_eventType = type; - m_keyCode = 0; + m_keyCode = WXK_NONE; #if wxUSE_UNICODE - m_uniChar = 0; + m_uniChar = WXK_NONE; #endif } @@ -887,8 +893,7 @@ void wxEventHashTable::Clear() delete eTTnode; } - delete[] m_eventTypeTable; - m_eventTypeTable = NULL; + wxDELETEA(m_eventTypeTable); m_size = 0; } @@ -960,7 +965,7 @@ void wxEventHashTable::InitHashTable() table = table->baseTable; } - // Lets free some memory. + // Let's free some memory. size_t i; for(i = 0; i < m_size; i++) { @@ -1380,7 +1385,7 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event) // Short circuit the event processing logic if we're requested to process // this event in this handler only, see DoTryChain() for more details. if ( event.ShouldProcessOnlyIn(this) ) - return TryHere(event); + return TryBeforeAndHere(event); // Try to process the event in this handler itself. @@ -1407,23 +1412,11 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event) bool wxEvtHandler::ProcessEventLocally(wxEvent& event) { - // First try the hooks which should be called before our own handlers - if ( TryBefore(event) ) - return true; - - // Then try this handler itself, notice that we should not call - // ProcessEvent() on this one as we're already called from it, which - // explains why we do it here and not in DoTryChain() - if ( TryHere(event) ) - return true; - - // Finally try the event handlers chained to this one, - if ( DoTryChain(event) ) - return true; - - // And return false to indicate that we didn't find any handler at this - // level. - return false; + // Try the hooks which should be called before our own handlers and this + // handler itself first. Notice that we should not call ProcessEvent() on + // this one as we're already called from it, which explains why we do it + // here and not in DoTryChain() + return TryBeforeAndHere(event) || DoTryChain(event); } bool wxEvtHandler::DoTryChain(wxEvent& event) @@ -1435,7 +1428,7 @@ bool wxEvtHandler::DoTryChain(wxEvent& event) // ProcessEvent() from which we were called or will be done by it when // we return. // - // However we must call ProcessEvent() and not TryHere() because the + // However we must call ProcessEvent() and not TryHereOnly() because the // existing code (including some in wxWidgets itself) expects the // overridden ProcessEvent() in its custom event handlers pushed on a // window to be called. @@ -1479,7 +1472,7 @@ bool wxEvtHandler::DoTryChain(wxEvent& event) return false; } -bool wxEvtHandler::TryHere(wxEvent& event) +bool wxEvtHandler::TryHereOnly(wxEvent& event) { // If the event handler is disabled it doesn't process any events if ( !GetEvtHandlerEnabled() )