26 #define YUILogComponent "ui-events" 30 #include "YSimpleEventHandler.h" 34 #define VERBOSE_EVENTS 0 35 #define VERBOSE_BLOCK 0 41 _eventsBlocked =
false;
56 yuiDebug() <<
"Clearing pending event: " << _pendingEvent << std::endl;
65 YEvent *
event = _pendingEvent;
69 yuiDebug() <<
"Consuming " <<
event << std::endl;
80 yuiError() <<
"Ignoring NULL event" << std::endl;
87 yuiDebug() <<
"Blocking " <<
event << std::endl;
112 yuiDebug() <<
"New pending event: " <<
event << std::endl;
115 _pendingEvent = event;
127 return event->
widget() == widget;
133 if ( ! _pendingEvent )
138 if ( event && event->widget() == widget &&
event->
isValid() )
140 yuiDebug() <<
"Deleting " << _pendingEvent << std::endl;
149 if ( block ) yuiDebug() <<
"Blocking events" << std::endl;
150 else yuiDebug() <<
"Unblocking events" << std::endl;
153 _eventsBlocked = block;
159 if ( event == _pendingEvent )
167 yuiDebug() <<
"Deleting " <<
event << std::endl;
173 yuiError() <<
"Attempt to delete invalid event " <<
event << std::endl;
virtual ~YSimpleEventHandler()
Destructor.
YEvent * consumePendingEvent()
Consumes the pending event.
bool isValid() const
Check if this event is valid.
bool eventPendingFor(YWidget *widget) const
Returns 'true' if there is any event pending for the specified widget.
Abstract base class for events to be returned upon UI::UserInput() and related functions.
void sendEvent(YEvent *event_disown)
Widget event handlers call this when an event occured that should be the answer to a UserInput() / Po...
bool eventsBlocked() const
Returns 'true' if events are currently blocked.
void clear()
Clears any pending event (deletes the corresponding object).
void deleteEvent(YEvent *event)
Delete an event.
void blockEvents(bool block=true)
Block (or unblock) events.
YSimpleEventHandler()
Constructor.
void deletePendingEventsFor(YWidget *widget)
Delete any pending events for the specified widget.