MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DemoWindowTables

Function DemoWindowTables

3rdparty/imgui/src/imgui_demo.cpp:5786–9310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5784//-----------------------------------------------------------------------------
5785
5786static void DemoWindowTables()
5787{
5788 //ImGui::SetNextItemOpen(true, ImGuiCond_Once);
5789 if (!ImGui::CollapsingHeader("Tables & Columns"))
5790 return;
5791
5792 // Using those as a base value to create width/height that are factor of the size of our font
5793 const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x;
5794 const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
5795
5796 ImGui::PushID("Tables");
5797
5798 int open_action = -1;
5799 if (ImGui::Button("Expand all"))
5800 open_action = 1;
5801 ImGui::SameLine();
5802 if (ImGui::Button("Collapse all"))
5803 open_action = 0;
5804 ImGui::SameLine();
5805
5806 // Options
5807 static bool disable_indent = false;
5808 ImGui::Checkbox("Disable tree indentation", &disable_indent);
5809 ImGui::SameLine();
5810 HelpMarker("Disable the indenting of tree nodes so demo tables can use the full window width.");
5811 ImGui::Separator();
5812 if (disable_indent)
5813 ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);
5814
5815 // About Styling of tables
5816 // Most settings are configured on a per-table basis via the flags passed to BeginTable() and TableSetupColumns APIs.
5817 // There are however a few settings that a shared and part of the ImGuiStyle structure:
5818 // style.CellPadding // Padding within each cell
5819 // style.Colors[ImGuiCol_TableHeaderBg] // Table header background
5820 // style.Colors[ImGuiCol_TableBorderStrong] // Table outer and header borders
5821 // style.Colors[ImGuiCol_TableBorderLight] // Table inner borders
5822 // style.Colors[ImGuiCol_TableRowBg] // Table row background when ImGuiTableFlags_RowBg is enabled (even rows)
5823 // style.Colors[ImGuiCol_TableRowBgAlt] // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows)
5824
5825 // Demos
5826 if (open_action != -1)
5827 ImGui::SetNextItemOpen(open_action != 0);
5828 if (ImGui::TreeNode("Basic"))
5829 {
5830 IMGUI_DEMO_MARKER("Tables/Basic");
5831 // Here we will showcase three different ways to output a table.
5832 // They are very simple variations of a same thing!
5833
5834 // [Method 1] Using TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.
5835 // In many situations, this is the most flexible and easy to use pattern.
5836 HelpMarker("Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, in a loop.");
5837 if (ImGui::BeginTable("table1", 3))
5838 {
5839 for (int row = 0; row < 4; row++)
5840 {
5841 ImGui::TableNextRow();
5842 for (int column = 0; column < 3; column++)
5843 {

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

HelpMarkerFunction · 0.85
PushStyleCompactFunction · 0.85
IndentFunction · 0.85
PopStyleCompactFunction · 0.85
sprintfFunction · 0.85
EditTableSizingFlagsFunction · 0.85
EditTableColumnsFlagsFunction · 0.85
ImVec4Class · 0.85
MyItemClass · 0.85
DemoWindowColumnsFunction · 0.85
find_erase_unsortedMethod · 0.80

Tested by

no test coverage detected