35 class _Internal_QCanvas;
36 class _Internal_QCheckBox;
37 class _Internal_QPushButton;
38 class _Internal_QWidget;
224 const string& eventName =
"",
237 static string classToString(
EventClass eventClass);
270 static long getCurrentTimeMS();
324 virtual string
getName()
const;
336 virtual int getRow()
const;
360 virtual double getX()
const;
367 virtual double getY()
const;
443 virtual void setActionCommand(
const string& actionCommand);
448 virtual void setButton(
int button);
453 virtual void setInternalEvent(QEvent* event);
458 virtual void setKeyChar(
char keyChar);
463 virtual void setKeyChar(
const string& keyCharString);
468 virtual void setKeyCode(
int keyCode);
473 virtual void setModifiers(Qt::KeyboardModifiers modifiers);
478 virtual void setRequestURL(
const string& requestUrl);
483 virtual void setRowAndColumn(
int row,
int col);
493 virtual void setX(
double x);
498 virtual void setY(
double y);
515 enum EventListenerType {
523 struct EventListenerWrapper {
526 EventListenerType type;
528 void fireEvent(
const GEvent& event) {
529 if (type == HANDLER_EVENT) {
538 string _actionCommand;
553 QEvent* _internalQtEvent;
557 friend class _Internal_QWidget;
virtual EventType getEventType() const
Returns the event's type (minor type such as MOUSE_PRESSED).
Definition: gevent.cpp:148
virtual EventType getType() const
Returns the event's type (major type such as MOUSE_EVENT).
Definition: gevent.cpp:196
GEvent GTimerEvent
Definition: gevent.h:574
virtual char getKeyChar() const
Returns the key character that was typed, if this is a key event.
Definition: gevent.cpp:152
virtual int getModifiers() const
Returns the modifiers active during this event.
Definition: gevent.cpp:160
virtual bool isShiftKeyDown() const
Returns true if the Shift key was held down during this event.
Definition: gevent.cpp:246
virtual void ignore()
Instructs the GUI system to ignore or cancel this event.
Definition: gevent.cpp:208
virtual bool isRightClick() const
Returns true if the user pressed the right mouse button.
Definition: gevent.cpp:238
virtual string toString() const
Returns a text representation of the event for debugging.
Definition: gevent.cpp:488
GEvent GMouseEvent
Definition: gevent.h:570
Modifier
A set of constants used to check whether various event modifiers are in effect.
Definition: gevent.h:129
GEvent(EventClass eventClass=NULL_EVENT, EventType eventType=NULL_TYPE, string eventName="", GObservable *source=nullptr)
Creates a new event of the given type.
Definition: gevent.cpp:34
std::ostream & operator<<(std::ostream &out, const GEvent &event)
Writes the given event to the given output stream.
Definition: gevent.cpp:494
virtual bool isCtrlOrCommandKeyDown() const
Returns true if the Ctrl key, or the Command key (Mac), was held down during this event...
Definition: gevent.cpp:222
virtual QEvent * getInternalEvent() const
Returns the Qt event being wrapped by this event, if any.
Definition: gevent.cpp:176
virtual int getKeyCode() const
Returns the integer key code that was typed, if this is a key event.
Definition: gevent.cpp:156
virtual bool isMiddleClick() const
Returns true if the user pressed the middle mouse button.
Definition: gevent.cpp:234
static string keyCodeToString(int keyCode)
Converts a key code such as 67 into a string such as "A".
Definition: gevent.cpp:250
GEvent GTableEvent
Definition: gevent.h:573
GEvent GScrollEvent
Definition: gevent.h:571
GEvent GActionEvent
Definition: gevent.h:566
virtual string getName() const
Returns this event's name such as "click" or "keydown" or "actionperformed".
Definition: gevent.cpp:164
static string typeToString(EventType eventType)
Converts an event type such as MOUSE_EVENT to a string such as "MOUSE_EVENT".
Definition: gevent.cpp:78
GEvent GKeyEvent
Definition: gevent.h:569
std::function< void(GEvent)> GEventListener
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:38
virtual GInteractor * getInteractor() const
Returns the source interactor that generated this event.
Definition: gevent.cpp:172
virtual bool isCtrlKeyDown() const
Returns true if the Ctrl key was held down during this event.
Definition: gevent.cpp:218
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:52
GEvent waitForEvent(int mask=ANY_EVENT)
Dismisses the process until an event occurs whose type is covered by the event mask.
Definition: geventqueue.cpp:176
virtual double getX() const
Returns the x-coordinate of the mouse position within the interactor when this event occurred...
Definition: gevent.cpp:200
GEvent GWindowEvent
Definition: gevent.h:575
virtual string getActionCommand() const
Returns the action command associated with the event.
Definition: gevent.cpp:121
GEvent GChangeEvent
Definition: gevent.h:567
std::function< void()> GEventListenerVoid
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:44
virtual string getRequestURL() const
Returns this event's request URL, if this is a server URL event.
Definition: gevent.cpp:168
A GObservable object is one that is able to send out events.
Definition: gobservable.h:40
virtual bool isDoubleClick() const
Returns true if the user pressed the mouse button multiple times.
Definition: gevent.cpp:226
virtual GPoint getLocation() const
Returns an (x, y) point representing the mouse position within the interactor when this event occurre...
Definition: gevent.cpp:180
virtual GObservable * getSource() const
Returns the source object that generated this event.
Definition: gevent.cpp:188
virtual bool isAltKeyDown() const
Returns true if the Alt key was held down during this event.
Definition: gevent.cpp:214
virtual int getButton() const
Returns which mouse button was clicked, if this is a mouse event.
Definition: gevent.cpp:125
EventType
Defines the event subtypes for all events.
Definition: gevent.h:74
virtual long getTime() const
Returns this event's timestamp, as a number of milliseconds elapsed since the epoch of 1970/01/01 12:...
Definition: gevent.cpp:192
virtual EventClass getEventClass() const
Returns this event's class (major type such as MOUSE_EVENT).
Definition: gevent.cpp:144
static GEventListener EMPTY_EVENT_LISTENER
An empty event handler that can be passed that does nothing.
Definition: gevent.h:163
virtual EventClass getClass() const
Returns this event's class (major type such as MOUSE_EVENT).
Definition: gevent.cpp:129
EventClass
Represents all major categories of events.
Definition: gevent.h:49
virtual bool isLeftClick() const
Returns true if the user pressed the left mouse button.
Definition: gevent.cpp:230
A GEvent represents a user action that has occurred on a graphical interactor.
Definition: gevent.h:158
virtual ~GEvent()
Frees memory allocated internally by the event.
Definition: gevent.cpp:56
GEvent getNextEvent(int mask=ANY_EVENT)
Checks to see if there are any events of the desired type waiting on the event queue.
Definition: geventqueue.cpp:163
virtual bool isMetaKeyDown() const
Returns true if the Meta/Command key was held down during this event.
Definition: gevent.cpp:242
KeyCode
Definition: gevent.h:176
friend class GObservable
Definition: gevent.h:556
This struct contains real-valued x and y fields.
Definition: gtypes.h:202
virtual double getY() const
Returns the y-coordinate of the mouse position within the interactor when this event occurred...
Definition: gevent.cpp:204
static GEventListener LOG_EVENT
An event listener that just prints the event that occurred.
Definition: gevent.h:169
virtual int getColumn() const
Returns the column that was interacted with, if this is a table event.
Definition: gevent.cpp:133
GEvent GHyperlinkEvent
Definition: gevent.h:568
GMouseEvent waitForClick()
Waits for a mouse click to occur anywhere in any window, returning the event that occurred...
Definition: geventqueue.cpp:167
virtual int getRow() const
Returns the row that was interacted with, if this is a table event.
Definition: gevent.cpp:184
GEvent GServerEvent
Definition: gevent.h:572