]> git.tdb.fi Git - libs/gui.git/blob - source/inputhub.h
c66ae98d71ce6a132f0600ec420e56f54100c681
[libs/gui.git] / source / inputhub.h
1 /* $Id$
2
3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GBASE_INPUTHUB_H_
9 #define MSP_GBASE_INPUTHUB_H_
10
11 #include "inputdevice.h"
12
13 namespace Msp {
14 namespace Input {
15
16 /**
17 The Hub device collects events from multiple input devices and presents an
18 aggregate of them.  Button and axis numbers are mapped to unique values.
19 */
20 class Hub: public Device
21 {
22 protected:
23         std::vector<Device *> devices;
24
25 public:
26         Hub();
27
28         /**
29         Attaches an input device to the hub.
30
31         @param   dev  Device to attach
32
33         @return  Index of the device within the hub
34         */
35         unsigned attach(Device &dev);
36
37         virtual std::string get_button_name(unsigned) const;
38 protected:
39         void button_press(unsigned, unsigned);
40         void button_release(unsigned, unsigned);
41         void axis_motion(unsigned, float, float, unsigned);
42 };
43
44 } // namespace Input
45 } // namespace Msp
46
47 #endif