opensurgsim
MouseScaffold.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_MOUSE_MOUSESCAFFOLD_H
17 #define SURGSIM_DEVICES_MOUSE_MOUSESCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/Logger.h"
22 
23 namespace SurgSim
24 {
25 
26 namespace DataStructures
27 {
28 class DataGroup;
29 }
30 
31 namespace Devices
32 {
33 class MouseDevice;
34 class OsgMouseHandler;
35 
39 {
40  friend class MouseDevice;
41  friend class MouseDeviceTest;
42  friend class OsgMouseHandler;
43 
44 public:
46  MouseScaffold();
47 
49  ~MouseScaffold();
50 
54  static std::shared_ptr<MouseScaffold> getOrCreateSharedInstance();
55 
56 private:
58  struct DeviceData;
59 
64  bool registerDevice(MouseDevice* device);
68  bool unregisterDevice();
69 
77  bool updateDevice(int buttons, float x, float y, int scrollDeltaX, int scrollDeltaY);
78 
81  OsgMouseHandler* getMouseHandler() const;
82 
84  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
85 
86 
88  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
90  std::unique_ptr<DeviceData> m_device;
91 };
92 
93 }; // namespace Devices
94 }; // namespace SurgSim
95 
96 #endif // SURGSIM_DEVICES_MOUSE_MOUSESCAFFOLD_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Definition: OsgMouseHandler.h:30
A class implementing the communication with a mouse.
Definition: MouseDevice.h:52
A collection of NamedData objects.
Definition: DataGroup.h:68
A class that implements the behavior of MouseDevice objects.
Definition: MouseScaffold.h:38
Definition: MouseDeviceTest.cpp:35
Struct to hold a MouseDevice object, a OsgMouseHandler, and a mutex for data passing.
Definition: MouseScaffold.cpp:34