Add constants for built-in Shuffleboard widgets and layouts (#1468)

Prevents users from having to remember (and correctly type) the names of Shuffleboard widgets.
This commit is contained in:
Sam Carlberg
2018-12-29 20:22:47 -05:00
committed by Peter Johnson
parent ceed1d74dc
commit 01d1322066
24 changed files with 1278 additions and 52 deletions

View File

@@ -10,6 +10,7 @@
#include <wpi/Twine.h>
#include "frc/shuffleboard/ShuffleboardComponent.h"
#include "frc/shuffleboard/WidgetType.h"
namespace frc {
@@ -36,6 +37,22 @@ class ShuffleboardWidget
*
* @param widgetType the type of the widget used to display the data
* @return this widget object
* @see BuiltInWidgets
*/
Derived& withWidget(const WidgetType& widgetType) {
return WithWidget(widgetType.GetWidgetName());
}
/**
* Sets the type of widget used to display the data. If not set, the default
* widget type will be used. This method should only be used to use a widget
* that does not come built into Shuffleboard (i.e. one that comes with a
* custom or thrid-party plugin). To use a widget that is built into
* Shuffleboard, use {@link #withWidget(WidgetType)} and {@link
* BuiltInWidgets}.
*
* @param widgetType the type of the widget used to display the data
* @return this widget object
*/
Derived& WithWidget(const wpi::Twine& widgetType) {
this->SetType(widgetType);