|virtual YEvent *||filter (YEvent *event)=0|
|YDialog *||dialog () const|
|YEventFilter (YDialog *dialog=0)|
Abstract base class to filter events.
This class can be used to examine events just before they are delivered to the application. This is most useful for higher-level widgets or for libraries that need to react to certain events and either consume them, have them delivered unchanged to the application, or exchange an event with another one.
A YEventFilter belongs to one specific dialog. Each dialog can have any number of event filters. Each of those event filters is called (its YEventFilter::filter() method) for each event inside YDialog::waitForEvent(). The order in which event filters are called is undefined.
YEventFilter objects should be created with 'new' (on the heap). Since an YEventFilter registers itself with its dialog, the dialog will delete it in its destructor if it still exists after all child widgets are deleted.
Thus, it is safe to store a pointer to an YEventFilter until the corresponding dialog is deleted. After that, the pointer becomes invalid.
See YHelpButtonHandler in YDialog.cc for an example.
|YEventFilter::YEventFilter||(||YDialog *||dialog = ||)||
This registers the event filter with the specified dialog. The dialog assumes ownership of this object and will delete it in its destructor (unless this object is destroyed before that time).
This will unregister this object with its dialog.
|YDialog * YEventFilter::dialog||(||)||const|
Return the dialog this event filter belongs to.
The heart of the matter: The event filter function. Derived classes are required to implement this.
This method can inspect the event it receives. Hint: event->widget() is typically the most interesting information.
This method can react on individual events and
If 0 or a new event (another value than 'event') is returned, the old event is deleted. If a value different from 'event' or 0 is returned, that value is assumed to be a pointer to a newly created event. The dialog will assume ownership of that event and delete it when appropriate.
Note: Never delete 'event' in this method! Return 0 or a new event instead; the caller will take care of deleting the old event.
Implemented in YHelpButtonHandler.