MCPcopy Create free account
hub / github.com/cinder/Cinder / DemoWindowTables

Function DemoWindowTables

src/imgui/imgui_demo.cpp:5635–9111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5633//-----------------------------------------------------------------------------
5634
5635static void DemoWindowTables()
5636{
5637 //ImGui::SetNextItemOpen(true, ImGuiCond_Once);
5638 IMGUI_DEMO_MARKER("Tables");
5639 if (!ImGui::CollapsingHeader("Tables & Columns"))
5640 return;
5641
5642 // Using those as a base value to create width/height that are factor of the size of our font
5643 const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x;
5644 const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
5645
5646 ImGui::PushID("Tables");
5647
5648 int open_action = -1;
5649 if (ImGui::Button("Expand all"))
5650 open_action = 1;
5651 ImGui::SameLine();
5652 if (ImGui::Button("Collapse all"))
5653 open_action = 0;
5654 ImGui::SameLine();
5655
5656 // Options
5657 static bool disable_indent = false;
5658 ImGui::Checkbox("Disable tree indentation", &disable_indent);
5659 ImGui::SameLine();
5660 HelpMarker("Disable the indenting of tree nodes so demo tables can use the full window width.");
5661 ImGui::Separator();
5662 if (disable_indent)
5663 ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);
5664
5665 // About Styling of tables
5666 // Most settings are configured on a per-table basis via the flags passed to BeginTable() and TableSetupColumns APIs.
5667 // There are however a few settings that a shared and part of the ImGuiStyle structure:
5668 // style.CellPadding // Padding within each cell
5669 // style.Colors[ImGuiCol_TableHeaderBg] // Table header background
5670 // style.Colors[ImGuiCol_TableBorderStrong] // Table outer and header borders
5671 // style.Colors[ImGuiCol_TableBorderLight] // Table inner borders
5672 // style.Colors[ImGuiCol_TableRowBg] // Table row background when ImGuiTableFlags_RowBg is enabled (even rows)
5673 // style.Colors[ImGuiCol_TableRowBgAlt] // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows)
5674
5675 // Demos
5676 if (open_action != -1)
5677 ImGui::SetNextItemOpen(open_action != 0);
5678 IMGUI_DEMO_MARKER("Tables/Basic");
5679 if (ImGui::TreeNode("Basic"))
5680 {
5681 // Here we will showcase three different ways to output a table.
5682 // They are very simple variations of a same thing!
5683
5684 // [Method 1] Using TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.
5685 // In many situations, this is the most flexible and easy to use pattern.
5686 HelpMarker("Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, in a loop.");
5687 if (ImGui::BeginTable("table1", 3))
5688 {
5689 for (int row = 0; row < 4; row++)
5690 {
5691 ImGui::TableNextRow();
5692 for (int column = 0; column < 3; column++)

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

HelpMarkerFunction · 0.85
PushStyleCompactFunction · 0.85
PopStyleCompactFunction · 0.85
ImVec2Function · 0.85
SliderFloat2Function · 0.85
EditTableSizingFlagsFunction · 0.85
ComboFunction · 0.85
EditTableColumnsFlagsFunction · 0.85
ImVec4Class · 0.85
MyItemClass · 0.85
DragFloat2Function · 0.85

Tested by

no test coverage detected