mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
committed by
Peter Johnson
parent
ceed1d74dc
commit
01d1322066
@@ -25,8 +25,13 @@ ShuffleboardContainer::GetComponents() const {
|
||||
return m_components;
|
||||
}
|
||||
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& type,
|
||||
const wpi::Twine& title) {
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& title,
|
||||
const LayoutType& type) {
|
||||
return GetLayout(title, type.GetLayoutName());
|
||||
}
|
||||
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& title,
|
||||
const wpi::Twine& type) {
|
||||
wpi::SmallVector<char, 16> storage;
|
||||
auto titleRef = title.toStringRef(storage);
|
||||
if (m_layouts.count(titleRef) == 0) {
|
||||
@@ -38,6 +43,16 @@ ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& type,
|
||||
return *m_layouts[titleRef];
|
||||
}
|
||||
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& title) {
|
||||
wpi::SmallVector<char, 16> storage;
|
||||
auto titleRef = title.toStringRef(storage);
|
||||
if (m_layouts.count(titleRef) == 0) {
|
||||
wpi_setWPIErrorWithContext(
|
||||
InvalidParameter, "No layout with the given title has been defined");
|
||||
}
|
||||
return *m_layouts[titleRef];
|
||||
}
|
||||
|
||||
ComplexWidget& ShuffleboardContainer::Add(const wpi::Twine& title,
|
||||
Sendable& sendable) {
|
||||
CheckTitle(title);
|
||||
|
||||
Reference in New Issue
Block a user