1 #ifndef MSP_GBASE_CONTROL_H_
2 #define MSP_GBASE_CONTROL_H_
5 #include <sigc++/signal.h>
6 #include <sigc++/trackable.h>
22 Specifies the source of a control. This provides a way for setting sources for
23 different types of controls in a uniform way.
32 ControlSource(Device &, ControlSrcType, unsigned);
33 std::string str() const;
37 Provides further abstraction on top of input devices. There are two types of
38 controls currently defined: BinaryControl and SmoothControl.
40 A control uses either a button or half of an axis (positive or negative) as its
41 source. How the source values are interpreted depends on the exact type of the
42 control. Controls also support interactive binding by capturing a button press
45 class Control: public sigc::trackable
48 sigc::signal<void> signal_capture_complete;
55 Control(const ControlSource &);
56 Control(Device &, ControlSrcType, unsigned);
58 virtual ~Control() { }
60 void capture(Device &);
61 void cancel_capture();
62 void set_source(Device &, ControlSrcType, unsigned);
63 void set_source(const ControlSource &);
64 const ControlSource &get_source() const { return src; }
66 virtual void on_press() = 0;
67 virtual void on_release() = 0;
68 virtual void on_motion(float, float) = 0;
71 void connect_signals();
72 void button_press(unsigned);
73 void button_release(unsigned);
74 void axis_motion(unsigned, float, float);
76 Control(const Control &);
77 Control &operator=(const Control &);