| 3988 | } |
| 3989 | |
| 3990 | void ImGui::NextColumn() |
| 3991 | { |
| 3992 | ImGuiWindow* window = GetCurrentWindow(); |
| 3993 | if (window->SkipItems || window->DC.CurrentColumns == NULL) |
| 3994 | return; |
| 3995 | |
| 3996 | ImGuiContext& g = *GImGui; |
| 3997 | ImGuiOldColumns* columns = window->DC.CurrentColumns; |
| 3998 | |
| 3999 | if (columns->Count == 1) |
| 4000 | { |
| 4001 | window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); |
| 4002 | IM_ASSERT(columns->Current == 0); |
| 4003 | return; |
| 4004 | } |
| 4005 | |
| 4006 | // Next column |
| 4007 | if (++columns->Current == columns->Count) |
| 4008 | columns->Current = 0; |
| 4009 | |
| 4010 | PopItemWidth(); |
| 4011 | |
| 4012 | // Optimization: avoid PopClipRect() + SetCurrentChannel() + PushClipRect() |
| 4013 | // (which would needlessly attempt to update commands in the wrong channel, then pop or overwrite them), |
| 4014 | ImGuiOldColumnData* column = &columns->Columns[columns->Current]; |
| 4015 | SetWindowClipRectBeforeSetChannel(window, column->ClipRect); |
| 4016 | columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1); |
| 4017 | |
| 4018 | const float column_padding = g.Style.ItemSpacing.x; |
| 4019 | columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); |
| 4020 | if (columns->Current > 0) |
| 4021 | { |
| 4022 | // Columns 1+ ignore IndentX (by canceling it out) |
| 4023 | // FIXME-COLUMNS: Unnecessary, could be locked? |
| 4024 | window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding; |
| 4025 | } |
| 4026 | else |
| 4027 | { |
| 4028 | // New row/line: column 0 honor IndentX. |
| 4029 | window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f); |
| 4030 | window->DC.IsSameLine = false; |
| 4031 | columns->LineMinY = columns->LineMaxY; |
| 4032 | } |
| 4033 | window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); |
| 4034 | window->DC.CursorPos.y = columns->LineMinY; |
| 4035 | window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); |
| 4036 | window->DC.CurrLineTextBaseOffset = 0.0f; |
| 4037 | |
| 4038 | // FIXME-COLUMNS: Share code with BeginColumns() - move code on columns setup. |
| 4039 | float offset_0 = GetColumnOffset(columns->Current); |
| 4040 | float offset_1 = GetColumnOffset(columns->Current + 1); |
| 4041 | float width = offset_1 - offset_0; |
| 4042 | PushItemWidth(width * 0.65f); |
| 4043 | window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding; |
| 4044 | } |
| 4045 | |
| 4046 | void ImGui::EndColumns() |
| 4047 | { |
nothing calls this directly
no test coverage detected