SysEvent.h
Classes
- SysEvent -- abstract base class for system events (from X, Glish, signals) (full description)
- SysEventSource -- abstract base class for system event sources (full description)
- SysEventTarget -- abstract base class for system event targets (handlers) (full description)
- SysEventTargetInfo -- Internal class (full description)
Types
- UnknownGroup = 0
-
- XGroup
-
- GlishGroup
-
- SigGroup
-
Interface
- Public Members
- SysEvent() : rep(0), src(0)
- SysEvent(const SysEvent &other) : rep(other.clone()), src(other.src)
- virtual ~SysEvent()
- int operator==(const SysEvent &other)
- SysEvent &operator=(const SysEvent &other)
- virtual Group group() const
- virtual String type() const
- virtual Bool dispatch(SysEventTarget &e)
- virtual Bool dispatch(SysEventTarget &e, SysEventSource &xs)
- SysEventSource *source()
- Protected Members
- SysEvent(SysEvent *other, SysEventSource *s) : rep(other), src(s)
- SysEvent(SysEventSource *s) : rep(0), src(s)
- virtual SysEvent *clone() const
Review Status
- Reviewed By:
- Paul Shannon
- Date Reviewed:
- 1995/03/02
Prerequisite
- some understanding of X and Glish events
Etymology
Event is the class describing astronomical events, so 'SysEvent'
was picked to distinguish it.
Synopsis
This class is the base class for all system events. It is
simply a wrapper around the basic types of events which must
be handled in the system, e.g. X events, Glish events, signals,
etc. It provides a common interface to all events.
Motivation
To write a windowing Glish client, it is necessary to mix the
X and Glish event loops. While this could have been done by
explicitly writing the X event loop each time, it is better
to encapsulate the event loop in a couple of classes. This
class does this for the actual events.
Member Description
These are the various types of events which can be handled.
- XGroup -- X events
- GlishGroup -- Glish events
- SigGroup -- signals
SysEvent() : rep(0), src(0)
Creates an unusable event, but the event can be assigned to.
SysEvent(const SysEvent &other) : rep(other.clone()), src(other.src)
Creates an event given another event.
int operator==(const SysEvent &other)
Equality operator checks to see if two events are identical.
This just uses the "group()" and the "type()" to determine
equality.
SysEvent &operator=(const SysEvent &other)
Returns the group to which this event belongs.
Returns the type of this event represented as a
String.
Sends the event to the event target parameter.
Dispatches the event to the event target parameter, but
it also carries along an extra event source in case it is
needed. This is needed, for example, when a non-X event
target wants to do something on the GUI, the X event
source must be known.
Returns the event source which generated this event.
SysEvent(SysEvent *other, SysEventSource *s) : rep(other), src(s)
Protected constructor which is used by derived classes to
fill the letter (here rep).
virtual SysEvent *clone() const
Returns a "deep" copy of the object.
Interface
Public Members
- SysEventSource()
- virtual ~SysEventSource()
- virtual SysEvent::Group group() const = 0
- virtual SysEvent nextEvent() = 0
- virtual Bool waitingEvent() = 0
- virtual Bool connected() = 0
- virtual Bool canCombine(const SysEventSource &src) const = 0
- virtual Bool canCombine(const SysEventSource *src) const = 0
- virtual Bool combine(SysEventSource &src) = 0
- virtual Bool combine(SysEventSource *src) = 0
- virtual Bool addTarget(SysEventTarget &tgt, const String ®x) = 0
- virtual Bool addTarget(SysEventTarget *tgt, const String ®x, Bool ownTarget=False) = 0
- virtual Bool addTarget(SysEventTargetProc tgt, const String ®x, void *userData=0) = 0
- virtual Bool setDefault(SysEventTarget &tgt) = 0
- virtual Bool setDefault(SysEventTarget *tgt, Bool ownTarget=False) = 0
- virtual Bool setDefault(SysEventTargetProc tgt, void *userData=0) = 0
- virtual Bool loop() = 0
- virtual void invokeTarget() = 0
Review Status
- Reviewed By:
- Paul Shannon
- Date Reviewed:
- 1995/03/02
Prerequisite
Etymology
See SysEvent
Synopsis
This class is the base class for all of the sources of
events within the system, e.g. X Window System, Glish.
These are the entities which generate the events which
must be handled.
Motivation
See SysEvent
Member Description
virtual SysEvent::Group group() const = 0
Returns the group to which the event source belongs.
Returns the next event which needs to be processed.
This function may blocks until an event is ready to
be returned.
Used to check to see if there are any events waiting to be
processed.
virtual Bool connected() = 0
Used to check to see if the event source is still "connected",
i.e. whether it is still a valid source of events.
virtual Bool addTarget(SysEventTarget &tgt, const String ®x) = 0
virtual Bool addTarget(SysEventTarget *tgt, const String ®x, Bool ownTarget=False) = 0
virtual Bool addTarget(SysEventTargetProc tgt, const String ®x, void *userData=0) = 0
Part of the event driven interface to SysEventSource. These
return True upon success, and False upon failure.
Invoke the target whenever the event matches the regular
expression.
virtual Bool setDefault(SysEventTarget &tgt) = 0
virtual Bool setDefault(SysEventTarget *tgt, Bool ownTarget=False) = 0
virtual Bool setDefault(SysEventTargetProc tgt, void *userData=0) = 0
Part of the event driven interface to SysEventSource. These
return True upon success, and False upon failure.
Specifies the default action
virtual Bool canCombine(const SysEventSource &src) const = 0
virtual Bool canCombine(const SysEventSource *src) const = 0
virtual Bool combine(SysEventSource &src) = 0
virtual Bool combine(SysEventSource *src) = 0
virtual Bool loop() = 0
virtual void invokeTarget() = 0
Part of the event driven interface to SysEventSource. These
return True upon success, and False upon failure.
Interface
- SysEventTarget()
- virtual ~SysEventTarget()
- virtual SysEvent::Group group() const = 0
- virtual Bool canHandle(SysEvent &event)
- virtual Bool handle(SysEvent)
- virtual SysEventTarget *clone() const = 0
Review Status
- Reviewed By:
- Paul Shannon
- Date Reviewed:
- 1995/03/02
Prerequisite
- SysEvent
- the concept of event handlers
Etymology
See SysEvent
Synopsis
This class is the base class for all of the handlers of
events within the system. The classes which derive from
this class are the ones which react to waiting events.
They are analogous to X event handlers.
Motivation
See SysEvent
Member Description
virtual SysEvent::Group group() const = 0
Returns the group to which the event target belongs.
Checks to see if a given SysEventTarget can handle a
particular event.
virtual SysEventTarget *clone() const = 0
Types
- Unknown = 0
-
- ClassTgt
-
- ProcTgt
-
Interface
- SysEventTargetInfo(SysEventTargetProc t,const String &r,void *u=0)
- SysEventTargetInfo(SysEventTargetProc t, void *u=0)
- SysEventTargetInfo(SysEventTarget *t,const String &r)
- SysEventTargetInfo(SysEventTarget *t)
- SysEventTargetInfo(SysEventTargetInfo &other)
- SysEventTargetInfo &operator=(SysEventTargetInfo &other)
- virtual ~SysEventTargetInfo()
- Regex &getRegex()
- void *getUserData()
- virtual SysEventTarget &getTarget()
- SysEventTargetProc getTargetProc()
- TargetType type() const
- virtual uInt id() const
This class is used as a container of information for dispatching
targets. It facilitates invoking targets based on regular
expressions.
This class is not intended for external use.
Member Description
SysEventTargetInfo(SysEventTargetProc t,const String &r,void *u=0)
SysEventTargetInfo &operator=(SysEventTargetInfo &other)
virtual uInt id() const