]> git.tdb.fi Git - libs/gui.git/blob - source/input/hub.h
Add decorations for things which should be exported from the library
[libs/gui.git] / source / input / hub.h
1 #ifndef MSP_INPUT_INPUTHUB_H_
2 #define MSP_INPUT_INPUTHUB_H_
3
4 #include <vector>
5 #include <sigc++/trackable.h>
6 #include <msp/graphics/mspgui_api.h>
7 #include "device.h"
8
9 namespace Msp {
10 namespace Input {
11
12 /**
13 The Hub device collects events from multiple input devices and presents an
14 aggregate of them.  Button and axis numbers are mapped to unique values.
15 */
16 class MSPGUI_API Hub: public Device, public sigc::trackable
17 {
18 protected:
19         std::vector<Device *> devices;
20
21 public:
22         Hub();
23
24         /// Attaches an input device to the hub.
25         void attach(Device &dev);
26
27         Device *find_subdevice(DeviceType, unsigned = 0) override;
28         Device *find_subdevice(const std::string &) override;
29
30         std::string get_button_name(unsigned) const override;
31         std::string get_axis_name(unsigned) const override;
32 protected:
33         void button_press(unsigned, unsigned);
34         void button_release(unsigned, unsigned);
35         void axis_motion(unsigned, float, float, unsigned);
36 };
37
38 } // namespace Input
39 } // namespace Msp
40
41 #endif