2020-02-01 21:30:23 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2020 FIRST. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
#include "glass/View.h"
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
using namespace glass;
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
namespace {
|
|
|
|
|
class FunctionView : public View {
|
2020-02-01 21:30:23 -08:00
|
|
|
public:
|
2020-09-12 10:55:46 -07:00
|
|
|
explicit FunctionView(wpi::unique_function<void()> display)
|
|
|
|
|
: m_display(std::move(display)) {}
|
|
|
|
|
|
|
|
|
|
void Display() override { m_display(); }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
wpi::unique_function<void()> m_display;
|
2020-02-01 21:30:23 -08:00
|
|
|
};
|
2020-09-12 10:55:46 -07:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<View> glass::MakeFunctionView(
|
|
|
|
|
wpi::unique_function<void()> display) {
|
|
|
|
|
return std::make_unique<FunctionView>(std::move(display));
|
|
|
|
|
}
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
void View::Hidden() {}
|