MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / NextColumn

Method NextColumn

ImGUI GLFW Tutorial/imgui/imgui_tables.cpp:3877–3930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3875}
3876
3877void ImGui::NextColumn()
3878{
3879 ImGuiWindow* window = GetCurrentWindow();
3880 if (window->SkipItems || window->DC.CurrentColumns == NULL)
3881 return;
3882
3883 ImGuiContext& g = *GImGui;
3884 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3885
3886 if (columns->Count == 1)
3887 {
3888 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3889 IM_ASSERT(columns->Current == 0);
3890 return;
3891 }
3892
3893 // Next column
3894 if (++columns->Current == columns->Count)
3895 columns->Current = 0;
3896
3897 PopItemWidth();
3898
3899 // Optimization: avoid PopClipRect() + SetCurrentChannel() + PushClipRect()
3900 // (which would needlessly attempt to update commands in the wrong channel, then pop or overwrite them),
3901 ImGuiOldColumnData* column = &columns->Columns[columns->Current];
3902 SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
3903 columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);
3904
3905 const float column_padding = g.Style.ItemSpacing.x;
3906 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
3907 if (columns->Current > 0)
3908 {
3909 // Columns 1+ ignore IndentX (by canceling it out)
3910 // FIXME-COLUMNS: Unnecessary, could be locked?
3911 window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding;
3912 }
3913 else
3914 {
3915 // New row/line: column 0 honor IndentX.
3916 window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3917 columns->LineMinY = columns->LineMaxY;
3918 }
3919 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3920 window->DC.CursorPos.y = columns->LineMinY;
3921 window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
3922 window->DC.CurrLineTextBaseOffset = 0.0f;
3923
3924 // FIXME-COLUMNS: Share code with BeginColumns() - move code on columns setup.
3925 float offset_0 = GetColumnOffset(columns->Current);
3926 float offset_1 = GetColumnOffset(columns->Current + 1);
3927 float width = offset_1 - offset_0;
3928 PushItemWidth(width * 0.65f);
3929 window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
3930}
3931
3932void ImGui::EndColumns()
3933{

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.70
ImMaxFunction · 0.70
ImVec2Function · 0.70
SetCurrentChannelMethod · 0.45

Tested by

no test coverage detected