OpenSceneGraph 3.6.5
KeyEventHandler
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2018 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 KEYEVENTHANDLER
15#define KEYEVENTHANDLER 1
16
17#include <osg/StateSet>
18#include <osg/Point>
19
20#include <osgGA/GUIEventHandler>
21
23
24namespace osgPresentation
25{
26
28{
29 public:
30
31 KeyEventHandler(int key, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
32 KeyEventHandler(int key, const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
33 KeyEventHandler(int key, const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData=JumpData());
34
35 void setKey(int key) { _key = key; }
36 int getKey() const { return _key; }
37
38 void setOperation(osgPresentation::Operation operation) { _operation = operation; }
40
41 void setCommand(const std::string& str) { _command = str; }
42 const std::string& getCommand() const { return _command; }
43
44 void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
46
47 void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
48 const JumpData& getJumpData() const { return _jumpData; }
49
51
52 virtual void getUsage(osg::ApplicationUsage& usage) const;
53
55
56 int _key;
57
58 std::string _command;
61
63};
64
65}
66
67#endif
The osgPresentation library is a NodeKit that extends the core scene graph to support 3D scene graph ...
Definition AnimationMaterial:26
Operation
Operations related to click to run/load/key events.
Definition SlideEventHandler:36
Definition ApplicationUsage:26
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
Definition GUIActionAdapter:62
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
GUIEventHandler provides a basic interface for any class which wants to handle a GUI Events.
Definition GUIEventHandler:50
osgPresentation::Operation _operation
Definition KeyEventHandler:60
const std::string & getCommand() const
Definition KeyEventHandler:42
KeyEventHandler(int key, const std::string &str, osgPresentation::Operation operation, const JumpData &jumpData=JumpData())
JumpData _jumpData
Definition KeyEventHandler:62
osgPresentation::KeyPosition _keyPos
Definition KeyEventHandler:59
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *object, osg::NodeVisitor *nv)
Handle events, return true if handled, false otherwise.
void setCommand(const std::string &str)
Definition KeyEventHandler:41
const osgPresentation::KeyPosition & getKeyPosition() const
Definition KeyEventHandler:45
void setOperation(osgPresentation::Operation operation)
Definition KeyEventHandler:38
void setKey(int key)
Definition KeyEventHandler:35
int _key
Definition KeyEventHandler:56
void setJumpData(const JumpData &jumpData)
Definition KeyEventHandler:47
KeyEventHandler(int key, const osgPresentation::KeyPosition &keyPos, const JumpData &jumpData=JumpData())
int getKey() const
Definition KeyEventHandler:36
std::string _command
Definition KeyEventHandler:58
osgPresentation::Operation getOperation() const
Definition KeyEventHandler:39
KeyEventHandler(int key, osgPresentation::Operation operation, const JumpData &jumpData=JumpData())
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the user interface usage of this event handler, i.e.
const JumpData & getJumpData() const
Definition KeyEventHandler:48
void setKeyPosition(const osgPresentation::KeyPosition &keyPos)
Definition KeyEventHandler:44
Definition SlideEventHandler:46
Definition SlideEventHandler:161
#define OSGPRESENTATION_EXPORT
Definition Export:38

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