OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ViewerEventHandlers.h
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>
21 #include <osgWidget/WindowManager>
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 
27 namespace osgWidget {
28 
29 // This handles the pressing/moving of mouse buttons, etc.
31 {
32  public:
33 
35 
36  virtual bool handle(
39  osg::Object*,
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 
58  MouseAction _isMouseEvent (osgGA::GUIEventAdapter::EventType) const;
59  bool _doMouseEvent (float, float, MouseEvent);
60 };
61 
62 // This handles the forwarding of keypress events.
64 {
65  public:
66 
68 
69  virtual bool handle(
72  osg::Object*,
74  );
75 
76  protected:
78 
79 };
80 
81 // This class offers a default kind of handling for resizing.
83 {
84  public:
85 
87 
88  virtual bool handle(
91  osg::Object*,
93  );
94 
95  protected:
96 
99 };
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.
104 {
105  public:
106 
108 
109  virtual bool handle(
110  const osgGA::GUIEventAdapter&,
112  osg::Object*,
114  );
115 
116  protected:
117 
121 };
122 
123 }
124 
125 #endif
Definition: Box.h:21
#define OSGWIDGET_EXPORT
Definition: Export.h:42
osg::observer_ptr< WindowManager > _wm
osg::observer_ptr< WindowManager > _wm
osg::observer_ptr< WindowManager > _wm
osg::ref_ptr< osg::Node > _oldNode
osg::observer_ptr< WindowManager > _wm
osg::observer_ptr< osg::Camera > _camera
osg::observer_ptr< osg::Camera > _camera