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

@@ -0,0 +1,66 @@
// ***************************************************************************
//
// Generated automatically by genwrapper.
// Please DO NOT EDIT this file!
//
// ***************************************************************************
#include <osgIntrospection/ReflectionMacros>
#include <osgIntrospection/TypedMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/Timer>
#include <osgGA/EventQueue>
#include <osgGA/GUIEventAdapter>
// Must undefine IN and OUT macros defined in Windows headers
#ifdef IN
#undef IN
#endif
#ifdef OUT
#undef OUT
#endif
TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >, osgGA::EventQueue::Events);
BEGIN_OBJECT_REFLECTOR(osgGA::EventQueue)
I_BaseType(osg::Referenced);
I_Constructor0();
I_Method1(void, setEvents, IN, osgGA::EventQueue::Events &, events);
I_Method1(bool, takeEvents, IN, osgGA::EventQueue::Events &, events);
I_Method1(bool, copyEvents, IN, osgGA::EventQueue::Events &, events);
I_Method1(void, appendEvents, IN, osgGA::EventQueue::Events &, events);
I_Method1(void, addEvent, IN, osgGA::GUIEventAdapter *, event);
I_Method4(void, windowResize, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
I_Method1(void, mouseScroll, IN, osgGA::GUIEventAdapter::ScrollingMotion, sm);
I_Method2(void, mouseMotion, IN, float, x, IN, float, y);
I_Method3(void, mouseButtonPress, IN, float, x, IN, float, y, IN, unsigned int, button);
I_Method3(void, mouseButtonRelease, IN, float, x, IN, float, y, IN, unsigned int, button);
I_Method1(void, keyPress, IN, osgGA::GUIEventAdapter::KeySymbol, key);
I_Method1(void, keyRelease, IN, osgGA::GUIEventAdapter::KeySymbol, key);
I_Method1(void, frame, IN, double, t);
I_Method1(void, setStartTick, IN, osg::Timer_t, tick);
I_Method0(osg::Timer_t, getStartTick);
I_Method0(double, getTime);
I_Method0(osgGA::GUIEventAdapter *, getCurrentEventState);
I_Method0(const osgGA::GUIEventAdapter *, getCurrentEventState);
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, CurrentEventState);
I_WriteOnlyProperty(osgGA::EventQueue::Events &, Events);
I_Property(osg::Timer_t, StartTick);
I_ReadOnlyProperty(double, Time);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgGA::GUIEventAdapter >)
I_Constructor0();
I_Constructor1(IN, osgGA::GUIEventAdapter *, t);
I_Constructor1(IN, const osg::ref_ptr< osgGA::GUIEventAdapter > &, rp);
I_Method0(bool, valid);
I_Method0(osgGA::GUIEventAdapter *, get);
I_Method0(const osgGA::GUIEventAdapter *, get);
I_Method0(osgGA::GUIEventAdapter *, take);
I_Method0(osgGA::GUIEventAdapter *, release);
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, );
END_REFLECTOR
STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >);

View File

@@ -19,6 +19,7 @@
#include <osg/Projection>
#include <osg/Switch>
#include <osg/Transform>
#include <osgGA/EventQueue>
#include <osgGA/EventVisitor>
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventAdapter>
@@ -39,13 +40,13 @@ BEGIN_OBJECT_REFLECTOR(osgGA::EventVisitor)
I_Method1(void, setActionAdapter, IN, osgGA::GUIActionAdapter *, actionAdapter);
I_Method0(osgGA::GUIActionAdapter *, getActionAdapter);
I_Method0(const osgGA::GUIActionAdapter *, getActionAdapter);
I_Method1(void, setEventList, IN, const osgGA::EventVisitor::EventList &, events);
I_Method0(osgGA::EventVisitor::EventList &, getEventList);
I_Method0(const osgGA::EventVisitor::EventList &, getEventList);
I_Method1(void, addEvent, IN, osgGA::GUIEventAdapter *, event);
I_Method1(void, removeEvent, IN, osgGA::GUIEventAdapter *, event);
I_Method0(bool, getEventHandled);
I_Method1(void, setEventHandled, IN, bool, handled);
I_Method0(bool, getEventHandled);
I_Method1(void, setEvents, IN, const osgGA::EventQueue::Events &, events);
I_Method0(osgGA::EventQueue::Events &, getEvents);
I_Method0(const osgGA::EventQueue::Events &, getEvents);
I_Method0(void, reset);
I_Method1(void, apply, IN, osg::Node &, node);
I_Method1(void, apply, IN, osg::Geode &, node);
@@ -59,20 +60,6 @@ BEGIN_OBJECT_REFLECTOR(osgGA::EventVisitor)
I_Method1(void, apply, IN, osg::OccluderNode &, node);
I_Property(osgGA::GUIActionAdapter *, ActionAdapter);
I_Property(bool, EventHandled);
I_Property(const osgGA::EventVisitor::EventList &, EventList);
I_Property(const osgGA::EventQueue::Events &, Events);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgGA::GUIEventAdapter >)
I_Constructor0();
I_Constructor1(IN, osgGA::GUIEventAdapter *, t);
I_Constructor1(IN, const osg::ref_ptr< osgGA::GUIEventAdapter > &, rp);
I_Method0(bool, valid);
I_Method0(osgGA::GUIEventAdapter *, get);
I_Method0(const osgGA::GUIEventAdapter *, get);
I_Method0(osgGA::GUIEventAdapter *, take);
I_Method0(osgGA::GUIEventAdapter *, release);
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, );
END_REFLECTOR
STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >);

