| 4818 | } |
| 4819 | |
| 4820 | static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size) |
| 4821 | { |
| 4822 | ImGuiContext& g = *GImGui; |
| 4823 | if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) |
| 4824 | { |
| 4825 | // Using -1,-1 on either X/Y axis to preserve the current size. |
| 4826 | ImRect cr = g.NextWindowData.SizeConstraintRect; |
| 4827 | new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x; |
| 4828 | new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y; |
| 4829 | if (g.NextWindowData.SizeCallback) |
| 4830 | { |
| 4831 | ImGuiSizeCallbackData data; |
| 4832 | data.UserData = g.NextWindowData.SizeCallbackUserData; |
| 4833 | data.Pos = window->Pos; |
| 4834 | data.CurrentSize = window->SizeFull; |
| 4835 | data.DesiredSize = new_size; |
| 4836 | g.NextWindowData.SizeCallback(&data); |
| 4837 | new_size = data.DesiredSize; |
| 4838 | } |
| 4839 | new_size.x = IM_FLOOR(new_size.x); |
| 4840 | new_size.y = IM_FLOOR(new_size.y); |
| 4841 | } |
| 4842 | |
| 4843 | // Minimum size |
| 4844 | if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize))) |
| 4845 | { |
| 4846 | ImGuiWindow* window_for_height = window; |
| 4847 | new_size = ImMax(new_size, g.Style.WindowMinSize); |
| 4848 | new_size.y = ImMax(new_size.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows |
| 4849 | } |
| 4850 | return new_size; |
| 4851 | } |
| 4852 | |
| 4853 | static ImVec2 CalcWindowContentSize(ImGuiWindow* window) |
| 4854 | { |
no test coverage detected