osgGA::EventQueue Class Reference

`#include <EventQueue>`

Inheritance diagram for osgGA::EventQueue:

## Public Types

typedef std::list< osg::ref_ptr< Event > > | Events

## Public Member Functions

| EventQueue (GUIEventAdapter::MouseYOrientation mouseYOrientation=GUIEventAdapter::Y_INCREASING_DOWNWARDS)
bool | empty () const
void | setEvents (Events &events)
bool | takeEvents (Events &events)
bool | takeEvents (Events &events, double cutOffTime)
bool | copyEvents (Events &events) const
void | appendEvents (Events &events)
void | addEvent (Event *event)
void | setUseFixedMouseInputRange (bool useFixedMouseInputRange)
bool | getUseFixedMouseInputRange ()
void | setGraphicsContext (osg::GraphicsContext *context)
osg::GraphicsContext * | getGraphicsContext ()
const osg::GraphicsContext * | getGraphicsContext () const
void | syncWindowRectangleWithGraphicsContext ()
void | setMouseInputRange (float xMin, float yMin, float xMax, float yMax)
osgGA::GUIEventAdapter * | windowResize (int x, int y, int width, int height)
osgGA::GUIEventAdapter * | windowResize (int x, int y, int width, int height, double time)
osgGA::GUIEventAdapter * | mouseScroll (GUIEventAdapter::ScrollingMotion sm)
osgGA::GUIEventAdapter * | mouseScroll (GUIEventAdapter::ScrollingMotion sm, double time)
osgGA::GUIEventAdapter * | mouseScroll2D (float x, float y)
osgGA::GUIEventAdapter * | mouseScroll2D (float x, float y, double time)
osgGA::GUIEventAdapter * | penPressure (float pressure)
osgGA::GUIEventAdapter * | penPressure (float pressure, double time)
osgGA::GUIEventAdapter * | penOrientation (float tiltX, float tiltY, float rotation)
osgGA::GUIEventAdapter * | penOrientation (float tiltX, float tiltY, float rotation, double time)
osgGA::GUIEventAdapter * | penProximity (GUIEventAdapter::TabletPointerType pt, bool isEntering)
osgGA::GUIEventAdapter * | penProximity (GUIEventAdapter::TabletPointerType pt, bool isEntering, double time)
void | mouseWarped (float x, float y)
osgGA::GUIEventAdapter * | mouseMotion (float x, float y)
osgGA::GUIEventAdapter * | mouseMotion (float x, float y, double time)
osgGA::GUIEventAdapter * | mouseButtonPress (float x, float y, unsigned int button)
osgGA::GUIEventAdapter * | mouseButtonPress (float x, float y, unsigned int button, double time)
osgGA::GUIEventAdapter * | mouseDoubleButtonPress (float x, float y, unsigned int button)
osgGA::GUIEventAdapter * | mouseDoubleButtonPress (float x, float y, unsigned int button, double time)
osgGA::GUIEventAdapter * | mouseButtonRelease (float x, float y, unsigned int button)
osgGA::GUIEventAdapter * | mouseButtonRelease (float x, float y, unsigned int button, double time)
osgGA::GUIEventAdapter * | keyPress (int key, int unmodifiedKey=0)
osgGA::GUIEventAdapter * | keyPress (int key, double time, int unmodifiedKey=0)
osgGA::GUIEventAdapter * | keyRelease (int key, int unmodifiedKey=0)
osgGA::GUIEventAdapter * | keyRelease (int key, double time, int unmodifiedKey=0)
GUIEventAdapter * | touchBegan (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time)
GUIEventAdapter * | touchBegan (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y)
GUIEventAdapter * | touchMoved (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, double time)
GUIEventAdapter * | touchMoved (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y)
GUIEventAdapter * | touchEnded (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count, double time)
GUIEventAdapter * | touchEnded (unsigned int id, GUIEventAdapter::TouchPhase phase, float x, float y, unsigned int tap_count)
osgGA::GUIEventAdapter * | closeWindow ()
osgGA::GUIEventAdapter * | closeWindow (double time)
osgGA::GUIEventAdapter * | quitApplication ()
osgGA::GUIEventAdapter * | quitApplication (double time)
osgGA::GUIEventAdapter * | frame (double time)
void | setStartTick (osg::Timer_t tick)
osg::Timer_t | getStartTick () const
double | getTime () const
void | clear ()
GUIEventAdapter * | createEvent ()
void | setCurrentEventState (GUIEventAdapter *ea)
GUIEventAdapter * | getCurrentEventState ()
const GUIEventAdapter * | getCurrentEventState () const
GUIEventAdapter * | userEvent (osg::Referenced *userEventData)
GUIEventAdapter * | userEvent (osg::Referenced *userEventData, double time)
void | setFirstTouchEmulatesMouse (bool b)
bool | getFirstTouchEmulatesMouse () const
Public Member Functions inherited from osg::Referenced
| Referenced ()
| Referenced (bool threadSafeRefUnref)
| Referenced (const Referenced &)
Referenced & | operator= (const Referenced &)
virtual void | setThreadSafeRefUnref (bool)
bool | getThreadSafeRefUnref () const
OpenThreads::Mutex * | getRefMutex () const
int | ref () const
int | unref () const
int | unref_nodelete () const
int | referenceCount () const
ObserverSet * | getObserverSet () const
ObserverSet * | getOrCreateObserverSet () const
void | addObserver (Observer *observer) const
void | removeObserver (Observer *observer) const

