#include "viz/table_view.h" #include "imgui.h" bool table_view(const char* id, const char* const* headers, int col_count, const char* const* cells, int row_count) { ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_Sortable | ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_Reorderable; if (!ImGui::BeginTable(id, col_count, flags, ImVec2(0, 300))) { return false; } for (int col = 0; col < col_count; col++) { ImGui::TableSetupColumn(headers[col]); } ImGui::TableHeadersRow(); for (int row = 0; row < row_count; row++) { ImGui::TableNextRow(); for (int col = 0; col < col_count; col++) { ImGui::TableSetColumnIndex(col); ImGui::TextUnformatted(cells[row * col_count + col]); } } ImGui::EndTable(); return true; }