View File

@@ -4,6 +4,8 @@ include $(TOPDIR)/Make/makedefs
CXXFILES =\
AnimationPathManipulator.cpp\
DriveManipulator.cpp\
Event.cpp\
EventQueue.cpp\
EventVisitor.cpp\
FlightManipulator.cpp\
GUIActionAdapter.cpp\

View File

@@ -36,10 +36,7 @@ BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::EventType)
I_EnumLabel(osgGA::GUIEventAdapter::KEYUP);
I_EnumLabel(osgGA::GUIEventAdapter::FRAME);
I_EnumLabel(osgGA::GUIEventAdapter::RESIZE);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLUP);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLDOWN);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLLEFT);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLRIGHT);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL);
END_REFLECTOR
BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::KeySymbol)
@@ -189,37 +186,64 @@ BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::MouseYOrientation)
I_EnumLabel(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
END_REFLECTOR
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::ScrollingMotion)
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_LEFT);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_RIGHT);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_UP);
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_DOWN);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
I_BaseType(osg::Referenced);
I_Constructor0();
I_Constructor1(IN, const osgGA::GUIEventAdapter &, rhs);
I_Method1(void, setEventType, IN, osgGA::GUIEventAdapter::EventType, Type);
I_Method0(osgGA::GUIEventAdapter::EventType, getEventType);
I_Method0(int, getKey);
I_Method0(int, getButton);
I_Method1(void, setMouseYOrientation, IN, osgGA::GUIEventAdapter::MouseYOrientation, myo);
I_Method0(osgGA::GUIEventAdapter::MouseYOrientation, getMouseYOrientation);
I_Method0(float, getXmin);
I_Method0(float, getXmax);
I_Method0(float, getYmin);
I_Method0(float, getYmax);
I_Method0(float, getX);
I_Method0(float, getY);
I_Method0(unsigned int, getButtonMask);
I_Method0(unsigned int, getModKeyMask);
I_Method1(void, setTime, IN, double, time);
I_Method0(double, getTime);
I_Method0(double, time);
I_Method1(void, setKey, IN, int, key);
I_Method0(int, getKey);
I_Method1(void, setButton, IN, int, button);
I_Method0(int, getButton);
I_Method4(void, setWindowSize, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
I_Method1(void, setXmin, IN, float, x);
I_Method0(float, getXmin);
I_Method1(void, setXmax, IN, float, x);
I_Method0(float, getXmax);
I_Method1(void, setYmin, IN, float, y);
I_Method0(float, getYmin);
I_Method1(void, setYmax, IN, float, y);
I_Method0(float, getYmax);
I_Method1(void, setX, IN, float, x);
I_Method0(float, getX);
I_Method1(void, setY, IN, float, y);
I_Method0(float, getY);
I_Method1(void, setButtonMask, IN, unsigned int, mask);
I_Method0(unsigned int, getButtonMask);
I_Method1(void, setModKeyMask, IN, unsigned int, mask);
I_Method0(unsigned int, getModKeyMask);
I_Method1(void, setScrollingMotion, IN, osgGA::GUIEventAdapter::ScrollingMotion, motion);
I_Method0(osgGA::GUIEventAdapter::ScrollingMotion, getScrollingMotion);
I_Method0(float, getXnormalized);
I_Method0(float, getYnormalized);
I_ReadOnlyProperty(int, Button);
I_ReadOnlyProperty(unsigned int, ButtonMask);
I_ReadOnlyProperty(osgGA::GUIEventAdapter::EventType, EventType);
I_ReadOnlyProperty(int, Key);
I_ReadOnlyProperty(unsigned int, ModKeyMask);
I_Method1(void, setMouseYOrientation, IN, osgGA::GUIEventAdapter::MouseYOrientation, myo);
I_Method0(osgGA::GUIEventAdapter::MouseYOrientation, getMouseYOrientation);
I_Property(int, Button);
I_Property(unsigned int, ButtonMask);
I_Property(osgGA::GUIEventAdapter::EventType, EventType);
I_Property(int, Key);
I_Property(unsigned int, ModKeyMask);
I_Property(osgGA::GUIEventAdapter::MouseYOrientation, MouseYOrientation);
I_ReadOnlyProperty(float, X);
I_ReadOnlyProperty(float, Xmax);
I_ReadOnlyProperty(float, Xmin);
I_Property(osgGA::GUIEventAdapter::ScrollingMotion, ScrollingMotion);
I_Property(double, Time);
I_Property(float, X);
I_Property(float, Xmax);
I_Property(float, Xmin);
I_ReadOnlyProperty(float, Xnormalized);
I_ReadOnlyProperty(float, Y);
I_ReadOnlyProperty(float, Ymax);
I_ReadOnlyProperty(float, Ymin);
I_Property(float, Y);
I_Property(float, Ymax);
I_Property(float, Ymin);
I_ReadOnlyProperty(float, Ynormalized);
END_REFLECTOR