mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-27 16:29:02 +08:00
Tables: Internals: renamed CellPaddingY to RowCellPaddingY.
This commit is contained in:
parent
bdc4dfebf5
commit
7b5fb33296
@ -2617,6 +2617,7 @@ struct IMGUI_API ImGuiTable
|
||||
float RowPosY1;
|
||||
float RowPosY2;
|
||||
float RowMinHeight; // Height submitted to TableNextRow()
|
||||
float RowCellPaddingY; // Top and bottom padding. Reloaded during row change.
|
||||
float RowTextBaseline;
|
||||
float RowIndentOffsetX;
|
||||
ImGuiTableRowFlags RowFlags : 16; // Current row flags, see ImGuiTableRowFlags_
|
||||
@ -2631,7 +2632,6 @@ struct IMGUI_API ImGuiTable
|
||||
float MinColumnWidth;
|
||||
float OuterPaddingX;
|
||||
float CellPaddingX; // Padding from each borders. Locked in BeginTable()/Layout.
|
||||
float CellPaddingY; // Top and bottom padding. Reloaded during row change.
|
||||
float CellSpacingX1; // Spacing between non-bordered cells. Locked in BeginTable()/Layout.
|
||||
float CellSpacingX2;
|
||||
float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details.
|
||||
|
@ -452,7 +452,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border;
|
||||
table->CellSpacingX2 = inner_spacing_explicit;
|
||||
table->CellPaddingX = inner_padding_explicit;
|
||||
table->CellPaddingY = g.Style.CellPadding.y;
|
||||
|
||||
const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
|
||||
const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f;
|
||||
@ -469,6 +468,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
|
||||
table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
|
||||
table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
|
||||
table->RowCellPaddingY = 0.0f;
|
||||
table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any
|
||||
table->FreezeColumnsRequest = table->FreezeColumnsCount = 0;
|
||||
table->IsUnfrozenRows = true;
|
||||
@ -1745,22 +1745,22 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)
|
||||
|
||||
table->LastRowFlags = table->RowFlags;
|
||||
table->RowFlags = row_flags;
|
||||
table->RowCellPaddingY = g.Style.CellPadding.y;
|
||||
table->RowMinHeight = row_min_height;
|
||||
TableBeginRow(table);
|
||||
|
||||
// We honor min_row_height requested by user, but cannot guarantee per-row maximum height,
|
||||
// because that would essentially require a unique clipping rectangle per-cell.
|
||||
table->RowPosY2 += table->CellPaddingY * 2.0f;
|
||||
table->RowPosY2 += table->RowCellPaddingY * 2.0f;
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);
|
||||
|
||||
// Disable output until user calls TableNextColumn()
|
||||
table->InnerWindow->SkipItems = true;
|
||||
}
|
||||
|
||||
// [Internal] Called by TableNextRow()
|
||||
// [Internal] Only called by TableNextRow()
|
||||
void ImGui::TableBeginRow(ImGuiTable* table)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = table->InnerWindow;
|
||||
IM_ASSERT(!table->IsInsideRow);
|
||||
|
||||
@ -1779,10 +1779,9 @@ void ImGui::TableBeginRow(ImGuiTable* table)
|
||||
table->RowPosY1 = table->RowPosY2 = next_y1;
|
||||
table->RowTextBaseline = 0.0f;
|
||||
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
||||
table->CellPaddingY = g.Style.CellPadding.y;
|
||||
|
||||
window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||
window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->CellPaddingY); // This allows users to call SameLine() to share LineSize between columns.
|
||||
window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->RowCellPaddingY); // This allows users to call SameLine() to share LineSize between columns.
|
||||
window->DC.PrevLineSize = window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); // This allows users to call SameLine() to share LineSize between columns, and to call it from first column too.
|
||||
window->DC.IsSameLine = window->DC.IsSetPos = false;
|
||||
window->DC.CursorMaxPos.y = next_y1;
|
||||
@ -2017,7 +2016,7 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
|
||||
start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.
|
||||
|
||||
window->DC.CursorPos.x = start_x;
|
||||
window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY;
|
||||
window->DC.CursorPos.y = table->RowPosY1 + table->RowCellPaddingY;
|
||||
window->DC.CursorMaxPos.x = window->DC.CursorPos.x;
|
||||
window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT
|
||||
window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x; // PrevLine.y is preserved. This allows users to call SameLine() to share LineSize between columns.
|
||||
@ -2075,7 +2074,7 @@ void ImGui::TableEndCell(ImGuiTable* table)
|
||||
p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;
|
||||
*p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x);
|
||||
if (column->IsEnabled)
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY);
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->RowCellPaddingY);
|
||||
column->ItemWidth = window->DC.ItemWidth;
|
||||
|
||||
// Propagate text baseline for the entire row
|
||||
@ -2957,7 +2956,7 @@ void ImGui::TableHeader(const char* label)
|
||||
// If we already got a row height, there's use that.
|
||||
// FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect?
|
||||
ImRect cell_r = TableGetCellBgRect(table, column_n);
|
||||
float label_height = ImMax(label_size.y, table->RowMinHeight - table->CellPaddingY * 2.0f);
|
||||
float label_height = ImMax(label_size.y, table->RowMinHeight - table->RowCellPaddingY * 2.0f);
|
||||
|
||||
// Calculate ideal size for sort order arrow
|
||||
float w_arrow = 0.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user