The SimpleCxxLib package


#include "gevents.h"

class GActionEvent : public GEvent

This event subclass represents an action event. Action events are generated by the classes in the 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
GActionEvent(type, source, actionCommand) Creates a GActionEvent using the specified parameters.
Methods
getActionCommand() Returns the action command associated with this event.
getSource() Returns a pointer to the GObject that generated this event.
toString() Converts the event to a human-readable representation of the event.

Constructor detail


GActionEvent(EventType type, GObject *source, string actionCommand);
Creates a GActionEvent using the specified parameters.

Usage:

GActionEvent actionEvent(type, source, actionCommand);

Method detail


GObject *getSource() const;
Returns a pointer to the GObject that generated this event.

Usage:

GObject *gobj = e.getSource();

string getActionCommand() const;
Returns the action command associated with this event.

Usage:

string cmd = e.getActionCommand();

string toString() const;
Converts the event to a human-readable representation of the event.

Usage:

string str = e.toString();