2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-05-09 18:31:03 +08:00
|
|
|
#ifndef OSGGA_GUIEVENTHANDLERVISITOR
|
|
|
|
#define OSGGA_GUIEVENTHANDLERVISITOR 1
|
|
|
|
|
|
|
|
#include <osgGA/Export>
|
|
|
|
#include <osgGA/GUIEventAdapter>
|
2002-05-30 03:34:01 +08:00
|
|
|
#include <osg/ref_ptr>
|
2002-05-09 18:31:03 +08:00
|
|
|
|
|
|
|
namespace osgGA{
|
|
|
|
|
|
|
|
// Some forward declarations
|
|
|
|
class GUIActionAdapter;
|
2002-07-17 18:00:50 +08:00
|
|
|
class GUIEventHandler;
|
2002-05-09 18:31:03 +08:00
|
|
|
class CompositeGUIEventHandler;
|
2003-05-19 23:15:17 +08:00
|
|
|
class MatrixManipulator;
|
2002-05-09 18:31:03 +08:00
|
|
|
class StateSetManipulator;
|
|
|
|
|
2002-08-28 22:27:18 +08:00
|
|
|
/**
|
|
|
|
Base class for visiting GUIEventHandlers.
|
2002-05-09 18:31:03 +08:00
|
|
|
|
|
|
|
A Default Visitor, (Might want to make it an Extrinsic Visitor at some point).
|
|
|
|
By default, it does nothing to the things it visits. Sub classes of this Visitor
|
|
|
|
need only override visit operations for the types of object they're interested in.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class OSGGA_EXPORT GUIEventHandlerVisitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2002-07-17 18:00:50 +08:00
|
|
|
virtual void visit(GUIEventHandler&) {}
|
2002-05-09 18:31:03 +08:00
|
|
|
virtual void visit(CompositeGUIEventHandler&);
|
2003-05-19 23:15:17 +08:00
|
|
|
virtual void visit(MatrixManipulator&) {};
|
2002-05-09 18:31:03 +08:00
|
|
|
virtual void visit(StateSetManipulator&) {};
|
|
|
|
|
|
|
|
// Accessors
|
|
|
|
|
|
|
|
/** Get the GUI EventAdapter associated with this GUIEventHandlerVisitor */
|
|
|
|
const GUIEventAdapter *getGUIEventAdapter() { return _gea.get(); }
|
|
|
|
|
|
|
|
/** Get the GUI Action Adapter associated with this GEH Visitor */
|
|
|
|
GUIActionAdapter *getGUIActionAdapter() { return _gaa; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
GUIEventHandlerVisitor(GUIEventAdapter* in, GUIActionAdapter* out):_gea(in),_gaa(out) {}
|
|
|
|
virtual ~GUIEventHandlerVisitor() {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
osg::ref_ptr<GUIEventAdapter> _gea;
|
|
|
|
GUIActionAdapter* _gaa; // Just a pointer. NOT owned by this object.
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-07-12 17:50:45 +08:00
|
|
|
}
|
2002-05-09 18:31:03 +08:00
|
|
|
|
|
|
|
#endif
|