class GmEvent

The GmEvent class encapsulates all possible events that can be delivered to components in glam.

Public Methods

[more] GmEvent ()
Standard constructor
[more]BasicEventType* getBasicData ()
Gets the data associated with any event.
[more]FocusEventType* getFocusData ()
Gets the data associated with a focus event.
[more]KeyEventType* getKeyData ()
Gets the data associated with a keyboard event.
[more]MouseEventType* getMouseData ()
Gets the data associated with a mouse event.
[more]GmTypes::EventType getType ()
Gets the type of this event.
[more]UserEventType* getUserData ()
Gets the data associated with a user-defined event.
[more]WidgetEventType* getWidgetData ()
Gets the data associated with a widget event.
[more]virtual void setFocusEvent (GmTypes::EventType eventType, unsigned short targetId, GmTypes::FocusType focusType)
Sets this event as a focus event and fills in all the necessary information about the event.
[more]virtual void setKeyEvent (GmTypes::EventType eventType, unsigned short targetId, unsigned char key, float x, float y)
Sets this event as a keyboard event and fills in all the necessary information about the event.
[more]virtual void setMouseEvent (GmTypes::EventType eventType, unsigned short targetId, int button, int state, float x, float y)
Sets this event as a mouse event and fills in all the necessary information about the event.
[more]virtual ~GmEvent ()
Virtual destructor

Public Members

[more]typedef struct The BasicEventType is to store information that every event must have.
[more]typedef struct The FocusEventType is used for all focus events.
[more]typedef struct The KeyEventType is used for keyboard events.
[more]typedef struct The MouseEventType is used for, *gasp* mouse events.
[more]typedef struct The UserEventType is used for all user-defined events.
[more]typedef struct The WidgetEventType is used for all widget based events.

Protected Fields

[more]void* mPayload
The payload for the event.
[more]GmTypes::EventType mType
The type of event that this event encapsulates.

Protected Methods

[more]virtual void freePayload ()
This method frees the memory associated with the event payload.


Documentation

The GmEvent class encapsulates all possible events that can be delivered to components in glam. An event is usually created by the application and then given to the GmEventDistributor for distribution to the correct component, or set of components. The GmEvent class supports mouse, keyboard and ui events (such as focus, defocus, etc).
otypedef struct The BasicEventType is to store information that every event must have.
The BasicEventType is to store information that every event must have. Every specific event must have BasicEventType as the first variable.

oObjectIDType rxId

oWidgetIDType txId

otypedef struct The MouseEventType is used for, *gasp* mouse events.
The MouseEventType is used for, *gasp* mouse events. It can encapsulate which component the event is to be delivered to as well as which button was pressed, the button's state (pressed/released) and its x and y position in screen coordinates.

oBasicEventType basicData

oint button

oint state

ofloat x

ofloat y

otypedef struct The KeyEventType is used for keyboard events.
The KeyEventType is used for keyboard events. It can encapsulate which component the event is to be delivered to as well as which key was pressed and the x and y position in screen coordinates.

oBasicEventType basicData

ounsigned char key

ofloat x

ofloat y

otypedef struct The FocusEventType is used for all focus events.
The FocusEventType is used for all focus events. It can encapsulate which component the event is to be delivered to as well as whether it is a focus or a de-focus event.

oBasicEventType basicData

oGmTypes::FocusType focusType

otypedef struct The WidgetEventType is used for all widget based events.
The WidgetEventType is used for all widget based events. Widget events are fired by widgets to be delivered to other widgets that are registered listeners. Events such as resize, visibility, selection and other non-direct user input functions are encapsulated as widget events.

oBasicEventType basicData

oGmTypes::WidgetMessageType messageType

ofloat x

ofloat y

otypedef struct The UserEventType is used for all user-defined events.
The UserEventType is used for all user-defined events. It can encapsulate which component the event is to be delivered to as well as any information the developer needs to be encapsulated in the message.

oBasicEventType basicData

ounsigned int userEventId

oGmTypes::EventType mType
The type of event that this event encapsulates. See GmTypes for a complete list of possible event types.

ovoid* mPayload
The payload for the event. The payload changes based on the type of event. If the GmEvent object's type is any of the mouse events, then the mPayload is going to be a MouseEventType.

o GmEvent()
Standard constructor

ovirtual ~GmEvent()
Virtual destructor

oGmTypes::EventType getType()
Gets the type of this event. Based on this type, you can call a getXXXEvent(), where XXX is Mouse, Key, Focus, etc to get the data associated with the event. For a complete list of all event types see GmTypes::EventType.

Returns:
the type of event that this object encapsulates

oBasicEventType* getBasicData()
Gets the data associated with any event.

Returns:
The data associated with any event

oMouseEventType* getMouseData()
Gets the data associated with a mouse event.

Returns:
The data associated with a mouse event

oFocusEventType* getFocusData()
Gets the data associated with a focus event.

Returns:
The data associated with a focus event

oKeyEventType* getKeyData()
Gets the data associated with a keyboard event.

Returns:
The data associated with a keyboard event

oWidgetEventType* getWidgetData()
Gets the data associated with a widget event.

Returns:
the data associated with a widget event

oUserEventType* getUserData()
Gets the data associated with a user-defined event.

Returns:
The data associated with a user-defined event

ovirtual void setMouseEvent(GmTypes::EventType eventType, unsigned short targetId, int button, int state, float x, float y)
Sets this event as a mouse event and fills in all the necessary information about the event.

Parameters:
eventType - the type of keyboard event to set the object to
targetId - the widget ID to designate as the target for this event
- button the mouse button that is associated with this mouse event. This value should be one of GLUT_LEFT_BUTTON, GLUT_RIGHT_BUTTON or GLUT_MIDDLE_BUTTON
- state the state of the active button. This value should be one of GLUT_UP or GLUT_DOWN
- x the x position of the pointer in screen coordinates
- y the y position of the pointer in screen coordinates

ovirtual void setKeyEvent(GmTypes::EventType eventType, unsigned short targetId, unsigned char key, float x, float y)
Sets this event as a keyboard event and fills in all the necessary information about the event.

Parameters:
eventType - the type of keyboard event to set the object to
targetId - the widget ID to designate as the target for this event
- key the key that was pressed
- x the x position of the pointer in screen coordinates
- y the y position of the pointer in screen coordinates

ovirtual void setFocusEvent(GmTypes::EventType eventType, unsigned short targetId, GmTypes::FocusType focusType)
Sets this event as a focus event and fills in all the necessary information about the event.

Parameters:
eventType - the type of focus event to set the object to
targetId - the widget ID to designate as the target for this event
- focusType the focus type of this event

ovirtual void freePayload()
This method frees the memory associated with the event payload. The payload size can vary so the freePayload will detect the size of the payload and delete the appropriately sized memory block.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.