| 5814 | } |
| 5815 | |
| 5816 | static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window) |
| 5817 | { |
| 5818 | // We give windows non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups) |
| 5819 | // FIXME: Essentially we want to restrict manual resizing to WindowMinSize+Decoration, and allow api resizing to be smaller. |
| 5820 | // Perhaps should tend further a neater test for this. |
| 5821 | ImGuiContext& g = *GImGui; |
| 5822 | ImVec2 size_min; |
| 5823 | if ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) |
| 5824 | { |
| 5825 | size_min.x = (window->ChildFlags & ImGuiChildFlags_ResizeX) ? g.Style.WindowMinSize.x : 4.0f; |
| 5826 | size_min.y = (window->ChildFlags & ImGuiChildFlags_ResizeY) ? g.Style.WindowMinSize.y : 4.0f; |
| 5827 | } |
| 5828 | else |
| 5829 | { |
| 5830 | size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f; |
| 5831 | size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.y : 4.0f; |
| 5832 | } |
| 5833 | |
| 5834 | // Reduce artifacts with very small windows |
| 5835 | ImGuiWindow* window_for_height = window; |
| 5836 | size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight + window_for_height->MenuBarHeight + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); |
| 5837 | return size_min; |
| 5838 | } |
| 5839 | |
| 5840 | static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& size_desired) |
| 5841 | { |
no test coverage detected