Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 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 | #include "glass/View.h" |
| 6 | |
| 7 | using namespace glass; |
| 8 | |
| 9 | namespace { |
| 10 | class 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 | |
| 22 | std::unique_ptr<View> glass::MakeFunctionView( |
| 23 | wpi::unique_function<void()> display) { |
| 24 | return std::make_unique<FunctionView>(std::move(display)); |
| 25 | } |
| 26 | |
| 27 | void View::Hidden() {} |