MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / SetCursorPosYAndSetupDummyPrevLine

Function SetCursorPosYAndSetupDummyPrevLine

lib/imgui/imgui.cpp:2173–2186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2171}
2172
2173static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)
2174{
2175 // Set cursor position and a few other things so that SetScrollHereY() and Columns() can work when seeking cursor.
2176 // FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue.
2177 // The clipper should probably have a 4th step to display the last item in a regular manner.
2178 ImGuiContext& g = *GImGui;
2179 ImGuiWindow* window = g.CurrentWindow;
2180 window->DC.CursorPos.y = pos_y;
2181 window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, pos_y);
2182 window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height; // Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage.
2183 window->DC.PrevLineSize.y = (line_height - g.Style.ItemSpacing.y); // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.
2184 if (ImGuiColumns* columns = window->DC.CurrentColumns)
2185 columns->LineMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly
2186}
2187
2188// Use case A: Begin() called from constructor with items_height<0, then called again from Sync() in StepNo 1
2189// Use case B: Begin() called from constructor with items_height>0

Callers 2

BeginMethod · 0.85
EndMethod · 0.85

Calls 1

ImMaxFunction · 0.85

Tested by

no test coverage detected