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