iMSTK
Interactive Medical Simulation Toolkit
imstkKeyboardControl.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkDeviceControl.h"
10 #include "imstkMacros.h"
11 
12 namespace imstk
13 {
14 class KeyboardDeviceClient;
15 class KeyEvent;
16 
24 class KeyboardControl : public DeviceControl, public std::enable_shared_from_this<KeyboardControl>
25 {
26 public:
27  KeyboardControl(const std::string& name = "KeyboardControl") : DeviceControl(name) { }
28  ~KeyboardControl() override = default;
29 
30 public:
31  void setDevice(std::shared_ptr<DeviceClient> device) override;
32 
33 public:
34  virtual void OnKeyPress(const char imstkNotUsed(key)) { }
35 
36  virtual void OnKeyRelease(const char imstkNotUsed(key)) { }
37 
41  virtual void keyPressEvent(KeyEvent* e);
42 
46  virtual void keyReleaseEvent(KeyEvent* e);
47 };
48 } // namespace imstk
While the DeviceClient provides quantities from the device, the control defines what to do with those...
Compound Geometry.
virtual void keyReleaseEvent(KeyEvent *e)
Recieves key release event.
Provides the information of a key event (press, release, & which key)
virtual void keyPressEvent(KeyEvent *e)
Recieves key press event.