MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ShowDemoWindowTables

Function ShowDemoWindowTables

plugins/Cardinal/src/DearImGui/imgui_demo.cpp:3706–6737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3704}
3705
3706static void ShowDemoWindowTables()
3707{
3708 //ImGui::SetNextItemOpen(true, ImGuiCond_Once);
3709 IMGUI_DEMO_MARKER("Tables");
3710 if (!ImGui::CollapsingHeader("Tables & Columns"))
3711 return;
3712
3713 // Using those as a base value to create width/height that are factor of the size of our font
3714 const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x;
3715 const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
3716
3717 ImGui::PushID("Tables");
3718
3719 int open_action = -1;
3720 if (ImGui::Button("Open all"))
3721 open_action = 1;
3722 ImGui::SameLine();
3723 if (ImGui::Button("Close all"))
3724 open_action = 0;
3725 ImGui::SameLine();
3726
3727 // Options
3728 static bool disable_indent = false;
3729 ImGui::Checkbox("Disable tree indentation", &disable_indent);
3730 ImGui::SameLine();
3731 HelpMarker("Disable the indenting of tree nodes so demo tables can use the full window width.");
3732 ImGui::Separator();
3733 if (disable_indent)
3734 ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);
3735
3736 // About Styling of tables
3737 // Most settings are configured on a per-table basis via the flags passed to BeginTable() and TableSetupColumns APIs.
3738 // There are however a few settings that a shared and part of the ImGuiStyle structure:
3739 // style.CellPadding // Padding within each cell
3740 // style.Colors[ImGuiCol_TableHeaderBg] // Table header background
3741 // style.Colors[ImGuiCol_TableBorderStrong] // Table outer and header borders
3742 // style.Colors[ImGuiCol_TableBorderLight] // Table inner borders
3743 // style.Colors[ImGuiCol_TableRowBg] // Table row background when ImGuiTableFlags_RowBg is enabled (even rows)
3744 // style.Colors[ImGuiCol_TableRowBgAlt] // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows)
3745
3746 // Demos
3747 if (open_action != -1)
3748 ImGui::SetNextItemOpen(open_action != 0);
3749 IMGUI_DEMO_MARKER("Tables/Basic");
3750 if (ImGui::TreeNode("Basic"))
3751 {
3752 // Here we will showcase three different ways to output a table.
3753 // They are very simple variations of a same thing!
3754
3755 // [Method 1] Using TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.
3756 // In many situations, this is the most flexible and easy to use pattern.
3757 HelpMarker("Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, in a loop.");
3758 if (ImGui::BeginTable("table1", 3))
3759 {
3760 for (int row = 0; row < 4; row++)
3761 {
3762 ImGui::TableNextRow();
3763 for (int column = 0; column < 3; column++)

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

ButtonClass · 0.85
HelpMarkerFunction · 0.85
PushStyleCompactFunction · 0.85
PopStyleCompactFunction · 0.85
ImVec2Function · 0.85
SliderFloat2Function · 0.85
EditTableSizingFlagsFunction · 0.85
DragFloatFunction · 0.85
EditTableColumnsFlagsFunction · 0.85
ImVec4Class · 0.85
SliderFloatFunction · 0.85

Tested by

no test coverage detected