3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GBASE_CONTROL_H_
9 #define MSP_GBASE_CONTROL_H_
11 #include <sigc++/signal.h>
12 #include <sigc++/trackable.h>
28 Specifies the source of a control. This provides a way for setting sources for
29 different types of controls in a uniform way.
38 ControlSource(Device &, ControlSrcType, unsigned);
39 std::string str() const;
43 Provides further abstraction on top of input devices. There are two types of
44 controls currently defined: BinaryControl and SmoothControl.
46 A control uses either a button or half of an axis (positive or negative) as its
47 source. How the source values are interpreted depends on the exact type of the
48 control. Controls also support interactive binding by capturing a button press
51 class Control: public sigc::trackable
54 sigc::signal<void> signal_capture_complete;
61 Control(const ControlSource &);
62 Control(Device &, ControlSrcType, unsigned);
63 Control(const Control &);
65 Control &operator=(const Control &);
66 virtual ~Control() { }
68 void capture(Device &);
69 void cancel_capture();
70 const ControlSource &get_source() const { return src; }
72 virtual void on_press() =0;
73 virtual void on_release() =0;
74 virtual void on_motion(float, float) =0;
77 void connect_signals();
78 void button_press(unsigned);
79 void button_release(unsigned);
80 void axis_motion(unsigned, float, float);