## Protected Member Functions

virtual | ~EventQueue ()
EventQueue & | operator= (const EventQueue &)
Protected Member Functions inherited from osg::Referenced
virtual | ~Referenced ()
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const
void | deleteUsingDeleteHandler () const

## Protected Attributes

osg::ref_ptr< GUIEventAdapter > | _accumulateEventState
bool | _useFixedMouseInputRange
osg::Timer_t | _startTick
OpenThreads::Mutex | _eventQueueMutex
Events | _eventQueue
bool | _firstTouchEmulatesMouse
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr | _observerSet
OpenThreads::Atomic | _refCount

## Additional Inherited Members

Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * | getGlobalReferencedMutex ()
static void | setDeleteHandler (DeleteHandler *handler)
static DeleteHandler * | getDeleteHandler ()

## Detailed Description

EventQueue implementation for collecting and adapting windowing events

## Member Typedef Documentation

## Events

typedef std::list< osg::ref_ptr<Event> > osgGA::EventQueue::Events

## Constructor & Destructor Documentation

## EventQueue()

osgGA::EventQueue::EventQueue | ( | GUIEventAdapter::MouseYOrientation | mouseYOrientation = GUIEventAdapter::Y_INCREASING_DOWNWARDS | ) |

References osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS.

Referenced by operator=().

## ~EventQueue()

virtual osgGA::EventQueue::~EventQueue | ( |  | ) |

protected virtual

## Member Function Documentation

## addEvent()

void osgGA::EventQueue::addEvent | ( | Event * | event | ) |

Add an event to the end of the event queue.

## appendEvents()

void osgGA::EventQueue::appendEvents | ( | Events & | events | ) |

Add events to end of event queue.

## clear()

void osgGA::EventQueue::clear | ( |  | ) |

clear all events from queue.

Referenced by setStartTick().

## closeWindow() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::closeWindow | ( |  | ) |

inline

Method for adapting close window events.

References closeWindow(), and getTime().

Referenced by closeWindow().

## closeWindow() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::closeWindow | ( | double | time | ) |

Method for adapting close window event with specified event time.

## copyEvents()

bool osgGA::EventQueue::copyEvents | ( | Events & | events | ) | const

Take a copy the entire event queue leaving the EventQueue' event queue intact.

## createEvent()

GUIEventAdapter * osgGA::EventQueue::createEvent | ( |  | ) |

convenience method for create an event ready to fill in. Clones the getCurrentEventState() to produce a up to date event state.

## empty()

bool osgGA::EventQueue::empty | ( |  | ) | const

inline

References _eventQueue, and _eventQueueMutex.

## frame()

osgGA::GUIEventAdapter * osgGA::EventQueue::frame | ( | double | time | ) |

Method for adapting frame events.

## getCurrentEventState() [1/2]

GUIEventAdapter * osgGA::EventQueue::getCurrentEventState | ( |  | ) |

inline

