Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2011. All Rights Reserved. |
| 3 | */ |
| 4 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 5 | /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ |
| 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 |