Clipper: add ForceDisplayRangeByIndices (#3841, #3578)

This partially reverts commit 6a7e2c74fb.
This commit is contained in:
ocornut
2021-11-08 17:16:52 +01:00
parent ebac375791
commit bce1ba400f
4 changed files with 16 additions and 3 deletions

View File

@ -2411,6 +2411,15 @@ void ImGuiListClipper::End()
}
}
void ImGuiListClipper::ForceDisplayRangeByIndices(int item_min, int item_max)
{
ImGuiListClipperData* data = (ImGuiListClipperData*)TempData;
IM_ASSERT(DisplayStart < 0); // Only allowed after Begin() and if there has not been a specified range yet.
IM_ASSERT(item_min <= item_max);
if (item_min < item_max)
data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_min, item_max));
}
bool ImGuiListClipper::Step()
{
ImGuiContext& g = *GImGui;