References _accumulateEventState.

Referenced by getGraphicsContext(), getGraphicsContext(), setGraphicsContext(), and setMouseInputRange().

## getCurrentEventState() [2/2]

const GUIEventAdapter * osgGA::EventQueue::getCurrentEventState | ( |  | ) | const

inline

References _accumulateEventState.

## getFirstTouchEmulatesMouse()

bool osgGA::EventQueue::getFirstTouchEmulatesMouse | ( |  | ) | const

inline

References _firstTouchEmulatesMouse.

## getGraphicsContext() [1/2]

osg::GraphicsContext * osgGA::EventQueue::getGraphicsContext | ( |  | ) |

inline

References getCurrentEventState().

## getGraphicsContext() [2/2]

const osg::GraphicsContext * osgGA::EventQueue::getGraphicsContext | ( |  | ) | const

inline

References getCurrentEventState().

## getStartTick()

osg::Timer_t osgGA::EventQueue::getStartTick | ( |  | ) | const

inline

References _startTick.

## getTime()

double osgGA::EventQueue::getTime | ( |  | ) | const

inline

References _startTick, osg::Timer::delta_s(), and osg::Timer::instance().

Referenced by closeWindow(), keyPress(), keyRelease(), mouseButtonPress(), mouseButtonRelease(), mouseDoubleButtonPress(), mouseMotion(), mouseScroll(), mouseScroll2D(), penOrientation(), penPressure(), penProximity(), quitApplication(), touchBegan(), touchEnded(), touchMoved(), userEvent(), and windowResize().

## getUseFixedMouseInputRange()

bool osgGA::EventQueue::getUseFixedMouseInputRange | ( |  | ) |

inline

Get whether the mouse coordinates should be transformed into a pre defined input range.

References _useFixedMouseInputRange.

## keyPress() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::keyPress | ( | int | key,
|  | double | time,
|  | int | unmodifiedKey = 0 )

Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings, with specified time.

## keyPress() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::keyPress | ( | int | key,
|  | int | unmodifiedKey = 0 )

inline

Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings.

References getTime(), and keyPress().

Referenced by keyPress().

## keyRelease() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::keyRelease | ( | int | key,
|  | double | time,
|  | int | unmodifiedKey = 0 )

Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings, with specified time.

## keyRelease() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::keyRelease | ( | int | key,
|  | int | unmodifiedKey = 0 )

inline

Method for adapting keyboard press events. Note, special keys such as Ctrl/Function keys should be adapted to GUIEventAdapter::KeySymbol mappings.

References getTime(), and keyRelease().

Referenced by keyRelease().

## mouseButtonPress() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseButtonPress | ( | float | x,
|  | float | y,
|  | unsigned int | button )

inline

Method for adapting mouse button pressed events, placing this event on the back of the event queue. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

References getTime(), and mouseButtonPress().

Referenced by mouseButtonPress().

## mouseButtonPress() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseButtonPress | ( | float | x,
|  | float | y,
|  | unsigned int | button,
|  | double | time )

Method for adapting mouse button pressed events, placing this event on the back of the event queue, with specified time. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

## mouseButtonRelease() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseButtonRelease | ( | float | x,
|  | float | y,
|  | unsigned int | button )

inline

Method for adapting mouse button release events, placing this event on the back of the event queue. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

References getTime(), and mouseButtonRelease().

Referenced by mouseButtonRelease().

## mouseButtonRelease() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseButtonRelease | ( | float | x,
|  | float | y,
|  | unsigned int | button,
|  | double | time )

Method for adapting mouse button release events, placing this event on the back of the event queue, with specified time. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

## mouseDoubleButtonPress() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseDoubleButtonPress | ( | float | x,
|  | float | y,
|  | unsigned int | button )

inline

Method for adapting mouse button pressed events, placing this event on the back of the event queue. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

References getTime(), and mouseDoubleButtonPress().

Referenced by mouseDoubleButtonPress().

## mouseDoubleButtonPress() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseDoubleButtonPress | ( | float | x,
|  | float | y,
|  | unsigned int | button,
|  | double | time )

Method for adapting mouse button pressed events, placing this event on the back of the event queue, with specified time. Button numbering is 1 for left mouse button, 2 for middle, 3 for right.

