17 #ifndef _gobservable_h 18 #define _gobservable_h 28 class _Internal_QWidget;
60 virtual string
getType()
const = 0;
94 virtual void fireGEvent(QEvent* event, EventType eventType,
const string& eventName);
100 virtual void fireGEvent(QCloseEvent* event, EventType eventType,
const string& eventName);
106 virtual void fireGEvent(QKeyEvent* event, EventType eventType,
const string& eventName);
112 virtual void fireGEvent(QMouseEvent* event, EventType eventType,
const string& eventName,
const string& actionCommand =
"");
118 virtual void fireGEvent(QResizeEvent* event, EventType eventType,
const string& eventName);
124 virtual void fireGEvent(QTimerEvent* event, EventType eventType,
const string& eventName);
130 virtual void fireGEvent(QWheelEvent* event, EventType eventType,
const string& eventName);
136 virtual void fireGEvent(QWindowStateChangeEvent* event, EventType eventType,
const string& eventName);
180 virtual void setEventListener(
const string& eventName, GEventListener func);
187 virtual void setEventListener(
const string& eventName, GEventListenerVoid func);
194 virtual void setEventListeners(std::initializer_list<string> eventNames, GEventListener func);
201 virtual void setEventListeners(std::initializer_list<string> eventNames, GEventListenerVoid func);
204 std::map<string, GEvent::EventListenerWrapper> _eventMap;
209 friend class _Internal_QWidget;
212 #endif // _gobservable_h virtual bool isAcceptingEvent(int eventMask) const
Returns true if the observable object has a listener for the given type of event. ...
Definition: gobservable.cpp:216
virtual void removeEventListeners(std::initializer_list< string > eventNames)
Removes any event listener from this observable object that would respond to the given types of event...
Definition: gobservable.cpp:224
virtual void clearEventListeners()
Removes all event listeners from this object.
Definition: gobservable.cpp:31
A GEvent represents a user action that has occurred on a graphical interactor.
Definition: gevent.h:153
virtual void removeEventListener(string eventName)
Removes any event listener from this observable object that would respond to the given type of event...
Definition: gobservable.cpp:220
virtual bool hasEventListener(string eventName) const
Returns true if the observable object has a listener for the given type of event. ...
Definition: gobservable.cpp:212
A GObservable object is one that is able to send out events.
Definition: gobservable.h:36
virtual void fireGEvent(QEvent *event, EventType eventType, string eventName)
Creates an event of the given type, then sends it out to any attached listeners.
Definition: gobservable.cpp:55
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
virtual void fireEvent(GEvent &event)
Sends out the given event to any attached listeners.
Definition: gobservable.cpp:43
virtual void setEventListeners(std::initializer_list< string > eventNames, GEventListener func)
Adds an event listener from this observable object to respond to the given types of events...
Definition: gobservable.cpp:244
virtual bool eventsEnabled() const
Returns true if the object is currently allowing itself to fire events.
Definition: gobservable.cpp:39
virtual void setEventListener(string eventName, GEventListener func)
Adds an event listener from this observable object to respond to the given type of event...
Definition: gobservable.cpp:230
virtual void ensureThreadSafety(string memberName="")
Ensures that we are currently in the Qt GUI thread.
Definition: gobservable.cpp:35
virtual string getType() const =0
Returns the concrete type of the object as a string, such as "GButton" or "GWindow".
virtual string toString() const
Returns a string representation of this observable object's state.
Definition: gobservable.cpp:260
virtual void setEventsEnabled(bool eventsEnabled)
Sets whether the object is currently allowing itself to fire events.
Definition: gobservable.cpp:256
GObservable()
Initializes a newly created observable object.
Definition: gobservable.cpp:22
virtual ~GObservable()
Frees any memory used internally by the observable object.
Definition: gobservable.cpp:27