openscenegraph
EventHandler
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGGA_EVENTHANDLER
15#define OSGGA_EVENTHANDLER 1
16
17#include <vector>
18
19#include <osg/Drawable>
20#include <osg/ApplicationUsage>
21
22#include <osgGA/Export>
23#include <osgGA/GUIEventAdapter>
25
26
27namespace osgGA{
28
34{
35public:
36
39 osg::Object(eh, copyop),
40 osg::Callback(eh, copyop),
41 osg::NodeCallback(eh, copyop),
42 osg::DrawableEventCallback(eh, copyop) {}
43
45
46 virtual NodeCallback* asNodeCallback() { return osg::NodeCallback::asNodeCallback(); }
47 virtual const NodeCallback* asNodeCallback() const { return osg::NodeCallback::asNodeCallback(); }
48
50 virtual const DrawableEventCallback* asDrawableEventCallback() const { return osg::DrawableEventCallback::asDrawableEventCallback(); }
51
52 virtual EventHandler* asEventHandler() { return this; }
53 virtual const EventHandler* asEventHandler() const { return this; }
54
55 virtual bool run(osg::Object* object, osg::Object* data)
56 {
57 osg::Node* node = object->asNode();
58 osg::NodeVisitor* nv = data->asNodeVisitor();
59 operator()(node, nv);
60 return true;
61 }
62
64 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
65
67 virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable);
68
70 virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv);
71
73 virtual void getUsage(osg::ApplicationUsage&) const {}
74
75protected:
76
77};
78
79}
80
81#endif
Definition EventHandler:34
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
virtual bool handle(osgGA::Event *event, osg::Object *object, osg::NodeVisitor *nv)
virtual NodeCallback * asNodeCallback()
Definition EventHandler:46
virtual void getUsage(osg::ApplicationUsage &) const
Definition EventHandler:73
virtual const NodeCallback * asNodeCallback() const
Definition EventHandler:47
virtual void event(osg::NodeVisitor *nv, osg::Drawable *drawable)
virtual const DrawableEventCallback * asDrawableEventCallback() const
Definition EventHandler:50
virtual bool run(osg::Object *object, osg::Object *data)
Definition EventHandler:55
EventHandler()
Definition EventHandler:37
virtual DrawableEventCallback * asDrawableEventCallback()
Definition EventHandler:49
virtual const EventHandler * asEventHandler() const
Definition EventHandler:53
EventHandler(const EventHandler &eh, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition EventHandler:38
virtual EventHandler * asEventHandler()
Definition EventHandler:52
META_Object(osgGA, EventHandler)
Definition Event:27
Definition ApplicationUsage:26
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Callback:320
virtual DrawableEventCallback * asDrawableEventCallback()
Definition Callback:330
Definition Drawable:89
Definition Callback:215
virtual NodeCallback * asNodeCallback()
Definition Callback:227
Definition NodeVisitor:82
Definition Node:72
virtual Node * asNode()
Definition Node:100
Definition Object:61
virtual NodeVisitor * asNodeVisitor()
Definition Object:111
Definition Callback:21
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSGGA_EXPORT
Definition osgGA/Export:40