openscenegraph
osgWidget/ViewerEventHandlers
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 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// Code by: Jeremy Moles (cubicool) 2007-2008
15
16#ifndef OSGWIDGET_VIEWER_EVENT_HANDLERS
17#define OSGWIDGET_VIEWER_EVENT_HANDLERS
18
19#include <osgGA/GUIEventAdapter>
20#include <osgGA/GUIEventHandler>
22
23// NOTE! These are all just examples of some default event handlers--they are not
24// required. You are more than welcome to provide your own even handlers that
25// communicate with a WindowManager using it's public API.
26
27namespace osgWidget {
28
29// This handles the pressing/moving of mouse buttons, etc.
31{
32 public:
33
35
36 virtual bool handle(
41 );
42
43
44 typedef bool (MouseHandler::*MouseAction)(float, float, int);
45 typedef bool (WindowManager::*MouseEvent)(float, float);
46
47 protected:
48
50
51 bool _handleMousePush (float, float, int);
52 bool _handleMouseRelease (float, float, int);
53 bool _handleMouseDoubleClick (float, float, int);
54 bool _handleMouseDrag (float, float, int);
55 bool _handleMouseMove (float, float, int);
56 bool _handleMouseScroll (float, float, int);
57
59 bool _doMouseEvent (float, float, MouseEvent);
60};
61
62// This handles the forwarding of keypress events.
80
81// This class offers a default kind of handling for resizing.
100
101// This class provides a hotkey that lets you toggle back and forth between
102// a camera and setting the CameraManipulator's home point.
122
123}
124
125#endif
Definition GUIActionAdapter:62
Definition GUIEventAdapter:82
EventType
Definition GUIEventAdapter:91
Definition GUIEventHandler:50
Definition osgWidget/ViewerEventHandlers:104
virtual bool handle(const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &, osg::Object *, osg::NodeVisitor *)
osg::ref_ptr< osg::Node > _oldNode
Definition osgWidget/ViewerEventHandlers:120
CameraSwitchHandler(WindowManager *, osg::Camera *)
osg::observer_ptr< WindowManager > _wm
Definition osgWidget/ViewerEventHandlers:118
osg::observer_ptr< osg::Camera > _camera
Definition osgWidget/ViewerEventHandlers:119
Definition osgWidget/ViewerEventHandlers:64
osg::observer_ptr< WindowManager > _wm
Definition osgWidget/ViewerEventHandlers:77
KeyboardHandler(WindowManager *)
virtual bool handle(const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &, osg::Object *, osg::NodeVisitor *)
Definition osgWidget/ViewerEventHandlers:31
MouseAction _isMouseEvent(osgGA::GUIEventAdapter::EventType) const
bool _handleMouseMove(float, float, int)
bool _handleMouseScroll(float, float, int)
virtual bool handle(const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &, osg::Object *, osg::NodeVisitor *)
bool _handleMouseDoubleClick(float, float, int)
bool _doMouseEvent(float, float, MouseEvent)
bool _handleMousePush(float, float, int)
MouseHandler(WindowManager *)
bool _handleMouseDrag(float, float, int)
osg::observer_ptr< WindowManager > _wm
Definition osgWidget/ViewerEventHandlers:49
bool _handleMouseRelease(float, float, int)
Definition osgWidget/ViewerEventHandlers:83
virtual bool handle(const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &, osg::Object *, osg::NodeVisitor *)
ResizeHandler(WindowManager *, osg::Camera *=0)
osg::observer_ptr< osg::Camera > _camera
Definition osgWidget/ViewerEventHandlers:98
osg::observer_ptr< WindowManager > _wm
Definition osgWidget/ViewerEventHandlers:97
Definition WindowManager:39
Definition Camera:45
Definition NodeVisitor:82
Definition Object:61
Definition observer_ptr:39
Definition ref_ptr:32
Definition Box:21
#define OSGWIDGET_EXPORT
Definition osgWidget/Export:42