WPILibC++ 2023.4.3-108-ge5452e3
ShuffleboardComponent.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <memory>
8#include <string>
9#include <string_view>
10
13#include <wpi/StringMap.h>
14
16
17namespace frc {
18
19class ShuffleboardContainer;
20
21/**
22 * A generic component in Shuffleboard.
23 *
24 * @tparam Derived the self type
25 */
26template <typename Derived>
28 public:
31
32 /**
33 * Sets custom properties for this component. Property names are
34 * case-sensitive and whitespace-insensitive (capitalization and spaces do not
35 * matter).
36 *
37 * @param properties the properties for this component
38 * @return this component
39 */
40 Derived& WithProperties(const wpi::StringMap<nt::Value>& properties);
41
42 /**
43 * Sets the position of this component in the tab. This has no effect if this
44 * component is inside a layout.
45 *
46 * If the position of a single component is set, it is recommended to set the
47 * positions of <i>all</i> components inside a tab to prevent Shuffleboard
48 * from automatically placing another component there before the one with the
49 * specific position is sent.
50 *
51 * @param columnIndex the column in the tab to place this component
52 * @param rowIndex the row in the tab to place this component
53 * @return this component
54 */
55 Derived& WithPosition(int columnIndex, int rowIndex);
56
57 /**
58 * Sets the size of this component in the tab. This has no effect if this
59 * component is inside a layout.
60 *
61 * @param width how many columns wide the component should be
62 * @param height how many rows high the component should be
63 * @return this component
64 */
65 Derived& WithSize(int width, int height);
66};
67
68} // namespace frc
69
This file defines the StringMap class.
A shim class to allow storing ShuffleboardComponents in arrays.
Definition: ShuffleboardComponentBase.h:24
A generic component in Shuffleboard.
Definition: ShuffleboardComponent.h:27
Derived & WithSize(int width, int height)
Sets the size of this component in the tab.
Definition: ShuffleboardComponent.inc:40
Derived & WithProperties(const wpi::StringMap< nt::Value > &properties)
Sets custom properties for this component.
Definition: ShuffleboardComponent.inc:23
ShuffleboardComponent(ShuffleboardContainer &parent, std::string_view title, std::string_view type="")
Definition: ShuffleboardComponent.inc:16
Derived & WithPosition(int columnIndex, int rowIndex)
Sets the position of this component in the tab.
Definition: ShuffleboardComponent.inc:31
Common interface for objects that can contain shuffleboard components.
Definition: ShuffleboardContainer.h:42
basic_string_view< char > string_view
Definition: core.h:520
type
Definition: core.h:575
Definition: AprilTagPoseEstimator.h:15