mirror of https://github.com/ocornut/imgui
Tables: Separating inner/outer borders flags per axis so it is possible to remove outer vertical borders to mimic old columns.
VInner or VOuter only don't have correct padding/spacing.
This commit is contained in:
parent
1db8d421cf
commit
17578e215a
15
imgui.h
15
imgui.h
|
@ -1023,11 +1023,16 @@ enum ImGuiTableFlags_
|
|||
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_BordersOuter = 1 << 7, // Draw outer borders.
|
||||
ImGuiTableFlags_BordersV = 1 << 8, // Draw vertical borders between columns.
|
||||
ImGuiTableFlags_BordersH = 1 << 9, // Draw horizontal borders between rows.
|
||||
ImGuiTableFlags_BordersFullHeight = 1 << 10, // Borders covers all lines even when Headers are being used, allow resizing all rows.
|
||||
ImGuiTableFlags_Borders = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersH,
|
||||
ImGuiTableFlags_BordersHInner = 1 << 7, // Draw horizontal borders between rows.
|
||||
ImGuiTableFlags_BordersHOuter = 1 << 8, // Draw horizontal borders at the top and bottom.
|
||||
ImGuiTableFlags_BordersVInner = 1 << 9, // Draw vertical borders between columns.
|
||||
ImGuiTableFlags_BordersVOuter = 1 << 10, // Draw vertical borders on the left and right sides.
|
||||
ImGuiTableFlags_BordersH = ImGuiTableFlags_BordersHInner | ImGuiTableFlags_BordersHOuter, // Draw horizontal borders.
|
||||
ImGuiTableFlags_BordersV = ImGuiTableFlags_BordersVInner | ImGuiTableFlags_BordersVOuter, // Draw vertical borders.
|
||||
ImGuiTableFlags_BordersInner = ImGuiTableFlags_BordersVInner | ImGuiTableFlags_BordersHInner, // Draw inner borders.
|
||||
ImGuiTableFlags_BordersOuter = ImGuiTableFlags_BordersVOuter | ImGuiTableFlags_BordersHOuter, // Draw outer borders.
|
||||
ImGuiTableFlags_Borders = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter, // Draw all borders.
|
||||
ImGuiTableFlags_BordersVFullHeight = 1 << 11, // Borders covers all rows even when Headers are being used. Allow resizing from any rows.
|
||||
// Padding, Sizing
|
||||
ImGuiTableFlags_NoClipX = 1 << 12, // Disable pushing clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow)
|
||||
ImGuiTableFlags_SizingPolicyFixedX = 1 << 13, // Default if ScrollX is on. Columns will default to use WidthFixed or WidthAlwaysAutoResize policy. Read description above for more details.
|
||||
|
|
|
@ -3379,17 +3379,31 @@ static void ShowDemoWindowTables()
|
|||
|
||||
if (open_action != -1)
|
||||
ImGui::SetNextItemOpen(open_action != 0);
|
||||
if (ImGui::TreeNode("With borders, background"))
|
||||
if (ImGui::TreeNode("Borders, background"))
|
||||
{
|
||||
// Expose a few Borders related flags interactively
|
||||
static ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_RowBg;
|
||||
static bool display_width = false;
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_RowBg", (unsigned int*)&flags, ImGuiTableFlags_RowBg);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_Borders", (unsigned int*)&flags, ImGuiTableFlags_Borders);
|
||||
ImGui::SameLine(); HelpMarker("ImGuiTableFlags_Borders\n = ImGuiTableFlags_BordersOuter\n | ImGuiTableFlags_BordersV\n | ImGuiTableFlags_BordersH");
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", (unsigned int*)&flags, ImGuiTableFlags_BordersV);
|
||||
ImGui::SameLine(); HelpMarker("ImGuiTableFlags_Borders\n = ImGuiTableFlags_BordersVInner\n | ImGuiTableFlags_BordersVOuter\n | ImGuiTableFlags_BordersHInner\n | ImGuiTableFlags_BordersHOuter");
|
||||
ImGui::Indent();
|
||||
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", (unsigned int*)&flags, ImGuiTableFlags_BordersH);
|
||||
ImGui::Indent();
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersHOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHInner", (unsigned int*)&flags, ImGuiTableFlags_BordersHInner);
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", (unsigned int*)&flags, ImGuiTableFlags_BordersV);
|
||||
ImGui::Indent();
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersVOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVInner", (unsigned int*)&flags, ImGuiTableFlags_BordersVInner);
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInner", (unsigned int*)&flags, ImGuiTableFlags_BordersInner);
|
||||
ImGui::Unindent();
|
||||
ImGui::Checkbox("Debug Display width", &display_width);
|
||||
|
||||
if (ImGui::BeginTable("##table1", 3, flags))
|
||||
|
@ -3696,7 +3710,7 @@ static void ShowDemoWindowTables()
|
|||
{
|
||||
HelpMarker("This demonstrate embedding a table into another table cell.");
|
||||
|
||||
if (ImGui::BeginTable("recurse1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_BordersFullHeight | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
||||
if (ImGui::BeginTable("recurse1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_BordersVFullHeight | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
||||
{
|
||||
ImGui::TableSetupColumn("A0");
|
||||
ImGui::TableSetupColumn("A1");
|
||||
|
@ -3705,7 +3719,7 @@ static void ShowDemoWindowTables()
|
|||
ImGui::TableNextRow(); ImGui::Text("A0 Cell 0");
|
||||
{
|
||||
float rows_height = ImGui::GetTextLineHeightWithSpacing() * 2;
|
||||
if (ImGui::BeginTable("recurse2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_BordersFullHeight | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
||||
if (ImGui::BeginTable("recurse2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_BordersVFullHeight | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
||||
{
|
||||
ImGui::TableSetupColumn("B0");
|
||||
ImGui::TableSetupColumn("B1");
|
||||
|
@ -3737,13 +3751,15 @@ static void ShowDemoWindowTables()
|
|||
{
|
||||
HelpMarker("This section allows you to interact and see the effect of StretchX vs FixedX sizing policies depending on whether Scroll is enabled and the contents of your columns.");
|
||||
enum ContentsType { CT_ShortText, CT_LongText, CT_Button, CT_StretchButton, CT_InputText };
|
||||
static int contents_type = CT_ShortText;
|
||||
static int contents_type = CT_StretchButton;
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 12);
|
||||
ImGui::Combo("Contents", &contents_type, "Short Text\0Long Text\0Button\0Stretch Button\0InputText\0");
|
||||
|
||||
static ImGuiTableFlags flags = ImGuiTableFlags_ScrollY | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_RowBg;
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", (unsigned int*)&flags, ImGuiTableFlags_BordersH);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", (unsigned int*)&flags, ImGuiTableFlags_BordersV);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHInner", (unsigned int*)&flags, ImGuiTableFlags_BordersHInner);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersHOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVInner", (unsigned int*)&flags, ImGuiTableFlags_BordersVInner);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersVOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_ScrollX", (unsigned int*)&flags, ImGuiTableFlags_ScrollX);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_ScrollY", (unsigned int*)&flags, ImGuiTableFlags_ScrollY);
|
||||
if (ImGui::CheckboxFlags("ImGuiTableFlags_SizingPolicyStretchX", (unsigned int*)&flags, ImGuiTableFlags_SizingPolicyStretchX))
|
||||
|
@ -3952,10 +3968,13 @@ static void ShowDemoWindowTables()
|
|||
ImGui::BulletText("Decoration:");
|
||||
ImGui::Indent();
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_RowBg", (unsigned int*)&flags, ImGuiTableFlags_RowBg);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", (unsigned int*)&flags, ImGuiTableFlags_BordersH);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", (unsigned int*)&flags, ImGuiTableFlags_BordersV);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersFullHeight", (unsigned int*)&flags, ImGuiTableFlags_BordersFullHeight);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersVOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVInner", (unsigned int*)&flags, ImGuiTableFlags_BordersVInner);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", (unsigned int*)&flags, ImGuiTableFlags_BordersH);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHOuter", (unsigned int*)&flags, ImGuiTableFlags_BordersHOuter);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersHInner", (unsigned int*)&flags, ImGuiTableFlags_BordersHInner);
|
||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersVFullHeight", (unsigned int*)&flags, ImGuiTableFlags_BordersVFullHeight);
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::BulletText("Padding, Sizing:");
|
||||
|
|
|
@ -1903,8 +1903,8 @@ struct ImGuiTable
|
|||
ImGuiTableRowFlags LastRowFlags : 16;
|
||||
int RowBgColorCounter; // Counter for alternating background colors (can be fast-forwarded by e.g clipper)
|
||||
ImU32 RowBgColor; // Request for current row background color
|
||||
ImU32 BorderOuterColor;
|
||||
ImU32 BorderInnerColor;
|
||||
ImU32 BorderColorStrong;
|
||||
ImU32 BorderColorLight;
|
||||
float BorderX1;
|
||||
float BorderX2;
|
||||
float CellPaddingX1; // Padding from each borders
|
||||
|
|
|
@ -105,7 +105,7 @@ inline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags)
|
|||
|
||||
// Adjust flags: enforce borders when resizable
|
||||
if (flags & ImGuiTableFlags_Resizable)
|
||||
flags |= ImGuiTableFlags_BordersV;
|
||||
flags |= ImGuiTableFlags_BordersVInner;
|
||||
|
||||
// Adjust flags: disable top rows freezing if there's no scrolling
|
||||
// In theory we could want to assert if ScrollFreeze was set without the corresponding scroll flag, but that would hinder demos.
|
||||
|
@ -232,18 +232,23 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||
PushID(instance_id);
|
||||
}
|
||||
|
||||
const bool has_cell_padding_x = (flags & (ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV)) != 0;
|
||||
ImGuiWindow* inner_window = table->InnerWindow;
|
||||
table->CurrentColumn = -1;
|
||||
table->CurrentRow = -1;
|
||||
table->RowBgColorCounter = 0;
|
||||
table->LastRowFlags = ImGuiTableRowFlags_None;
|
||||
// Borders
|
||||
// - None ........Content..... Pad .....Content........
|
||||
// - VOuter | Pad ..Content..... Pad .....Content.. Pad | // FIXME-TABLE: Not handled properly
|
||||
// - VInner ........Content.. Pad | Pad ..Content........ // FIXME-TABLE: Not handled properly
|
||||
// - VOuter+VInner | Pad ..Content.. Pad | Pad ..Content.. Pad |
|
||||
|
||||
const bool has_cell_padding_x = (flags & ImGuiTableFlags_BordersVOuter) != 0;
|
||||
ImGuiWindow* inner_window = table->InnerWindow;
|
||||
table->CellPaddingX1 = has_cell_padding_x ? g.Style.CellPadding.x + 1.0f : 0.0f;
|
||||
table->CellPaddingX2 = has_cell_padding_x ? g.Style.CellPadding.x : 0.0f;
|
||||
table->CellPaddingY = g.Style.CellPadding.y;
|
||||
table->CellSpacingX = has_cell_padding_x ? 0.0f : g.Style.CellPadding.x;
|
||||
|
||||
table->CurrentColumn = -1;
|
||||
table->CurrentRow = -1;
|
||||
table->RowBgColorCounter = 0;
|
||||
table->LastRowFlags = ImGuiTableRowFlags_None;
|
||||
table->HostClipRect = inner_window->ClipRect;
|
||||
table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;
|
||||
table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width
|
||||
|
@ -265,8 +270,8 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||
// FIXME-TABLE FIXME-STYLE: Using opaque colors facilitate overlapping elements of the grid
|
||||
//table->BorderOuterColor = GetColorU32(ImGuiCol_Separator, 1.00f);
|
||||
//table->BorderInnerColor = GetColorU32(ImGuiCol_Separator, 0.60f);
|
||||
table->BorderOuterColor = GetColorU32(ImVec4(0.31f, 0.31f, 0.35f, 1.00f));
|
||||
table->BorderInnerColor = GetColorU32(ImVec4(0.23f, 0.23f, 0.25f, 1.00f));
|
||||
table->BorderColorStrong = GetColorU32(ImVec4(0.31f, 0.31f, 0.35f, 1.00f));
|
||||
table->BorderColorLight = GetColorU32(ImVec4(0.23f, 0.23f, 0.25f, 1.00f));
|
||||
//table->BorderOuterColor = IM_COL32(255, 0, 0, 255);
|
||||
//table->BorderInnerColor = IM_COL32(255, 255, 0, 255);
|
||||
table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f);
|
||||
|
@ -798,7 +803,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||
// the final height from last frame. Because this is only affecting _interaction_ with columns, it is not really problematic.
|
||||
// (whereas the actual visual will be displayed in EndTable() and using the current frame height)
|
||||
// Actual columns highlight/render will be performed in EndTable() and not be affected.
|
||||
const bool borders_full_height = (table->IsUsingHeaders == false) || (table->Flags & ImGuiTableFlags_BordersFullHeight);
|
||||
const bool borders_full_height = (table->IsUsingHeaders == false) || (table->Flags & ImGuiTableFlags_BordersVFullHeight);
|
||||
const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;
|
||||
const float hit_y1 = table->OuterRect.Min.y;
|
||||
const float hit_y2_full = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight);
|
||||
|
@ -979,6 +984,7 @@ void ImGui::EndTable()
|
|||
g.CurrentTable = g.CurrentTableStack.Size ? g.Tables.GetByIndex(g.CurrentTableStack.back().Index) : NULL;
|
||||
}
|
||||
|
||||
// FIXME-TABLE: This is a mess, need to redesign how we render borders.
|
||||
void ImGui::TableDrawBorders(ImGuiTable* table)
|
||||
{
|
||||
ImGuiWindow* inner_window = table->InnerWindow;
|
||||
|
@ -986,28 +992,29 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|||
table->DrawSplitter.SetCurrentChannel(inner_window->DrawList, 0);
|
||||
if (inner_window->Hidden || !table->HostClipRect.Overlaps(table->InnerClipRect))
|
||||
return;
|
||||
ImDrawList* inner_drawlist = inner_window->DrawList;
|
||||
ImDrawList* outer_drawlist = outer_window->DrawList;
|
||||
|
||||
// Draw inner border and resizing feedback
|
||||
const float draw_y1 = table->OuterRect.Min.y;
|
||||
float draw_y2_base = (table->FreezeRowsCount >= 1 ? table->OuterRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight;
|
||||
float draw_y2_full = table->OuterRect.Max.y;
|
||||
ImU32 border_base_col;
|
||||
if (!table->IsUsingHeaders || (table->Flags & ImGuiTableFlags_BordersFullHeight))
|
||||
if (!table->IsUsingHeaders || (table->Flags & ImGuiTableFlags_BordersVFullHeight))
|
||||
{
|
||||
draw_y2_base = draw_y2_full;
|
||||
border_base_col = table->BorderInnerColor;
|
||||
border_base_col = table->BorderColorLight;
|
||||
}
|
||||
else
|
||||
{
|
||||
border_base_col = table->BorderOuterColor;
|
||||
border_base_col = table->BorderColorStrong;
|
||||
}
|
||||
|
||||
if (table->Flags & ImGuiTableFlags_BordersV)
|
||||
{
|
||||
const bool draw_left_most_border = (table->Flags & ImGuiTableFlags_BordersOuter) == 0;
|
||||
if (draw_left_most_border)
|
||||
inner_window->DrawList->AddLine(ImVec2(table->OuterRect.Min.x, draw_y1), ImVec2(table->OuterRect.Min.x, draw_y2_base), border_base_col, 1.0f);
|
||||
if ((table->Flags & ImGuiTableFlags_BordersVOuter) && (table->InnerWindow == table->OuterWindow))
|
||||
inner_drawlist->AddLine(ImVec2(table->OuterRect.Min.x, draw_y1), ImVec2(table->OuterRect.Min.x, draw_y2_base), border_base_col, 1.0f);
|
||||
|
||||
if (table->Flags & ImGuiTableFlags_BordersVInner)
|
||||
{
|
||||
for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
|
||||
{
|
||||
if (!(table->ActiveMaskByDisplayOrder & ((ImU64)1 << order_n)))
|
||||
|
@ -1017,7 +1024,10 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|||
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||
const bool is_hovered = (table->HoveredColumnBorder == column_n);
|
||||
const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceNo);
|
||||
const bool draw_right_border = (column->MaxX <= table->InnerClipRect.Max.x) || (is_resized || is_hovered);
|
||||
const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
|
||||
bool draw_right_border = (column->MaxX <= table->InnerClipRect.Max.x) || (is_resized || is_hovered);
|
||||
if (column->NextActiveColumn == -1 && !is_resizable)
|
||||
draw_right_border = false;
|
||||
if (draw_right_border && column->MaxX > column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size..
|
||||
{
|
||||
// Draw in outer window so right-most column won't be clipped
|
||||
|
@ -1030,7 +1040,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|||
float draw_y2 = draw_y2_base;
|
||||
if (is_hovered || is_resized || (table->FreezeColumnsCount != -1 && table->FreezeColumnsCount == order_n + 1))
|
||||
draw_y2 = draw_y2_full;
|
||||
inner_window->DrawList->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), col, 1.0f);
|
||||
inner_drawlist->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), col, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1044,16 +1054,28 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|||
// and the part that's over scrollbars in the outer window..)
|
||||
// Either solution currently won't allow us to use a larger border size: the border would clipped.
|
||||
ImRect outer_border = table->OuterRect;
|
||||
const ImU32 outer_col = table->BorderColorStrong;
|
||||
if (inner_window != outer_window)
|
||||
outer_border.Expand(1.0f);
|
||||
outer_window->DrawList->AddRect(outer_border.Min, outer_border.Max, table->BorderOuterColor); // IM_COL32(255, 0, 0, 255));
|
||||
if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter)
|
||||
outer_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col);
|
||||
else if (table->Flags & ImGuiTableFlags_BordersVOuter)
|
||||
{
|
||||
outer_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Min.x, outer_border.Max.y), outer_col);
|
||||
outer_drawlist->AddLine(ImVec2(outer_border.Max.x, outer_border.Min.y), outer_border.Max, outer_col);
|
||||
}
|
||||
else if (table->Flags & ImGuiTableFlags_BordersHOuter)
|
||||
{
|
||||
outer_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Max.x, outer_border.Min.y), outer_col);
|
||||
outer_drawlist->AddLine(ImVec2(outer_border.Min.x, outer_border.Max.y), outer_border.Max, outer_col);
|
||||
}
|
||||
}
|
||||
else if (table->Flags & ImGuiTableFlags_BordersH)
|
||||
if ((table->Flags & ImGuiTableFlags_BordersHInner) && table->RowPosY2 < table->OuterRect.Max.y)
|
||||
{
|
||||
// Draw bottom-most border
|
||||
// Draw bottom-most row border
|
||||
const float border_y = table->RowPosY2;
|
||||
if (border_y >= table->BackgroundClipRect.Min.y && border_y < table->BackgroundClipRect.Max.y)
|
||||
inner_window->DrawList->AddLine(ImVec2(table->BorderX1, border_y), ImVec2(table->BorderX2, border_y), table->BorderOuterColor);
|
||||
inner_drawlist->AddLine(ImVec2(table->BorderX1, border_y), ImVec2(table->BorderX2, border_y), table->BorderColorLight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1451,21 +1473,22 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||
else if (table->Flags & ImGuiTableFlags_RowBg)
|
||||
bg_col = GetColorU32((table->RowBgColorCounter & 1) ? ImGuiCol_TableRowBgAlt : ImGuiCol_TableRowBg);
|
||||
|
||||
// Decide of separating border color
|
||||
// Decide of top border color
|
||||
ImU32 border_col = 0;
|
||||
if (table->CurrentRow != 0 || table->InnerWindow == table->OuterWindow)
|
||||
{
|
||||
if (table->Flags & ImGuiTableFlags_BordersH)
|
||||
if (table->Flags & ImGuiTableFlags_BordersHInner)
|
||||
{
|
||||
if (table->CurrentRow == 0 && table->InnerWindow == table->OuterWindow)
|
||||
border_col = table->BorderOuterColor;
|
||||
else if (!(table->LastRowFlags & ImGuiTableRowFlags_Headers))
|
||||
border_col = table->BorderInnerColor;
|
||||
//if (table->CurrentRow == 0 && table->InnerWindow == table->OuterWindow)
|
||||
// border_col = table->BorderOuterColor;
|
||||
//else
|
||||
if (table->CurrentRow > 0)// && !(table->LastRowFlags & ImGuiTableRowFlags_Headers))
|
||||
border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (table->RowFlags & ImGuiTableRowFlags_Headers)
|
||||
border_col = table->BorderOuterColor;
|
||||
//if (table->RowFlags & ImGuiTableRowFlags_Headers)
|
||||
// border_col = table->BorderOuterColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1491,10 +1514,10 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||
const bool unfreeze_rows = (table->CurrentRow + 1 == table->FreezeRowsCount && table->FreezeRowsCount > 0);
|
||||
|
||||
// Draw bottom border (always strong)
|
||||
const bool draw_separating_border = unfreeze_rows || (table->RowFlags & ImGuiTableRowFlags_Headers);
|
||||
const bool draw_separating_border = unfreeze_rows;// || (table->RowFlags & ImGuiTableRowFlags_Headers);
|
||||
if (draw_separating_border)
|
||||
if (bg_y2 >= table->BackgroundClipRect.Min.y && bg_y2 < table->BackgroundClipRect.Max.y)
|
||||
window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y2), ImVec2(table->BorderX2, bg_y2), table->BorderOuterColor);
|
||||
window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y2), ImVec2(table->BorderX2, bg_y2), table->BorderColorStrong);
|
||||
|
||||
// End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle)
|
||||
// We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and get the new cursor position.
|
||||
|
@ -1801,7 +1824,7 @@ void ImGui::TableAutoHeaders()
|
|||
|
||||
const char* name = TableGetColumnName(column_n);
|
||||
|
||||
// FIXME-TABLE: Test custom user elements
|
||||
// [DEBUG] Test custom user elements
|
||||
#if 0
|
||||
if (column_n < 2)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue