blob: 3c77886d045ed61c2d145c3d346edfe25a6d3d2f [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
Brian Silverman1a675112016-02-20 20:42:49 -05002/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
Brian Silverman26e4e522015-12-17 01:56:40 -05003/* Open Source Software - may be modified and shared by FRC teams. The code */
Brian Silverman1a675112016-02-20 20:42:49 -05004/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
Brian Silverman26e4e522015-12-17 01:56:40 -05006/*----------------------------------------------------------------------------*/
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 */
28class 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