MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / GetWindowScrollbarRect

Method GetWindowScrollbarRect

plugins/Cardinal/src/DearImGui/imgui_widgets.cpp:860–871  ·  view source on GitHub ↗

Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.

Source from the content-addressed store, hash-verified

858
859// Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.
860ImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis)
861{
862 const ImRect outer_rect = window->Rect();
863 const ImRect inner_rect = window->InnerRect;
864 const float border_size = window->WindowBorderSize;
865 const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar)
866 IM_ASSERT(scrollbar_size > 0.0f);
867 if (axis == ImGuiAxis_X)
868 return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y);
869 else
870 return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y);
871}
872
873void ImGui::Scrollbar(ImGuiAxis axis)
874{

Callers

nothing calls this directly

Calls 3

ImMaxFunction · 0.85
RectMethod · 0.80
ImRectFunction · 0.70

Tested by

no test coverage detected