]> git.tdb.fi Git - libs/gui.git/blob - source/binarycontrol.h
Bugfixes
[libs/gui.git] / source / binarycontrol.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_BINARYCONTROL_H_
9 #define MSP_GBASE_BINARYCONTROL_H_
10
11 #include "control.h"
12
13 namespace Msp {
14 namespace Input {
15
16 /**
17 A control with two possible states.  Button state is mapped directly.  An axis
18 is considered to be active when its value is above a threshold (defined by the
19 input device).
20 */
21 class BinaryControl: public Control
22 {
23 public:
24         sigc::signal<void> signal_press;
25         sigc::signal<void> signal_release;
26
27 private:
28         bool state;
29
30 public:
31         BinaryControl();
32         BinaryControl(const ControlSource &);
33         BinaryControl(Device &, ControlSrcType, unsigned);
34         bool get_state() const { return state; }
35
36 private:
37         virtual void on_press();
38         virtual void on_release();
39         virtual void on_motion(float, float);
40 };
41
42 } // namespace Input
43 } // namespace Msp
44
45 #endif