## mouseMotion() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseMotion | ( | float | x,
|  | float | y )

inline

Method for adapting mouse motion events, placing this event on the back of the event queue.

References getTime(), and mouseMotion().

Referenced by mouseMotion().

## mouseMotion() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseMotion | ( | float | x,
|  | float | y,
|  | double | time )

Method for adapting mouse motion events, placing this event on the back of the event queue, with specified time.

## mouseScroll() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseScroll | ( | GUIEventAdapter::ScrollingMotion | sm | ) |

inline

Method for adapting mouse scroll wheel events, placing this event on the back of the event queue.

References getTime(), and mouseScroll().

Referenced by mouseScroll().

## mouseScroll() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseScroll | ( | GUIEventAdapter::ScrollingMotion | sm,
|  | double | time )

Method for adapting mouse scroll wheel events, placing this event on the back of the event queue, with specified time.

## mouseScroll2D() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseScroll2D | ( | float | x,
|  | float | y )

inline

Method for adapting mouse scroll wheel events, placing this event on the back of the event queue.

References getTime(), and mouseScroll2D().

Referenced by mouseScroll2D().

## mouseScroll2D() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::mouseScroll2D | ( | float | x,
|  | float | y,
|  | double | time )

Method for adapting mouse scroll wheel events, placing this event on the back of the event queue.

## mouseWarped()

void osgGA::EventQueue::mouseWarped | ( | float | x,
|  | float | y )

Method for updating in response to a mouse warp. Note, just moves the mouse position without creating a new event for it.

## operator=()

EventQueue & osgGA::EventQueue::operator= | ( | const EventQueue & |  | ) |

inline protected

Prevent unwanted copy operator.

References EventQueue().

## penOrientation() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penOrientation | ( | float | tiltX,
|  | float | tiltY,
|  | float | rotation )

inline

Method for adapting pen orientation events, placing this event on the back of the event queue.

References getTime(), and penOrientation().

Referenced by penOrientation().

## penOrientation() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penOrientation | ( | float | tiltX,
|  | float | tiltY,
|  | float | rotation,
|  | double | time )

Method for adapting pen orientation events, placing this event on the back of the event queue, with specified time.

## penPressure() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penPressure | ( | float | pressure | ) |

inline

Method for adapting pen pressure events, placing this event on the back of the event queue.

References getTime(), and penPressure().

Referenced by penPressure().

## penPressure() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penPressure | ( | float | pressure,
|  | double | time )

Method for adapting pen pressure events, placing this event on the back of the event queue, with specified time.

## penProximity() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penProximity | ( | GUIEventAdapter::TabletPointerType | pt,
|  | bool | isEntering )

inline

Method for adapting pen proximity events, placing this event on the back of the event queue.

References getTime(), and penProximity().

Referenced by penProximity().

## penProximity() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::penProximity | ( | GUIEventAdapter::TabletPointerType | pt,
|  | bool | isEntering,
|  | double | time )

Method for adapting pen proximity events, placing this event on the back of the event queue, with specified time.

## quitApplication() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::quitApplication | ( |  | ) |

inline

Method for adapting application quit events.

References getTime(), and quitApplication().

Referenced by quitApplication().

## quitApplication() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::quitApplication | ( | double | time | ) |

Method for adapting application quit events with specified event time.

## setCurrentEventState()

void osgGA::EventQueue::setCurrentEventState | ( | GUIEventAdapter * | ea | ) |

inline

References _accumulateEventState.

## setEvents()

void osgGA::EventQueue::setEvents | ( | Events & | events | ) |

Set events.

## setFirstTouchEmulatesMouse()

void osgGA::EventQueue::setFirstTouchEmulatesMouse | ( | bool | b | ) |

inline

References _firstTouchEmulatesMouse.

## setGraphicsContext()

void osgGA::EventQueue::setGraphicsContext | ( | osg::GraphicsContext * | context | ) |

inline

Set the graphics context associated with this event queue.

References getCurrentEventState().

## setMouseInputRange()

void osgGA::EventQueue::setMouseInputRange | ( | float | xMin,
|  | float | yMin,
|  | float | xMax,
|  | float | yMax )

inline

