]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/binarycontrol.h
Use default member initializers and defaulted default constructors
[libs/gui.git] / source / input / binarycontrol.h
index 64e4ab17be4ca1698e78c880a164f299d61b89e3..0d71bdc3349e0dc4afedf3a5a9423528ca82977a 100644 (file)
@@ -18,25 +18,27 @@ public:
        sigc::signal<void> signal_release;
 
 private:
-       bool state;
-       float threshold;
+       bool state = false;
+       float threshold = 0.5f;
 
 public:
-       BinaryControl();
+       BinaryControl() = default;
        BinaryControl(const ControlSource &);
        BinaryControl(Device &, ControlSrcType, unsigned);
-       virtual ~BinaryControl();
+       ~BinaryControl();
 
        /** Sets the threshold between states for axis sources.  No effect on button
        sources */
        void set_threshold(float);
 
        bool get_state() const { return state; }
+       bool was_pressed() const { return rising_edge; }
+       bool was_released() const { return falling_edge; }
 
 private:
-       virtual void on_press();
-       virtual void on_release();
-       virtual void on_motion(float, float);
+       void on_press() override;
+       void on_release() override;
+       void on_motion(float, float) override;
 };
 
 } // namespace Input