]> git.tdb.fi Git - libs/gui.git/blob - source/input/hub.h
Comment changes
[libs/gui.git] / source / input / hub.h
1 #ifndef MSP_GBASE_INPUTHUB_H_
2 #define MSP_GBASE_INPUTHUB_H_
3
4 #include "device.h"
5
6 namespace Msp {
7 namespace Input {
8
9 /**
10 The Hub device collects events from multiple input devices and presents an
11 aggregate of them.  Button and axis numbers are mapped to unique values.
12 */
13 class Hub: public Device
14 {
15 protected:
16         std::vector<Device *> devices;
17
18 public:
19         Hub();
20
21         /** Attaches an input device to the hub.  Returns the index of the device
22         within the hub. */
23         unsigned 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