#include "wx/app.h"
#include "wx/utils.h"
#include "wx/stopwatch.h"
+ #include "wx/module.h"
#if wxUSE_GUI
#include "wx/control.h"
#endif // wxUSE_GUI
#endif
-#include "wx/module.h"
-
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent)
+ IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent, wxCommandEvent)
#endif // wxUSE_GUI
DEFINE_EVENT_TYPE(wxEVT_NULL)
DEFINE_EVENT_TYPE(wxEVT_IDLE)
DEFINE_EVENT_TYPE(wxEVT_SOCKET)
+DEFINE_EVENT_TYPE(wxEVT_TIMER)
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED)
-// Sockets and timers send events, too
-DEFINE_EVENT_TYPE(wxEVT_TIMER)
-
// Mouse event types
DEFINE_EVENT_TYPE(wxEVT_LEFT_DOWN)
DEFINE_EVENT_TYPE(wxEVT_LEFT_UP)
DEFINE_EVENT_TYPE(wxEVT_ICONIZE)
DEFINE_EVENT_TYPE(wxEVT_MAXIMIZE)
DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST)
DEFINE_EVENT_TYPE(wxEVT_PAINT)
DEFINE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND)
DEFINE_EVENT_TYPE(wxEVT_NC_PAINT)
}
wxEvent::wxEvent(const wxEvent &src)
- : wxObject()
+ : wxObject(src)
, m_eventObject(src.m_eventObject)
, m_eventType(src.m_eventType)
, m_timeStamp(src.m_timeStamp)
wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId)
: wxEvent(theId, commandType)
-#if WXWIN_COMPATIBILITY_2_4
- , m_commandString(this)
-#endif
{
m_clientData = (char *) NULL;
m_clientObject = (wxClientData *) NULL;
m_wheelRotation = 0;
m_wheelDelta = 0;
m_linesPerAction = 0;
+ m_wheelAxis = 0;
}
void wxMouseEvent::Assign(const wxMouseEvent& event)
m_wheelRotation = event.m_wheelRotation;
m_wheelDelta = event.m_wheelDelta;
m_linesPerAction = event.m_linesPerAction;
+ m_wheelAxis = event.m_wheelAxis;
}
// return true if was a button dclick event
m_eventsLocker = new wxCriticalSection;
# endif
#endif
+
// no client data (yet)
m_clientData = NULL;
m_clientDataType = wxClientData_None;
void wxEvtHandler::ProcessPendingEvents()
{
- // this method is only called by wxApp if this handler does have pending
- // events
+ // this method is only called by wxApp if this handler does have
+ // pending events
wxCHECK_RET( m_pendingEvents,
wxT("Please call wxApp::ProcessPendingEvents() instead") );
-
+
wxENTER_CRIT_SECT( Lock() );
// we leave the loop once we have processed all events that were present at
// 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() );
ProcessEvent(*event);
+
delete event;
wxENTER_CRIT_SECT( Lock() );
return focusWin;
}
+// ----------------------------------------------------------------------------
+// wxEventBlocker
+// ----------------------------------------------------------------------------
+
+wxEventBlocker::wxEventBlocker(wxWindow *win, wxEventType type)
+{
+ wxCHECK_RET(win, wxT("Null window given to wxEventBlocker"));
+
+ m_window = win;
+
+ Block(type);
+ m_window->PushEventHandler(this);
+}
+
+wxEventBlocker::~wxEventBlocker()
+{
+ wxEvtHandler *popped = m_window->PopEventHandler(false);
+ wxCHECK_RET(popped == this,
+ wxT("Don't push other event handlers into a window managed by wxEventBlocker!"));
+}
+
+bool wxEventBlocker::ProcessEvent(wxEvent& event)
+{
+ // should this event be blocked?
+ for ( size_t i = 0; i < m_eventsToBlock.size(); i++ )
+ {
+ wxEventType t = (wxEventType)m_eventsToBlock[i];
+ if ( t == wxEVT_ANY || t == event.GetEventType() )
+ return true; // yes, it should: mark this event as processed
+ }
+
+ return false;
+}
+
#endif // wxUSE_GUI