blob: e01c4df2be022de4a3882296c036d23cf726f013 [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001// 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#include "glass/View.h"
6
7using namespace glass;
8
9namespace {
10class FunctionView : public View {
11 public:
12 explicit FunctionView(wpi::unique_function<void()> display)
13 : m_display(std::move(display)) {}
14
15 void Display() override { m_display(); }
16
17 private:
18 wpi::unique_function<void()> m_display;
19};
20} // namespace
21
22std::unique_ptr<View> glass::MakeFunctionView(
23 wpi::unique_function<void()> display) {
24 return std::make_unique<FunctionView>(std::move(display));
25}
26
27void View::Hidden() {}