Set the mouse input range.

References getCurrentEventState().

## setStartTick()

void osgGA::EventQueue::setStartTick | ( | osg::Timer_t | tick | ) |

inline

References _startTick, and clear().

## setUseFixedMouseInputRange()

void osgGA::EventQueue::setUseFixedMouseInputRange | ( | bool | useFixedMouseInputRange | ) |

inline

Specify if mouse coordinates should be transformed into a pre defined input range, or whether they should be simply based on as local coordinates to the window that generated the mouse events.

References _useFixedMouseInputRange.

## syncWindowRectangleWithGraphicsContext()

void osgGA::EventQueue::syncWindowRectangleWithGraphicsContext | ( |  | ) |

Read the window record dimensions from the graphics context.

## takeEvents() [1/2]

bool osgGA::EventQueue::takeEvents | ( | Events & | events | ) |

Take the entire event queue leaving the EventQueue' event queue empty.

## takeEvents() [2/2]

bool osgGA::EventQueue::takeEvents | ( | Events & | events,
|  | double | cutOffTime )

Take the events that were recorded before with specified time queue.

## touchBegan() [1/2]

GUIEventAdapter * osgGA::EventQueue::touchBegan | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y )

inline

References getTime(), and touchBegan().

## touchBegan() [2/2]

GUIEventAdapter * osgGA::EventQueue::touchBegan | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y,
|  | double | time )

Referenced by touchBegan().

## touchEnded() [1/2]

GUIEventAdapter * osgGA::EventQueue::touchEnded | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y,
|  | unsigned int | tap_count )

inline

References getTime(), and touchEnded().

## touchEnded() [2/2]

GUIEventAdapter * osgGA::EventQueue::touchEnded | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y,
|  | unsigned int | tap_count,
|  | double | time )

Referenced by touchEnded().

## touchMoved() [1/2]

GUIEventAdapter * osgGA::EventQueue::touchMoved | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y )

inline

References getTime(), and touchMoved().

## touchMoved() [2/2]

GUIEventAdapter * osgGA::EventQueue::touchMoved | ( | unsigned int | id,
|  | GUIEventAdapter::TouchPhase | phase,
|  | float | x,
|  | float | y,
|  | double | time )

Referenced by touchMoved().

## userEvent() [1/2]

GUIEventAdapter * osgGA::EventQueue::userEvent | ( | osg::Referenced * | userEventData | ) |

inline

Method for adapting user defined events

References getTime(), and userEvent().

Referenced by userEvent().

## userEvent() [2/2]

GUIEventAdapter * osgGA::EventQueue::userEvent | ( | osg::Referenced * | userEventData,
|  | double | time )

Method for adapting user defined events with specified event time

## windowResize() [1/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::windowResize | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height )

inline

Method for adapting window resize event, placing this event on the back of the event queue.

References getTime(), and windowResize().

Referenced by windowResize().

## windowResize() [2/2]

osgGA::GUIEventAdapter * osgGA::EventQueue::windowResize | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height,
|  | double | time )

Method for adapting window resize event, placing this event on the back of the event queue, with specified time.

## Member Data Documentation

## _accumulateEventState

osg::ref_ptr<GUIEventAdapter> osgGA::EventQueue::_accumulateEventState

protected

Referenced by getCurrentEventState(), getCurrentEventState(), and setCurrentEventState().

## _eventQueue

Events osgGA::EventQueue::_eventQueue

protected

Referenced by empty().

## _eventQueueMutex

OpenThreads::Mutex osgGA::EventQueue::_eventQueueMutex

mutable protected

Referenced by empty().

## _firstTouchEmulatesMouse

bool osgGA::EventQueue::_firstTouchEmulatesMouse

protected

Referenced by getFirstTouchEmulatesMouse(), and setFirstTouchEmulatesMouse().

## _startTick

osg::Timer_t osgGA::EventQueue::_startTick

protected

Referenced by getStartTick(), getTime(), and setStartTick().

## _useFixedMouseInputRange

bool osgGA::EventQueue::_useFixedMouseInputRange

protected

Referenced by getUseFixedMouseInputRange(), and setUseFixedMouseInputRange().

The documentation for this class was generated from the following file:

- EventQueue