@ -157,6 +157,7 @@ typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A
typedefintImGuiMouseCursor;// -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
typedefintImGuiSortDirection;// -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
typedefintImGuiStyleVar;// -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
typedefintImGuiTableBgTarget;// -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor()
typedefintImDrawCornerFlags;// -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc.
typedefintImDrawListFlags;// -> enum ImDrawListFlags_ // Flags: for ImDrawList
typedefintImFontAtlasFlags;// -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build
@ -684,6 +685,7 @@ namespace ImGui
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_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_APIvoidTableSetBgColor(ImGuiTableBgTargetbg_target,ImU32color,intcolumn_n=-1);// change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
// Tables: Headers & Columns declaration
// - Use TableSetupColumn() to specify label, resizing policy, default width, id, various other flags etc.
// - The name passed to TableSetupColumn() is used by TableAutoHeaders() and by the context-menu
@ -1036,7 +1038,7 @@ enum ImGuiTableFlags_
ImGuiTableFlags_MultiSortable=1<<4,// Allow sorting on multiple columns by holding Shift (sort_specs_count may be > 1). Call TableGetSortSpecs() to obtain sort specs.
ImGuiTableFlags_NoSavedSettings=1<<5,// Disable persisting columns order, width and sort settings in the .ini file.
// Decoration
ImGuiTableFlags_RowBg=1<<6,// Use ImGuiCol_TableRowBg and ImGuiCol_TableRowBgAlt colors behind each rows.
ImGuiTableFlags_RowBg=1<<6,// Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent to calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually)
ImGuiTableFlags_BordersInnerH=1<<7,// Draw horizontal borders between rows.
ImGuiTableFlags_BordersOuterH=1<<8,// Draw horizontal borders at the top and bottom.
ImGuiTableFlags_BordersInnerV=1<<9,// Draw vertical borders between columns.
@ -1109,6 +1111,25 @@ enum ImGuiTableRowFlags_
ImGuiTableRowFlags_Headers=1<<0// Identify header row (set default background color + width of its contents accounted different for auto column width)
};
// Enum for ImGui::TableSetBgColor()
// Background colors are rendering in 3 layers:
// - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set.
// - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set.
// - Layer 2: draw with CellBg color if set.
// The purpose of the two row/columns layers is to let you decide if a background color changes should override or blend with the existing color.
// When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows.
// If you set the color of RowBg0 target, your color will override the existing RowBg0 color.
// If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color.
enumImGuiTableBgTarget_
{
ImGuiTableBgTarget_None=0,
ImGuiTableBgTarget_ColumnBg0=1,// FIXME-TABLE: Todo. Set column background color 0 (generally used for background
ImGuiTableBgTarget_ColumnBg1=2,// FIXME-TABLE: Todo. Set column background color 1 (generally used for selection marking)
ImGuiTableBgTarget_RowBg0=3,// Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used)
ImGuiTableBgTarget_RowBg1=4,// Set row background color 1 (generally used for selection marking)
ImGuiTableBgTarget_CellBg=5// Set cell background color (top-most color)
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would requires a unique clipping rectangle per row.");
ImGui::Combo("row bg target",(int*)&row_bg_target,"RowBg0\0RowBg1\0");ImGui::SameLine();HelpMarker("Target RowBg0 to override the alternating odd/even colors,\nTarget RowBg1 to blend with them.");
ImGui::Combo("cell bg type",(int*)&cell_bg_type,"None\0Blue\0");ImGui::SameLine();HelpMarker("We are colorizing cells to B1->C2 here.");
IM_ASSERT(row_bg_type>=0&&row_bg_type<=2);
IM_ASSERT(row_bg_target>=0&&row_bg_target<=1);
IM_ASSERT(cell_bg_type>=0&&cell_bg_type<=1);
if(ImGui::BeginTable("##Table",5,table_flags))
{
for(introw=0;row<6;row++)
{
ImGui::TableNextRow();
// Demonstrate setting a row background color with 'ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBgX, ...)'
// We use a transparent color so we can see the one behind in case our target is RowBg1 and RowBg0 was already targeted by the ImGuiTableFlags_RowBg flag.
if(row_bg_type!=0)
{
ImU32row_bg_color=ImGui::GetColorU32(row_bg_type==1?ImVec4(0.7f,0.3f,0.3f,0.65f):ImVec4(0.2f+row*0.1f,0.2f,0.2f,0.65f));// Flat or Gradient?
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code which cannot be used as a regular color.
#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.
#define IMGUI_TABLE_MAX_DRAW_CHANNELS (2 + 64 * 2) // See TableUpdateDrawChannels()
// [Internal] sizeof() ~ 100
// [Internal] sizeof() ~ 104
// We use the terminology "Visible" to refer to a column that is not Hidden by user or settings. However it may still be out of view and clipped (see IsClipped).
structImGuiTableColumn
{
@ -1943,6 +1943,14 @@ struct ImGuiTableColumn
}
};
// Transient cell data stored per row.
// sizeof() ~ 6
structImGuiTableCellData
{
ImU32BgColor;// Actual color
ImS8Column;// Column number
};
structImGuiTable
{
ImGuiIDID;
@ -1950,6 +1958,7 @@ struct ImGuiTable
ImVector<char>RawData;
ImSpan<ImGuiTableColumn>Columns;// Point within RawData[]
ImSpan<ImS8>DisplayOrderToIndex;// Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
ImSpan<ImGuiTableCellData>RowCellData;// Point within RawData[]. Store cells background requests for current row.
ImU64VisibleMaskByIndex;// Column Index -> IsVisible map (== not hidden by user/api) in a format adequate for iterating column without touching cold data
ImRectcell_rect(column->MinX-table->CellSpacingX,bg_y1,column->MaxX,bg_y2);// FIXME-TABLE: Padding currently wrong until we finish the padding refactor