WPILibC++ 2024.3.2
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:
29 /**
30 * Constructs a ShuffleboardComponent.
31 *
32 * @param parent The parent container.
33 * @param title The component title.
34 * @param type The component type.
35 */
38
39 /**
40 * Sets custom properties for this component. Property names are
41 * case-sensitive and whitespace-insensitive (capitalization and spaces do not
42 * matter).
43 *
44 * @param properties the properties for this component
45 * @return this component
46 */
47 Derived& WithProperties(const wpi::StringMap<nt::Value>& properties);
48
49 /**
50 * Sets the position of this component in the tab. This has no effect if this
51 * component is inside a layout.
52 *
53 * If the position of a single component is set, it is recommended to set the
54 * positions of <i>all</i> components inside a tab to prevent Shuffleboard
55 * from automatically placing another component there before the one with the
56 * specific position is sent.
57 *
58 * @param columnIndex the column in the tab to place this component
59 * @param rowIndex the row in the tab to place this component
60 * @return this component
61 */
62 Derived& WithPosition(int columnIndex, int rowIndex);
63
64 /**
65 * Sets the size of this component in the tab. This has no effect if this
66 * component is inside a layout.
67 *
68 * @param width how many columns wide the component should be
69 * @param height how many rows high the component should be
70 * @return this component
71 */
72 Derived& WithSize(int width, int height);
73};
74
75} // namespace frc
76
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="")
Constructs a ShuffleboardComponent.
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:501
type
Definition: core.h:556
Definition: AprilTagPoseEstimator.h:15