]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/binarycontrol.h
Reorganize files to separate gbase and input
[libs/gui.git] / source / input / binarycontrol.h
diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h
new file mode 100644 (file)
index 0000000..44aaef4
--- /dev/null
@@ -0,0 +1,45 @@
+/* $Id$
+
+This file is part of libmspgbase
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GBASE_BINARYCONTROL_H_
+#define MSP_GBASE_BINARYCONTROL_H_
+
+#include "control.h"
+
+namespace Msp {
+namespace Input {
+
+/**
+A control with two possible states.  Button state is mapped directly.  An axis
+is considered to be active when its value is above a threshold (defined by the
+input device).
+*/
+class BinaryControl: public Control
+{
+public:
+       sigc::signal<void> signal_press;
+       sigc::signal<void> signal_release;
+
+private:
+       bool state;
+
+public:
+       BinaryControl();
+       BinaryControl(const ControlSource &);
+       BinaryControl(Device &, ControlSrcType, unsigned);
+       bool get_state() const { return state; }
+
+private:
+       virtual void on_press();
+       virtual void on_release();
+       virtual void on_motion(float, float);
+};
+
+} // namespace Input
+} // namespace Msp
+
+#endif