X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/abcbaea73fa07b88ac681c78ea6933ba70a6fd72..4b1f929cc3421e43409f7d62260bf9ba0ffc75ab:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index b9eeac40fb..7f36cc628b 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem +// Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -190,6 +190,7 @@ DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP) DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN) DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK) DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE) +DEFINE_EVENT_TYPE(wxEVT_SCROLL_ENDSCROLL) // Scroll events from wxWindow DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP) @@ -388,6 +389,8 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType) void wxMouseEvent::Assign(const wxMouseEvent& event) { + m_eventType = event.m_eventType; + m_x = event.m_x; m_y = event.m_y; @@ -542,8 +545,36 @@ wxKeyEvent::wxKeyEvent(wxEventType type) m_altDown = FALSE; m_keyCode = 0; m_scanCode = 0; +#if wxUSE_UNICODE + m_uniChar = 0; +#endif } +wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt) + : wxEvent(evt) +{ + m_x = evt.m_x; + m_y = evt.m_y; + + m_keyCode = evt.m_keyCode; + + m_controlDown = evt.m_controlDown; + m_shiftDown = evt.m_shiftDown; + m_altDown = evt.m_altDown; + m_metaDown = evt.m_metaDown; + m_scanCode = evt.m_scanCode; + m_rawCode = evt.m_rawCode; + m_rawFlags = evt.m_rawFlags; + +#if wxUSE_UNICODE + m_uniChar = evt.m_uniChar; +#endif +} + +long wxKeyEvent::KeyCode() const +{ + return m_keyCode; +} wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win) { @@ -602,19 +633,19 @@ wxEvtHandler::~wxEvtHandler() if (m_dynamicEvents) { - wxNode *node = m_dynamicEvents->First(); + wxNode *node = m_dynamicEvents->GetFirst(); while (node) { #if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)node->Data(); + wxEventTableEntry *entry = (wxEventTableEntry*)node->GetData(); #else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data(); + wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES if (entry->m_callbackUserData) delete entry->m_callbackUserData; delete entry; - node = node->Next(); + node = node->GetNext(); } delete m_dynamicEvents; }; @@ -699,10 +730,10 @@ void wxEvtHandler::ProcessPendingEvents() wxENTER_CRIT_SECT( *m_eventsLocker); #endif - wxNode *node = m_pendingEvents->First(); + wxNode *node = m_pendingEvents->GetFirst(); while ( node ) { - wxEvent *event = (wxEvent *)node->Data(); + wxEvent *event = (wxEvent *)node->GetData(); delete node; // In ProcessEvent, new events might get added and @@ -720,7 +751,7 @@ void wxEvtHandler::ProcessPendingEvents() wxENTER_CRIT_SECT( *m_eventsLocker); #endif - node = m_pendingEvents->First(); + node = m_pendingEvents->GetFirst(); } #if defined(__VISAGECPP__) @@ -955,7 +986,8 @@ void wxEvtHandler::Connect( int id, int lastId, if (!m_dynamicEvents) m_dynamicEvents = new wxList; - m_dynamicEvents->Append( (wxObject*) entry ); + // Insert at the front of the list so most recent additions are found first + m_dynamicEvents->Insert( (wxObject*) entry ); } bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType, @@ -965,13 +997,13 @@ bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType, if (!m_dynamicEvents) return FALSE; - wxNode *node = m_dynamicEvents->First(); + wxNode *node = m_dynamicEvents->GetFirst(); while (node) { #if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)node->Data(); + wxEventTableEntry *entry = (wxEventTableEntry*)node->GetData(); #else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data(); + wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES if ((entry->m_id == id) && @@ -986,7 +1018,7 @@ bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType, delete entry; return TRUE; } - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -998,13 +1030,13 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) int commandId = event.GetId(); - wxNode *node = m_dynamicEvents->First(); + wxNode *node = m_dynamicEvents->GetFirst(); while (node) { #if WXWIN_COMPATIBILITY_EVENT_TYPES - wxEventTableEntry *entry = (wxEventTableEntry*)node->Data(); + wxEventTableEntry *entry = (wxEventTableEntry*)node->GetData(); #else // !WXWIN_COMPATIBILITY_EVENT_TYPES - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->Data(); + wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES if (entry->m_fn) @@ -1021,13 +1053,11 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) (this->*((wxEventFunction) (entry->m_fn)))(event); - if (event.GetSkipped()) - return FALSE; - else + if ( ! event.GetSkipped() ) return TRUE; } } - node = node->Next(); + node = node->GetNext(); } return FALSE; };