#pragma once // Spec: SPEC.md UX-MD-01. GFM table grid: content sized columns, shrunk toward their minimum when the table // does not fit, 1pt grid, alternating body rows (MarkdownUI default table style, UNVERIFIED values). #include #include "ui/MarkdownParser.hpp" #include "ui/View.hpp" namespace dp::ui { class MarkdownTableView : public View { public: // rows[0] is the header row; every row has aligns.size() cells. MarkdownTableView(const std::vector>& rows, std::vector aligns); void place(const Rect& r) override; void draw(Canvas& c) override; protected: Size compute(const Proposal& p) override; private: struct Grid { std::vector cols, rows; float width = 0, height = 0; }; Grid layout(float avail); Grid grid_; // computed in place() std::size_t cols_, rows_; std::vector aligns_; }; } // namespace dp::ui