SimpleCxxLib
packageclass GActionEvent : public GEvent
GInteractor
hierarchy. As an example, the following program displays
a button that, when pushed, generates the message
"Please do not press this button again"
(with thanks to Douglas Adams's Hitchhiker's
Guide to the Galaxy):
int main() { GWindow gw; GButton *button = new GButton("RED"); gw.addToRegion(button, "SOUTH"); while (true) { GEvent e = waitForEvent(ACTION_EVENT | CLICK_EVENT); if (e.getEventType() == MOUSE_CLICKED) break; cout << "Please do not press this button again." << endl; } return 0; }
Constructor | |
Creates a GActionEvent using the specified parameters. | |
Methods | |
Returns the action command associated with this event. | |
Returns a pointer to the GObject that generated this event. | |
Converts the event to a human-readable representation of the event. |
GActionEvent(EventType type, GObject *source, string actionCommand);
GActionEvent
using the specified parameters.
Usage:
GActionEvent actionEvent(type, source, actionCommand);
GObject *getSource() const;
GObject
that generated this event.
Usage:
GObject *gobj = e.getSource();
string getActionCommand() const;
Usage:
string cmd = e.getActionCommand();
string toString() const;
Usage:
string str = e.toString();