IMGUI_APIvoidEndTable();// only call EndTable() if BeginTable() returns true!
IMGUI_APIvoidEndTable();// only call EndTable() if BeginTable() returns true!
IMGUI_APIvoidTableNextRow(ImGuiTableRowFlagsrow_flags=0,floatmin_row_height=0.0f);// append into the first cell of a new row.
IMGUI_APIvoidTableNextRow(ImGuiTableRowFlagsrow_flags=0,floatmin_row_height=0.0f);// append into the first cell of a new row.
IMGUI_APIboolTableNextCell();// append into the next column (next column, or next row if currently in last column). Return true if column is visible.
IMGUI_APIboolTableNextColumn();// append into the next column (or first column of next row if currently in last column). Return true if column is visible.
IMGUI_APIboolTableSetColumnIndex(intcolumn_n);// append into the specified column. Return true if column is visible.
IMGUI_APIboolTableSetColumnIndex(intcolumn_n);// append into the specified column. Return true if column is visible.
IMGUI_APIintTableGetColumnIndex();// return current column index.
IMGUI_APIintTableGetColumnIndex();// return current column index.
// Tables: Headers & Columns declaration
// Tables: Headers & Columns declaration
// - Use TableSetupScrollFreeze() to lock columns (from the right) or rows (from the top) so they stay visible when scrolled.
// - Use TableSetupColumn() to specify label, resizing policy, default width, id, various other flags etc.
// - Use TableSetupColumn() to specify label, resizing policy, default width, id, various other flags etc.
// Important: this will not display anything! The name passed to TableSetupColumn() is used by TableHeadersRow() and context-menus.
// Important: this will not display anything! The name passed to TableSetupColumn() is used by TableHeadersRow() and context-menus.
// - Use TableHeadersRow() to create a row and automatically submit a TableHeader() for each column.
// - Use TableHeadersRow() to create a row and automatically submit a TableHeader() for each column.
// Headers are required to perform some interactions: reordering, sorting, context menu (FIXME-TABLE: context menu should work without!)
// Headers are required to perform some interactions: reordering, sorting, context menu (FIXME-TABLE: context menu should work without!)
// - You may manually submit headers using TableNextRow() + TableHeader() calls, but this is only useful in some advanced cases (e.g. adding custom widgets in header row).
// - You may manually submit headers using TableNextRow() + TableHeader() calls, but this is only useful in some advanced cases (e.g. adding custom widgets in header row).
IMGUI_APIvoidTableSetupScrollFreeze(intcols,introws);// lock columns/rows so they stay visible when scrolled.
IMGUI_APIvoidTableHeadersRow();// submit all headers cells based on data provided to TableSetupColumn() + submit context menu
IMGUI_APIvoidTableHeadersRow();// submit all headers cells based on data provided to TableSetupColumn() + submit context menu
IMGUI_APIvoidTableHeader(constchar*label);// submit one header cell manually (rarely used)
IMGUI_APIvoidTableHeader(constchar*label);// submit one header cell manually (rarely used)
// Tables: Miscellaneous functions
// Tables: Miscellaneous functions
@ -694,13 +702,13 @@ namespace ImGui
// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().
// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().
IMGUI_APIintTableGetColumnCount();// return number of columns (value passed to BeginTable)
IMGUI_APIintTableGetColumnCount();// return number of columns (value passed to BeginTable)
IMGUI_APIconstchar*TableGetColumnName(intcolumn_n=-1);// return NULL if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
IMGUI_APIconstchar*TableGetColumnName(intcolumn_n=-1);// return NULL if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsVisible(intcolumn_n=-1);// return true if column is visible. Same value is also returned by TableNextCell() and TableSetColumnIndex(). Pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsVisible(intcolumn_n=-1);// return true if column is visible. Same value is also returned by TableNextColumn() and TableSetColumnIndex(). Pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsSorted(intcolumn_n=-1);// return true if column is included in the sort specs. Rarely used, can be useful to tell if a data change should trigger resort. Equivalent to test ImGuiTableSortSpecs's ->ColumnsMask & (1 << column_n). Pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsSorted(intcolumn_n=-1);// return true if column is included in the sort specs. Rarely used, can be useful to tell if a data change should trigger resort. Equivalent to test ImGuiTableSortSpecs's ->ColumnsMask & (1 << column_n). Pass -1 to use current column.
IMGUI_APIintTableGetHoveredColumn();// return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.
IMGUI_APIintTableGetHoveredColumn();// return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.
IMGUI_APIImGuiTableSortSpecs*TableGetSortSpecs();// get latest sort specs for the table (NULL if not sorting).
IMGUI_APIImGuiTableSortSpecs*TableGetSortSpecs();// get latest sort specs for the table (NULL if not sorting).
IMGUI_APIvoidTableSetBgColor(ImGuiTableBgTargetbg_target,ImU32color,intcolumn_n=-1);// change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
IMGUI_APIvoidTableSetBgColor(ImGuiTableBgTargetbg_target,ImU32color,intcolumn_n=-1);// change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
// Columns (Legacy API, prefer using Tables)
// Legacy Columns API (2020: prefer using Tables!)
// - You can also use SameLine(pos_x) to mimic simplified columns.
// - You can also use SameLine(pos_x) to mimic simplified columns.
// This essentially the same as above, except instead of using a for loop we call TableSetColumnIndex() manually.
// This essentially the same as above, except instead of using a for loop we call TableSetColumnIndex() manually.
// Sometimes this makes more sense.
// Sometimes this makes more sense.
HelpMarker("Using TableNextRow() + calling TableSetColumnIndex() _before_ each cell, manually.");
HelpMarker("Using TableNextRow() + calling TableNextColumn() _before_ each cell, manually.");
if(ImGui::BeginTable("##table2",3))
if(ImGui::BeginTable("##table2",3))
{
{
for(introw=0;row<4;row++)
for(introw=0;row<4;row++)
{
{
ImGui::TableNextRow();
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::TableNextColumn();
ImGui::Text("Row %d",row);
ImGui::Text("Row %d",row);
ImGui::TableSetColumnIndex(1);
ImGui::TableNextColumn();
ImGui::Text("Some contents");
ImGui::Text("Some contents");
ImGui::TableSetColumnIndex(2);
ImGui::TableNextColumn();
ImGui::Text("123.456");
ImGui::Text("123.456");
}
}
ImGui::EndTable();
ImGui::EndTable();
}
}
// Another subtle variant, we call TableNextCell() _before_ each cell. At the end of a row, TableNextCell() will create a new row.
// Another subtle variant, we call TableNextColumn() _before_ each cell. At the end of a row, TableNextColumn() will create a new row.
// Note that we don't call TableNextRow() here!
// Note that we never TableNextRow() here!
// If we want to call TableNextRow(), then we don't need to call TableNextCell() for the first cell.
HelpMarker("Only using TableNextColumn(), which tends to be convenient for tables where every cells contains the same type of contents.\nThis is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");
HelpMarker("Only using TableNextCell(), which tends to be convenient for tables where every cells contains the same type of contents.\nThis is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition.");