Added keyboard mouse binding usage to the osg::ApplicationUsage and
osgGA::GUIEventHandler and its subclasses.
This commit is contained in:
@@ -39,6 +39,7 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator
|
||||
|
||||
AnimationPathManipulator( const std::string& filename );
|
||||
|
||||
virtual const char* className() const { return "AnimationPath"; }
|
||||
|
||||
void setAnimationPath( osg::AnimationPath* animationPath ) { _animationPath=animationPath; }
|
||||
|
||||
@@ -53,6 +54,9 @@ class OSGGA_EXPORT AnimationPathManipulator : public CameraManipulator
|
||||
void home(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ class OSGGA_EXPORT DriveManipulator : public CameraManipulator
|
||||
|
||||
virtual ~DriveManipulator();
|
||||
|
||||
virtual const char* className() { return "Drive"; }
|
||||
|
||||
virtual void setNode(osg::Node*);
|
||||
|
||||
virtual const osg::Node* getNode() const;
|
||||
@@ -45,6 +47,9 @@ class OSGGA_EXPORT DriveManipulator : public CameraManipulator
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
protected:
|
||||
|
||||
/** Reset the internal GUIEvent stack.*/
|
||||
|
||||
@@ -32,6 +32,8 @@ class OSGGA_EXPORT FlightManipulator : public CameraManipulator
|
||||
FlightManipulator();
|
||||
virtual ~FlightManipulator();
|
||||
|
||||
virtual const char* className() { return "Flight"; }
|
||||
|
||||
virtual void setNode(osg::Node*);
|
||||
|
||||
virtual const osg::Node* getNode() const;
|
||||
@@ -44,6 +46,9 @@ class OSGGA_EXPORT FlightManipulator : public CameraManipulator
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
enum YawControlMode {
|
||||
YAW_AUTOMATICALLY_WHEN_BANKED,
|
||||
NO_AUTOMATIC_YAW
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <osg/Referenced>
|
||||
#include <osg/ApplicationUsage>
|
||||
|
||||
#include <osgGA/Export>
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
@@ -49,8 +50,7 @@ class OSGGA_EXPORT GUIEventHandler : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
/** Handle events, return true if handled, false otherwise. */
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us)=0;
|
||||
virtual const char* className() { return "GUIEventHandler"; }
|
||||
|
||||
/** Returns 0 if this GUIEventHandler is not a CompositeGUIEventHandler. */
|
||||
virtual const CompositeGUIEventHandler* getComposite() const { return 0; }
|
||||
@@ -58,8 +58,14 @@ public:
|
||||
/** Returns 0 if this GUIEventHandler is not a CompositeGUIEventHandler. */
|
||||
virtual CompositeGUIEventHandler* getComposite() { return 0; }
|
||||
|
||||
/** Handle events, return true if handled, false otherwise. */
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us)=0;
|
||||
|
||||
/** Accept visits from GUIEventHandler visitors */
|
||||
virtual void accept(GUIEventHandlerVisitor&) = 0;
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage&) const {}
|
||||
};
|
||||
|
||||
|
||||
@@ -73,14 +79,20 @@ public:
|
||||
|
||||
typedef std::vector< osg::ref_ptr<GUIEventHandler> > ChildList;
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa);
|
||||
virtual const char* className() { return "CompositeGUIEventHandler"; }
|
||||
|
||||
virtual const CompositeGUIEventHandler* getComposite() const { return this; }
|
||||
|
||||
virtual CompositeGUIEventHandler* getComposite() { return this; }
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa);
|
||||
|
||||
virtual void accept(GUIEventHandlerVisitor& v) { v.visit(*this); }
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
|
||||
// Composite-specific methods below
|
||||
|
||||
virtual bool addChild(GUIEventHandler *geh);
|
||||
|
||||
@@ -34,6 +34,8 @@ class OSGGA_EXPORT KeySwitchCameraManipulator : public CameraManipulator
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* className() { return "KeySwitchCamera"; }
|
||||
|
||||
/**
|
||||
Add a camera manipulator with an associated name, and a key to
|
||||
trigger the switch,
|
||||
@@ -75,6 +77,9 @@ public:
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
private:
|
||||
|
||||
typedef std::pair<std::string, osg::ref_ptr<CameraManipulator> > NamedManipulator;
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
StateSetManipulator();
|
||||
virtual ~StateSetManipulator();
|
||||
|
||||
virtual const char* className() { return "StateSetManipulator"; }
|
||||
|
||||
/** attach a geostate to the manipulator to be used for specifying view.*/
|
||||
virtual void setStateSet(osg::StateSet*);
|
||||
|
||||
@@ -49,6 +51,9 @@ public:
|
||||
/** Handle visitations */
|
||||
virtual void accept(GUIEventHandlerVisitor&);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
protected:
|
||||
|
||||
// Reference pointer to a geostate
|
||||
|
||||
@@ -25,6 +25,8 @@ class OSGGA_EXPORT TrackballManipulator : public CameraManipulator
|
||||
TrackballManipulator();
|
||||
virtual ~TrackballManipulator();
|
||||
|
||||
virtual const char* className() { return "Trackball"; }
|
||||
|
||||
/** Attach a node to the manipulator.
|
||||
Automatically detaches previously attached node.
|
||||
setNode(NULL) detaches previously nodes.
|
||||
@@ -44,10 +46,12 @@ class OSGGA_EXPORT TrackballManipulator : public CameraManipulator
|
||||
/** Start/restart the manipulator.*/
|
||||
virtual void init(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
|
||||
/** handle events, return true if handled, false otherwise.*/
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
protected:
|
||||
|
||||
/** Reset the internal GUIEvent stack.*/
|
||||
|
||||
Reference in New Issue
Block a user