1 #ifndef MSP_INPUT_BINARYCONTROL_H_
2 #define MSP_INPUT_BINARYCONTROL_H_
4 #include <msp/graphics/mspgui_api.h>
11 A control with two possible states. Button state is mapped directly. An axis
12 is considered to be active when its value is above a threshold (0.5 by
15 class MSPGUI_API BinaryControl: public Control
18 sigc::signal<void> signal_press;
19 sigc::signal<void> signal_release;
23 float threshold = 0.5f;
26 BinaryControl() = default;
27 BinaryControl(const ControlSource &);
28 BinaryControl(Device &, ControlSrcType, unsigned);
31 /** Sets the threshold between states for axis sources. No effect on button
33 void set_threshold(float);
35 bool get_state() const { return state; }
36 bool was_pressed() const { return rising_edge; }
37 bool was_released() const { return falling_edge; }
40 void on_press() override;
41 void on_release() override;
42 void on_motion(float, float) override;