]> git.tdb.fi Git - libs/gui.git/blob - source/input/hub.h
8d41bcee41393bc0314825db0c44b1fc2b65fc61
[libs/gui.git] / source / input / hub.h
1 #ifndef MSP_INPUT_INPUTHUB_H_
2 #define MSP_INPUT_INPUTHUB_H_
3
4 #include <map>
5 #include "device.h"
6
7 namespace Msp {
8 namespace Input {
9
10 /**
11 The Hub device collects events from multiple input devices and presents an
12 aggregate of them.  Button and axis numbers are mapped to unique values.
13 */
14 class Hub: public Device
15 {
16 protected:
17         std::map<unsigned, Device *> devices;
18
19 public:
20         Hub();
21
22         /// Attaches an input device to the hub.
23         void attach(Device &dev);
24
25         virtual std::string get_button_name(unsigned) const;
26         virtual std::string get_axis_name(unsigned) const;
27 protected:
28         void button_press(unsigned, unsigned);
29         void button_release(unsigned, unsigned);
30         void axis_motion(unsigned, float, float, unsigned);
31 };
32
33 } // namespace Input
34 } // namespace Msp
35
36 #endif