MCPcopy Create free account
hub / github.com/AlexandreRouma/SDRPlusPlus / ShowDemoWindowTables

Function ShowDemoWindowTables

core/src/imgui/imgui_demo.cpp:3528–6628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3526}
3527
3528static void ShowDemoWindowTables()
3529{
3530 //ImGui::SetNextItemOpen(true, ImGuiCond_Once);
3531 if (!ImGui::CollapsingHeader("Tables & Columns"))
3532 return;
3533
3534 // Using those as a base value to create width/height that are factor of the size of our font
3535 const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x;
3536 const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
3537
3538 ImGui::PushID("Tables");
3539
3540 int open_action = -1;
3541 if (ImGui::Button("Open all"))
3542 open_action = 1;
3543 ImGui::SameLine();
3544 if (ImGui::Button("Close all"))
3545 open_action = 0;
3546 ImGui::SameLine();
3547
3548 // Options
3549 static bool disable_indent = false;
3550 ImGui::Checkbox("Disable tree indentation", &disable_indent);
3551 ImGui::SameLine();
3552 HelpMarker("Disable the indenting of tree nodes so demo tables can use the full window width.");
3553 ImGui::Separator();
3554 if (disable_indent)
3555 ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);
3556
3557 // About Styling of tables
3558 // Most settings are configured on a per-table basis via the flags passed to BeginTable() and TableSetupColumns APIs.
3559 // There are however a few settings that a shared and part of the ImGuiStyle structure:
3560 // style.CellPadding // Padding within each cell
3561 // style.Colors[ImGuiCol_TableHeaderBg] // Table header background
3562 // style.Colors[ImGuiCol_TableBorderStrong] // Table outer and header borders
3563 // style.Colors[ImGuiCol_TableBorderLight] // Table inner borders
3564 // style.Colors[ImGuiCol_TableRowBg] // Table row background when ImGuiTableFlags_RowBg is enabled (even rows)
3565 // style.Colors[ImGuiCol_TableRowBgAlt] // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows)
3566
3567 // Demos
3568 if (open_action != -1)
3569 ImGui::SetNextItemOpen(open_action != 0);
3570 if (ImGui::TreeNode("Basic"))
3571 {
3572 // Here we will showcase three different ways to output a table.
3573 // They are very simple variations of a same thing!
3574
3575 // [Method 1] Using TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.
3576 // In many situations, this is the most flexible and easy to use pattern.
3577 HelpMarker("Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, in a loop.");
3578 if (ImGui::BeginTable("table1", 3))
3579 {
3580 for (int row = 0; row < 4; row++)
3581 {
3582 ImGui::TableNextRow();
3583 for (int column = 0; column < 3; column++)
3584 {
3585 ImGui::TableSetColumnIndex(column);

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

HelpMarkerFunction · 0.85
PushStyleCompactFunction · 0.85
PopStyleCompactFunction · 0.85
sprintfFunction · 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