/////////////////////////////////////////////////////////////////////////////
-// Name: event.cpp
+// Name: src/common/event.cpp
// Purpose: Event classes
// Author: Julian Smart
// Modified by:
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
-// Some older compilers (such as EMX) cannot handle
-// #pragma interface/implementation correctly, iff
-// #pragma implementation is used in _two_ translation
-// units (as created by e.g. event.cpp compiled for
-// libwx_base and event.cpp compiled for libwx_gui_core).
-// So we must not use those pragmas for those compilers in
-// such files.
- #pragma implementation "event.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#endif
#ifndef WX_PRECOMP
- #include "wx/defs.h"
#include "wx/app.h"
#include "wx/list.h"
DEFINE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN)
DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK)
DEFINE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE)
-DEFINE_EVENT_TYPE(wxEVT_SCROLL_ENDSCROLL)
+DEFINE_EVENT_TYPE(wxEVT_SCROLL_CHANGED)
// Scroll events from wxWindow
DEFINE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP)
delete m_dynamicEvents;
};
+ if (m_pendingEvents)
+ m_pendingEvents->DeleteContents(true);
delete m_pendingEvents;
#if wxUSE_THREADS
// Remove us from wxPendingEvents if necessary.
if(wxPendingEventsLocker)
wxENTER_CRIT_SECT(*wxPendingEventsLocker);
- if ( wxPendingEvents ) {
- wxPendingEvents->DeleteObject(this);
+ if ( wxPendingEvents )
+ {
+ // Delete all occurences of this from the list of pending events
+ while (wxPendingEvents->DeleteObject(this)) { } // Do nothing
}
if(wxPendingEventsLocker)
wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
delete m_eventsLocker;
m_eventsLocker = NULL;
#endif
-};
+}
#endif // wxUSE_THREADS
wxLEAVE_CRIT_SECT(*wxPendingEventsLocker);
- // 3) Inform the system that new pending events are somwehere,
+ // 3) Inform the system that new pending events are somewhere,
// and that these should be processed in idle time.
wxWakeUpIdle();
}
{
wxEvent *event = (wxEvent *)node->GetData();
+ // It's importan we remove event from list before processing it.
+ // Else a nested event loop, for example from a modal dialog, might
+ // process the same event again.
m_pendingEvents->Erase(node);
wxLEAVE_CRIT_SECT( Lock() );
wxENTER_CRIT_SECT( Lock() );
- if ( !--n )
+ if ( --n == 0 )
break;
}
}
return false;
-};
+}
void wxEvtHandler::DoSetClientObject( wxClientData *data )
{