A GObservable object is one that is able to send out events. More...
#include "gobservable.h"
Public Member Functions | |
GObservable() | |
Initializes a newly created observable object. More... | |
~GObservable() | |
Frees any memory used internally by the observable object. More... | |
bool | eventsEnabled() const |
Returns true if the object is currently allowing itself to fire events. More... | |
string | getType() const =0 |
Returns the concrete type of the object as a string, such as "GButton" or "GWindow" . More... | |
void | setEventsEnabled(bool eventsEnabled) |
Sets whether the object is currently allowing itself to fire events. More... | |
string | toString() const |
Returns a string representation of this observable object's state. More... | |
Protected Member Functions | |
void | clearEventListeners() |
Removes all event listeners from this object. More... | |
void | ensureThreadSafety(string memberName="") |
Ensures that we are currently in the Qt GUI thread. More... | |
void | fireEvent(GEvent &event) |
Sends out the given event to any attached listeners. More... | |
void | fireGEvent(QEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QCloseEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QKeyEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QMouseEvent *event, EventType eventType, string eventName, string actionCommand="") |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QResizeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QTimerEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWheelEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWindowStateChangeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
bool | hasEventListener(string eventName) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(int eventMask) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(const GEvent &event) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(string eventType) const |
Returns true if the observable object has a listener for the given type of event. More... | |
void | removeEventListener(string eventName) |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown". More... | |
void | removeEventListeners(std::initializer_list< string > eventNames) |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListener func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
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, such as "click" or "keydown". More... | |
void | setEventListeners(std::initializer_list< string > eventNames, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown". More... | |
A GObservable object is one that is able to send out events.
Listeners can register themselves to be notified when events occur. This serves as a base class for the various GInteractor subclasses, as well as for the GWindow class, so that clients can attach listeners to them.
GObservable | ( | ) |
Initializes a newly created observable object.
|
virtual |
Frees any memory used internally by the observable object.
|
protectedvirtual |
Removes all event listeners from this object.
|
protectedvirtual |
Ensures that we are currently in the Qt GUI thread.
|
virtual |
Returns true if the object is currently allowing itself to fire events.
Initially this is true unless the client has called setEventsEnabled(false)
or the object is not visible.
Reimplemented in GInteractor.
|
protectedvirtual |
Sends out the given event to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtual |
Creates an event of the given type, then sends it out to any attached listeners.
|
pure virtual |
Returns the concrete type of the object as a string, such as "GButton"
or "GWindow"
.
Each GObservable subtype must override this method.
Implemented in GWindow, GCanvas, GContainer, GInteractor, GTable, GTextArea, GSlider, GTextField, GBrowserPane, GChooser, GLabel, GButton, GScrollBar, GRadioButton, GScrollPane, GCheckBox, and GSpacer.
|
protectedvirtual |
Returns true if the observable object has a listener for the given type of event.
|
protectedvirtual |
Returns true if the observable object has a listener for the given type of event.
See gevent.h for event types and masks.
|
protectedvirtual |
Returns true if the observable object has a listener for the given type of event.
|
protectedvirtual |
Returns true if the observable object has a listener for the given type of event.
|
protectedvirtual |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown".
|
protectedvirtual |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown".
|
protectedvirtual |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtual |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtual |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
protectedvirtual |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
virtual |
Sets whether the object is currently allowing itself to fire events.
Initially this is true.
|
virtual |
Returns a string representation of this observable object's state.
Primarily used for debugging purposes.
|
friend |