libyui
Public Member Functions | Protected Attributes

YSimpleEventHandler Class Reference

#include <YSimpleEventHandler.h>

List of all members.

Public Member Functions

 YSimpleEventHandler ()
virtual ~YSimpleEventHandler ()
void sendEvent (YEvent *event_disown)
bool eventPendingFor (YWidget *widget) const
YEventpendingEvent () const
YEventconsumePendingEvent ()
void deletePendingEventsFor (YWidget *widget)
void clear ()
void blockEvents (bool block=true)
void unblockEvents ()
bool eventsBlocked () const
void deleteEvent (YEvent *event)

Protected Attributes

YEvent_pendingEvent
bool _eventsBlocked

Detailed Description

Simple event handler suitable for most UIs.

This event handler keeps track of one single event that gets overwritten when a new one arrives.


Constructor & Destructor Documentation

YSimpleEventHandler::YSimpleEventHandler ( )

Constructor.

YSimpleEventHandler::~YSimpleEventHandler ( ) [virtual]

Destructor.

If there is a pending event, it is deleted here.


Member Function Documentation

void YSimpleEventHandler::blockEvents ( bool  block = true)

Block (or unblock) events. If events are blocked, any event sent with sendEvent() from now on is ignored (and will get lost) until events are unblocked again.

void YSimpleEventHandler::clear ( )

Clears any pending event (deletes the corresponding object).

YEvent * YSimpleEventHandler::consumePendingEvent ( )

Consumes the pending event. Sets the internal pending event to 0. Does NOT delete the internal consuming event.

The caller assumes ownership of the object this pending event points to. In particular, he has to take care to delete that object when he is done processing it.

Returns the pending event or 0 if there is none.

void YSimpleEventHandler::deleteEvent ( YEvent event)

Delete an event. Don't call this from the outside; this is public only because of limitations of C++ .

void YSimpleEventHandler::deletePendingEventsFor ( YWidget widget)

Delete any pending events for the specified widget. This is useful mostly if the widget is about to be destroyed.

bool YSimpleEventHandler::eventPendingFor ( YWidget widget) const

Returns 'true' if there is any event pending for the specified widget.

bool YSimpleEventHandler::eventsBlocked ( ) const [inline]

Returns 'true' if events are currently blocked.

YEvent* YSimpleEventHandler::pendingEvent ( ) const [inline]

Returns the last event that isn't processed yet or 0 if there is none.

This event handler keeps track of only one single (the last one) event.

void YSimpleEventHandler::sendEvent ( YEvent event_disown)

Widget event handlers call this when an event occured that should be the answer to a UserInput() / PollInput() (etc.) call.

The UI assumes ownership of the event object that 'event' points to, so the event MUST be created with new(). The UI is to take care to delete the event after it has been processed.

If events are blocked (see blockEvents() ), the event sent with this function will be ignored (but safely deleted - no memory leak).

It is an error to pass 0 for 'event'.

This simple event handler keeps track of only the latest user event. If there is more than one, older events are automatically discarded. Since Events are created on the heap with the "new" operator, discarded events need to be deleted.

Events that are not discarded are deleted later (after they are processed) by the generic UI.

void YSimpleEventHandler::unblockEvents ( ) [inline]

Unblock events previously blocked. This is just an alias for blockEvents( false) for better readability.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends