Converted osgGA::GUIEventAdapter into a concrete class capable of respresenting

keyboard and mouse events.

Added osgGA::EventQueue class to support a thread safe event queue and adaption
of keyboard and mouse events.

Removed osgProducer::EventAdapter as GUIEventAdapter replaces it.

Adapted osgProducer and examples to work with the new changes to osgGA.
This commit is contained in:
Robert Osfield
2006-03-08 14:09:47 +00:00
parent 582967286a
commit dbbabf87c6
37 changed files with 450 additions and 835 deletions

View File

@@ -27,8 +27,7 @@
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>
#include <list>
#include <osgGA/EventQueue>
namespace osgGA {
@@ -54,45 +53,19 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor
typedef std::list< osg::ref_ptr<GUIEventAdapter> > EventList;
void setEventList(const EventList& events) { _events = events; }
EventList& getEventList() { return _events; }
const EventList& getEventList() const { return _events; }
void addEvent(GUIEventAdapter* event);
void removeEvent(GUIEventAdapter* event);
void setEventHandled(bool handled) { _handled = handled; }
bool getEventHandled() const { return _handled; }
void setEvents(const EventQueue::Events& events) { _events = events; }
EventQueue::Events& getEvents() { return _events; }
const EventQueue::Events& getEvents() const { return _events; }
public:
/** method for adapting resize events. */
void eventResize(float Xmin, float Ymin, float Xmax, float Ymax);
/** method for adapting mouse scroll wheel events. */
void eventMouseScroll(GUIEventAdapter::ScrollingMotion sm);
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
void adaptMouseMotion(float x, float y);
void adaptButtonPress(float x, float y, unsigned int button);
void adaptButtonRelease(float x, float y, unsigned int button);
/** method for adapting keyboard events.*/
void adaptKeyPress( GUIEventAdapter::KeySymbol key);
void adaptKeyRelease( GUIEventAdapter::KeySymbol key);
/** method for adapting frame events, i.e. idle/display callback.*/
void adaptFrame(double t);
public:
virtual void reset();
/** During traversal each type of node calls its callbacks and its children traversed. */
@@ -113,9 +86,6 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor
protected:
// /** Prevent unwanted copy construction.*/
// EventVisitor(const EventVisitor&):osg::NodeVisitor() {}
/** Prevent unwanted copy operator.*/
EventVisitor& operator = (const EventVisitor&) { return *this; }
@@ -164,8 +134,8 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor
osg::ref_ptr<GUIEventAdapter> _accumulateEventState;
EventList _events;
bool _handled;
EventQueue::Events _events;
};