EventHandler
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* 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.
*/
#ifndef OSGGA_EVENTHANDLER
#define OSGGA_EVENTHANDLER 1
#include <vector>
#include <osg/Drawable>
#include <osg/ApplicationUsage>
#include <osgGA/Export>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>
namespace osgGA{
class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::DrawableEventCallback
{
public:
EventHandler() {}
EventHandler(const EventHandler& eh,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
osg::Object(eh, copyop),
osg::Callback(eh, copyop),
osg::NodeCallback(eh, copyop),
osg::DrawableEventCallback(eh, copyop) {}
META_Object(osgGA, EventHandler);
virtual NodeCallback* asNodeCallback() { return osg::NodeCallback::asNodeCallback(); }
virtual const NodeCallback* asNodeCallback() const { return osg::NodeCallback::asNodeCallback(); }
virtual DrawableEventCallback* asDrawableEventCallback() { return osg::DrawableEventCallback::asDrawableEventCallback(); }
virtual const DrawableEventCallback* asDrawableEventCallback() const { return osg::DrawableEventCallback::asDrawableEventCallback(); }
virtual EventHandler* asEventHandler() { return this; }
virtual const EventHandler* asEventHandler() const { return this; }
virtual bool run(osg::Object* object, osg::Object* data)
{
osg::Node* node = object->asNode();
osg::NodeVisitor* nv = data->asNodeVisitor();
operator()(node, nv);
return true;
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable);
virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv);
virtual void getUsage(osg::ApplicationUsage&) const {}
protected:
};
}
#endif
ApplicationUsage
Drawable
GUIActionAdapter
GUIEventAdapter
osgGA::EventHandler::operator()
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
osgGA::EventHandler::handle
virtual bool handle(osgGA::Event *event, osg::Object *object, osg::NodeVisitor *nv)
osgGA::EventHandler::asNodeCallback
virtual NodeCallback * asNodeCallback()
Definition EventHandler:46
osgGA::EventHandler::getUsage
virtual void getUsage(osg::ApplicationUsage &) const
Definition EventHandler:73
osgGA::EventHandler::asNodeCallback
virtual const NodeCallback * asNodeCallback() const
Definition EventHandler:47
osgGA::EventHandler::event
virtual void event(osg::NodeVisitor *nv, osg::Drawable *drawable)
osgGA::EventHandler::asDrawableEventCallback
virtual const DrawableEventCallback * asDrawableEventCallback() const
Definition EventHandler:50
osgGA::EventHandler::run
virtual bool run(osg::Object *object, osg::Object *data)
Definition EventHandler:55
osgGA::EventHandler::EventHandler
EventHandler()
Definition EventHandler:37
osgGA::EventHandler::asDrawableEventCallback
virtual DrawableEventCallback * asDrawableEventCallback()
Definition EventHandler:49
osgGA::EventHandler::asEventHandler
virtual const EventHandler * asEventHandler() const
Definition EventHandler:53
osgGA::EventHandler::EventHandler
EventHandler(const EventHandler &eh, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition EventHandler:38
osgGA::EventHandler::asEventHandler
virtual EventHandler * asEventHandler()
Definition EventHandler:52
osgGA::EventHandler::META_Object
META_Object(osgGA, EventHandler)
osgGA::Event
Definition Event:27
osg::ApplicationUsage
Definition ApplicationUsage:26
osg::Callback::Callback
Callback()
Definition Callback:38
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::DrawableEventCallback
Definition Callback:320
osg::DrawableEventCallback::asDrawableEventCallback
virtual DrawableEventCallback * asDrawableEventCallback()
Definition Callback:330
osg::DrawableEventCallback::DrawableEventCallback
DrawableEventCallback()
Definition Callback:322
osg::Drawable
Definition Drawable:89
osg::NodeCallback
Definition Callback:215
osg::NodeCallback::NodeCallback
NodeCallback()
Definition Callback:219
osg::NodeCallback::asNodeCallback
virtual NodeCallback * asNodeCallback()
Definition Callback:227
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node
Definition Node:72
osg::Node::asNode
virtual Node * asNode()
Definition Node:100
osg::Object
Definition Object:61
osg::Object::asNodeVisitor
virtual NodeVisitor * asNodeVisitor()
Definition Object:111
osg::Object::Object
Object()
Definition Object:69
osgGA
Definition Callback:21
osg
Definition AlphaFunc:19
Export
OSGGA_EXPORT
#define OSGGA_EXPORT
Definition osgGA/Export:40