MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / NextColumn

Method NextColumn

extern/imgui/imgui_tables.cpp:3933–3987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3931}
3932
3933void ImGui::NextColumn()
3934{
3935 ImGuiWindow* window = GetCurrentWindow();
3936 if (window->SkipItems || window->DC.CurrentColumns == NULL)
3937 return;
3938
3939 ImGuiContext& g = *GImGui;
3940 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3941
3942 if (columns->Count == 1)
3943 {
3944 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3945 IM_ASSERT(columns->Current == 0);
3946 return;
3947 }
3948
3949 // Next column
3950 if (++columns->Current == columns->Count)
3951 columns->Current = 0;
3952
3953 PopItemWidth();
3954
3955 // Optimization: avoid PopClipRect() + SetCurrentChannel() + PushClipRect()
3956 // (which would needlessly attempt to update commands in the wrong channel, then pop or overwrite them),
3957 ImGuiOldColumnData* column = &columns->Columns[columns->Current];
3958 SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
3959 columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);
3960
3961 const float column_padding = g.Style.ItemSpacing.x;
3962 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
3963 if (columns->Current > 0)
3964 {
3965 // Columns 1+ ignore IndentX (by canceling it out)
3966 // FIXME-COLUMNS: Unnecessary, could be locked?
3967 window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding;
3968 }
3969 else
3970 {
3971 // New row/line: column 0 honor IndentX.
3972 window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3973 window->DC.IsSameLine = false;
3974 columns->LineMinY = columns->LineMaxY;
3975 }
3976 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3977 window->DC.CursorPos.y = columns->LineMinY;
3978 window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
3979 window->DC.CurrLineTextBaseOffset = 0.0f;
3980
3981 // FIXME-COLUMNS: Share code with BeginColumns() - move code on columns setup.
3982 float offset_0 = GetColumnOffset(columns->Current);
3983 float offset_1 = GetColumnOffset(columns->Current + 1);
3984 float width = offset_1 - offset_0;
3985 PushItemWidth(width * 0.65f);
3986 window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
3987}
3988
3989void ImGui::EndColumns()
3990{

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImMaxFunction · 0.85
ImVec2Function · 0.85
SetCurrentChannelMethod · 0.80

Tested by

no test coverage detected