]> git.tdb.fi Git - libs/gui.git/blob - source/inputhub.h
Add input hub
[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         /**
27         Attaches an input device to the hub.
28
29         @param   dev  Device to attach
30
31         @return  Index of the device within the hub
32         */
33         unsigned attach(Device &dev);
34 protected:
35         void button_press(unsigned, unsigned);
36         void button_release(unsigned, unsigned);
37         void axis_motion(unsigned, float, float, unsigned);
38 };
39
40 } // namespace Input
41 } // namespace Msp
42
43 #endif