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

View File

@@ -1,64 +0,0 @@
// ***************************************************************************
//
// Generated automatically by genwrapper.
// Please DO NOT EDIT this file!
//
// ***************************************************************************
#include <osgIntrospection/ReflectionMacros>
#include <osgIntrospection/TypedMethodInfo>
#include <osgIntrospection/Attributes>
#include <osgGA/GUIEventAdapter>
#include <osgProducer/EventAdapter>
// Must undefine IN and OUT macros defined in Windows headers
#ifdef IN
#undef IN
#endif
#ifdef OUT
#undef OUT
#endif
BEGIN_OBJECT_REFLECTOR(osgProducer::EventAdapter)
I_BaseType(osgGA::GUIEventAdapter);
I_Constructor0();
I_Method0(osgGA::GUIEventAdapter::EventType, getEventType);
I_Method1(void, setKey, IN, int, key);
I_Method0(int, getKey);
I_Method0(int, getButton);
I_Method0(float, getXmin);
I_Method0(float, getXmax);
I_Method0(float, getYmin);
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, setButtonMak, IN, unsigned int, mask);
I_Method0(unsigned int, getButtonMask);
I_Method0(double, time);
I_Method0(unsigned int, getModKeyMask);
I_Method5(void, adaptResize, IN, double, t, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
I_Method2(void, adaptMouseScroll, IN, double, t, IN, Producer::KeyboardMouseCallback::ScrollingMotion, sm);
I_Method3(void, adaptMouseMotion, IN, double, t, IN, float, x, IN, float, y);
I_Method4(void, adaptButtonPress, IN, double, t, IN, float, x, IN, float, y, IN, unsigned int, button);
I_Method4(void, adaptButtonRelease, IN, double, t, IN, float, x, IN, float, y, IN, unsigned int, button);
I_Method2(void, adaptKeyPress, IN, double, t, IN, Producer::KeySymbol, key);
I_Method2(void, adaptKeyRelease, IN, double, t, IN, Producer::KeySymbol, key);
I_Method1(void, adaptFrame, IN, double, t);
I_Method0(void, copyStaticVariables);
I_ReadOnlyProperty(int, Button);
I_WriteOnlyProperty(unsigned int, ButtonMak);
I_ReadOnlyProperty(unsigned int, ButtonMask);
I_ReadOnlyProperty(osgGA::GUIEventAdapter::EventType, EventType);
I_Property(int, Key);
I_ReadOnlyProperty(unsigned int, ModKeyMask);
I_Property(float, X);
I_ReadOnlyProperty(float, Xmax);
I_ReadOnlyProperty(float, Xmin);
I_Property(float, Y);
I_ReadOnlyProperty(float, Ymax);
I_ReadOnlyProperty(float, Ymin);
END_REFLECTOR

View File

@@ -2,7 +2,7 @@ TOPDIR = ../../..
include $(TOPDIR)/Make/makedefs
CXXFILES =\
EventAdapter.cpp\
Export.cpp\
GraphicsContextImplementation.cpp\
KeyboardMouseCallback.cpp\
OsgCameraGroup.cpp\

View File

@@ -9,8 +9,8 @@
#include <osgIntrospection/TypedMethodInfo>
#include <osgIntrospection/Attributes>
#include <osg/Timer>
#include <osgProducer/EventAdapter>
#include <osgGA/EventQueue>
#include <osgGA/GUIEventAdapter>
#include <osgProducer/KeyboardMouseCallback>
// Must undefine IN and OUT macros defined in Windows headers
@@ -21,7 +21,7 @@
#undef OUT
#endif
TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgProducer::EventAdapter > >, osgProducer::KeyboardMouseCallback::EventQueue);
TYPE_NAME_ALIAS(osgGA::EventQueue::Events, osgProducer::KeyboardMouseCallback::EventQueue);
BEGIN_OBJECT_REFLECTOR(osgProducer::KeyboardMouseCallback)
I_ConstructorWithDefaults3(IN, Producer::KeyboardMouse *, keyboardMouse, , IN, bool &, done, , IN, bool, escapeKeySetsDone, true);
@@ -40,38 +40,20 @@ BEGIN_OBJECT_REFLECTOR(osgProducer::KeyboardMouseCallback)
I_Method0(void, shutdown);
I_Method1(void, setEscapeSetDone, IN, bool, esc);
I_Method0(bool, getEscapeSetDone);
I_Method1(double, getEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(double, copyEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(double, setEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(double, appendEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method0(osgGA::EventQueue *, getEventQueue);
I_Method1(bool, takeEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(bool, copyEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(void, setEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method1(void, appendEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
I_Method0(bool, done);
I_Method0(float, mx);
I_Method0(float, my);
I_Method0(unsigned int, mbutton);
I_Method1(void, setStartTick, IN, osg::Timer_t, tick);
I_Method0(osg::Timer_t, getStartTick);
I_Method0(double, getTime);
I_Method0(Producer::KeyboardMouse *, getKeyboardMouse);
I_Method0(const Producer::KeyboardMouse *, getKeyboardMouse);
I_Method0(osgProducer::EventAdapter *, createEventAdapter);
I_Method0(osgGA::GUIEventAdapter *, createEventAdapter);
I_Method0(void, updateWindowSize);
I_Property(bool, EscapeSetDone);
I_WriteOnlyPropertyWithReturnType(osgProducer::KeyboardMouseCallback::EventQueue &, EventQueue, double);
I_ReadOnlyProperty(osgGA::EventQueue *, EventQueue);
I_ReadOnlyProperty(Producer::KeyboardMouse *, KeyboardMouse);
I_Property(osg::Timer_t, StartTick);
I_ReadOnlyProperty(double, Time);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgProducer::EventAdapter >)
I_Constructor0();
I_Constructor1(IN, osgProducer::EventAdapter *, t);
I_Constructor1(IN, const osg::ref_ptr< osgProducer::EventAdapter > &, rp);
I_Method0(bool, valid);
I_Method0(osgProducer::EventAdapter *, get);
I_Method0(const osgProducer::EventAdapter *, get);
I_Method0(osgProducer::EventAdapter *, take);
I_Method0(osgProducer::EventAdapter *, release);
I_ReadOnlyProperty(osgProducer::EventAdapter *, );
END_REFLECTOR
STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgProducer::EventAdapter > >);