OpenSceneGraph 3.6.5
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
32
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
48
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
71
73 virtual void getUsage(osg::ApplicationUsage&) const {}
74
75protected:
76
77};
78
79}
80
81#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
The 'GA' in osgGA stands for 'GUI Abstraction'; the osgGA namespace provides facilities to help devel...
Definition Callback:21
Definition ApplicationUsage:26
Callback()
Definition Callback:38
Deprecated.
Definition Callback:215
NodeCallback()
Definition Callback:219
virtual NodeCallback * asNodeCallback()
Definition Callback:227
Definition Callback:320
virtual DrawableEventCallback * asDrawableEventCallback()
Definition Callback:330
DrawableEventCallback()
Definition Callback:322
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Pure virtual base class for drawable geometry.
Definition Drawable:89
Base class for all internal nodes in the scene graph.
Definition Node:72
virtual Node * asNode()
Convert 'this' into a Node pointer if Object is a Node, otherwise return 0.
Definition Node:100
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
virtual NodeVisitor * asNodeVisitor()
Convert 'this' into a NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0.
Definition Object:111
Object()
Construct an object.
Definition Object:69
Base Event class.
Definition Event:27
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
Event traversal node callback method.
virtual bool handle(osgGA::Event *event, osg::Object *object, osg::NodeVisitor *nv)
Handle event.
virtual NodeCallback * asNodeCallback()
Definition EventHandler:46
virtual void getUsage(osg::ApplicationUsage &) const
Get the user interface usage of this event handler, i.e.
Definition EventHandler:73
virtual const NodeCallback * asNodeCallback() const
Definition EventHandler:47
virtual void event(osg::NodeVisitor *nv, osg::Drawable *drawable)
Event traversal drawable callback method.
virtual const DrawableEventCallback * asDrawableEventCallback() const
Definition EventHandler:50
virtual bool run(osg::Object *object, osg::Object *data)
NodeCallback overrides the Callback::run() method to adapt it the old style NodeCallback::operator()(...
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)
#define OSGGA_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.