Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.
| 858 | |
| 859 | // Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set. |
| 860 | ImRect 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 | |
| 873 | void ImGui::Scrollbar(ImGuiAxis axis) |
| 874 | { |