Introduced event handling directly into osgManipulator::Dragger to allow it be used with a global event handler passing in events.

This commit is contained in:
Robert Osfield
2009-06-29 21:32:10 +00:00
parent 8aaedda982
commit e30e4df30c
8 changed files with 140 additions and 20 deletions

View File

@@ -45,7 +45,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const AntiSquish *>(obj)!=NULL; }
void setPivot(const osg::Vec3d& pvt)
{
{
_pivot = pvt;
_usePivot = true;
_dirty = true;
@@ -54,7 +54,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
const osg::Vec3d& getPivot() { return _pivot; }
void setPosition(const osg::Vec3d& pos)
{
{
_position = pos;
_usePosition = true;
_dirty = true;

View File

@@ -69,8 +69,11 @@ class OSGMANIPULATOR_EXPORT GridConstraint : public Constraint
GridConstraint(osg::Node& refNode, const osg::Vec3d& origin, const osg::Vec3d& spacing);
void setOrigin(const osg::Vec3d origin) { _origin = origin; }
void setSpacing(const osg::Vec3d spacing) { _spacing = spacing; }
void setOrigin(const osg::Vec3d& origin) { _origin = origin; }
const osg::Vec3d& getOrigin() const { return _origin; }
void setSpacing(const osg::Vec3d& spacing) { _spacing = spacing; }
const osg::Vec3d& getSpacing() const { return _spacing; }
virtual bool constrain(TranslateInLineCommand& command) const;
virtual bool constrain(TranslateInPlaneCommand& command) const;

View File

@@ -166,6 +166,16 @@ class OSGMANIPULATOR_EXPORT Dragger : public Selection
virtual CompositeDragger* getComposite() { return 0; }
void setHandleEvents(bool flag);
bool getHandleEvents() const { return _handleEvents; }
void setDraggerActive(bool active) { _draggerActive = active; }
bool getDraggerActive() const { return _draggerActive; }
virtual void traverse(osg::NodeVisitor& nv);
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
virtual bool handle(const PointerInfo&, const osgGA::GUIEventAdapter&, osgGA::GUIActionAdapter&) { return false; }
protected:
@@ -173,9 +183,13 @@ class OSGMANIPULATOR_EXPORT Dragger : public Selection
Dragger();
virtual ~Dragger();
CommandManager* _commandManager;
bool _handleEvents;
bool _draggerActive;
osgManipulator::PointerInfo _pointer;
Dragger* _parentDragger;
CommandManager* _commandManager;
Dragger* _parentDragger;
};

View File

@@ -36,15 +36,6 @@
# define OSGPRESENTATION_EXPORT
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/**