/*----------------------------------------------------------------------------*/ /* 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. */ /*----------------------------------------------------------------------------*/ #include "glass/networktables/NTDigitalInput.h" #include "glass/networktables/NTDigitalOutput.h" #include "glass/networktables/NTFMS.h" #include "glass/networktables/NTField2D.h" #include "glass/networktables/NTStringChooser.h" #include "glass/networktables/NetworkTablesProvider.h" using namespace glass; void glass::AddStandardNetworkTablesViews(NetworkTablesProvider& provider) { provider.Register( NTFMSModel::kType, [](NT_Inst inst, const char* path) { return std::make_unique(inst, path); }, [](Window* win, Model* model, const char*) { win->SetFlags(ImGuiWindowFlags_AlwaysAutoResize); return MakeFunctionView( [=] { DisplayFMS(static_cast(model)); }); }); provider.Register( NTDigitalInputModel::kType, [](NT_Inst inst, const char* path) { return std::make_unique(inst, path); }, [](Window* win, Model* model, const char*) { win->SetFlags(ImGuiWindowFlags_AlwaysAutoResize); return MakeFunctionView([=] { DisplayDIO(static_cast(model), 0, true); }); }); provider.Register( NTDigitalOutputModel::kType, [](NT_Inst inst, const char* path) { return std::make_unique(inst, path); }, [](Window* win, Model* model, const char*) { win->SetFlags(ImGuiWindowFlags_AlwaysAutoResize); return MakeFunctionView([=] { DisplayDIO(static_cast(model), 0, true); }); }); provider.Register( NTField2DModel::kType, [](NT_Inst inst, const char* path) { return std::make_unique(inst, path); }, [=](Window* win, Model* model, const char* path) { win->SetDefaultPos(200, 200); win->SetDefaultSize(400, 200); win->SetPadding(0, 0); return std::make_unique( static_cast(model)); }); provider.Register( NTStringChooserModel::kType, [](NT_Inst inst, const char* path) { return std::make_unique(inst, path); }, [](Window* win, Model* model, const char*) { win->SetFlags(ImGuiWindowFlags_AlwaysAutoResize); return MakeFunctionView([=] { DisplayStringChooser(static_cast(model)); }); }); }