#include "mologram/ui/HelpOverlay.hpp" #include "mologram/ActionRegistry.hpp" namespace mologram::ui { using namespace ttgui; std::vector> HelpOverlay::rows(const Config& cfg) { std::vector> r; for (const auto& a : ActionRegistry::all()) r.push_back({a.menu, cfg.keyFor(a.id), a.id}); return r; } Window* HelpOverlay::open(Application& app, const Config& cfg) { Window* win = app.wm.createWindow("Keys", "lightblue", {6, 2, 64, 24}); win->appName = "HelpOverlay"; win->modal = true; auto* t = new Table(); t->cfg = &app.cfg; t->headers = {"Action", "Key", "Id"}; t->colWidths = {28, 16, 16}; t->rows = rows(cfg); win->setContent(std::unique_ptr(t)); t->bounds = win->contentRect(); app.setFocused(t); return win; } } // namespace mologram::ui