19 #ifndef _gobservable_h 20 #define _gobservable_h 32 class _Internal_QWidget;
64 virtual string
getType()
const = 0;
116 virtual void fireGEvent(QMouseEvent* event,
EventType eventType,
const string& eventName,
const string& actionCommand =
"");
122 virtual void fireGEvent(QResizeEvent* event,
EventType eventType,
const string& eventName);
140 virtual void fireGEvent(QWindowStateChangeEvent* event,
EventType eventType,
const string& eventName);
208 std::map<string, GEvent::EventListenerWrapper> _eventMap;
213 friend class _Internal_QWidget;
218 #endif // _gobservable_h virtual string getType() const =0
Returns the concrete type of the object as a string, such as "GButton" or "GWindow".
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:59
virtual string toString() const
Returns a string representation of this observable object's state.
Definition: gobservable.cpp:264
virtual bool isAcceptingEvent(int eventMask) const
Returns true if the observable object has a listener for the given type of event. ...
Definition: gobservable.cpp:220
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:234
virtual void fireEvent(GEvent &event)
Sends out the given event to any attached listeners.
Definition: gobservable.cpp:47
std::function< void(GEvent)> GEventListener
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:38
GObservable()
Initializes a newly created observable object.
Definition: gobservable.cpp:26
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:52
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:228
virtual void clearEventListeners()
Removes all event listeners from this object.
Definition: gobservable.cpp:35
virtual bool eventsEnabled() const
Returns true if the object is currently allowing itself to fire events.
Definition: gobservable.cpp:43
virtual ~GObservable()
Frees any memory used internally by the observable object.
Definition: gobservable.cpp:31
virtual void ensureThreadSafety(string memberName="")
Ensures that we are currently in the Qt GUI thread.
Definition: gobservable.cpp:39
std::function< void()> GEventListenerVoid
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:44
A GObservable object is one that is able to send out events.
Definition: gobservable.h:40
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:224
virtual bool hasEventListener(string eventName) const
Returns true if the observable object has a listener for the given type of event. ...
Definition: gobservable.cpp:216
EventType
Defines the event subtypes for all events.
Definition: gevent.h:74
virtual void setEventsEnabled(bool eventsEnabled)
Sets whether the object is currently allowing itself to fire events.
Definition: gobservable.cpp:260
A GEvent represents a user action that has occurred on a graphical interactor.
Definition: gevent.h:158
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:248