WPILibC++  2019.2.1-3-g1349dd4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ShuffleboardWidget.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 FIRST. 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 <wpi/Twine.h>
11 
12 #include "frc/shuffleboard/ShuffleboardComponent.h"
13 #include "frc/shuffleboard/WidgetType.h"
14 
15 namespace frc {
16 
17 class ShuffleboardContainer;
18 
26 template <typename Derived>
28  : public ShuffleboardComponent<ShuffleboardWidget<Derived>> {
29  public:
31  : ShuffleboardValue(title),
33 
42  Derived& withWidget(const WidgetType& widgetType) {
43  return WithWidget(widgetType.GetWidgetName());
44  }
45 
57  Derived& WithWidget(const wpi::Twine& widgetType) {
58  this->SetType(widgetType);
59  return *static_cast<Derived*>(this);
60  }
61 };
62 
63 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
A generic component in Shuffleboard.
Definition: ShuffleboardComponent.h:30
Derived & WithWidget(const wpi::Twine &widgetType)
Sets the type of widget used to display the data.
Definition: ShuffleboardWidget.h:57
Derived & withWidget(const WidgetType &widgetType)
Sets the type of widget used to display the data.
Definition: ShuffleboardWidget.h:42
wpi::StringRef GetWidgetName() const
Gets the string type of the widget as defined by that widget in Shuffleboard.
Definition: ShuffleboardValue.h:19
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
Common interface for objects that can contain shuffleboard components.
Definition: ShuffleboardContainer.h:41
Represents the type of a widget in Shuffleboard.
Definition: WidgetType.h:21
Abstract superclass for widgets.
Definition: ShuffleboardWidget.h:27