Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 2 | /* Copyright (c) FIRST 2011-2016. All Rights Reserved. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #ifndef __BUTTON_H__ |
| 9 | #define __BUTTON_H__ |
| 10 | |
| 11 | #include "Buttons/Trigger.h" |
| 12 | #include "Commands/Command.h" |
| 13 | |
| 14 | /** |
| 15 | * This class provides an easy way to link commands to OI inputs. |
| 16 | * |
| 17 | * It is very easy to link a button to a command. For instance, you could |
| 18 | * link the trigger button of a joystick to a "score" command. |
| 19 | * |
| 20 | * This class represents a subclass of Trigger that is specifically aimed at |
| 21 | * buttons on an operator interface as a common use case of the more generalized |
| 22 | * Trigger objects. This is a simple wrapper around Trigger with the method |
| 23 | * names |
| 24 | * renamed to fit the Button object use. |
| 25 | * |
| 26 | * @author brad |
| 27 | */ |
| 28 | class Button : public Trigger { |
| 29 | public: |
| 30 | virtual void WhenPressed(Command *command); |
| 31 | virtual void WhileHeld(Command *command); |
| 32 | virtual void WhenReleased(Command *command); |
| 33 | virtual void CancelWhenPressed(Command *command); |
| 34 | virtual void ToggleWhenPressed(Command *command); |
| 35 | }; |
| 36 | |
| 37 | #endif |