MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / CalcWindowContentSizes

Function CalcWindowContentSizes

ImGUI GLFW Tutorial/imgui/imgui.cpp:5210–5228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5208}
5209
5210static void CalcWindowContentSizes(ImGuiWindow* window, ImVec2* content_size_current, ImVec2* content_size_ideal)
5211{
5212 bool preserve_old_content_sizes = false;
5213 if (window->Collapsed && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
5214 preserve_old_content_sizes = true;
5215 else if (window->Hidden && window->HiddenFramesCannotSkipItems == 0 && window->HiddenFramesCanSkipItems > 0)
5216 preserve_old_content_sizes = true;
5217 if (preserve_old_content_sizes)
5218 {
5219 *content_size_current = window->ContentSize;
5220 *content_size_ideal = window->ContentSizeIdeal;
5221 return;
5222 }
5223
5224 content_size_current->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_FLOOR(window->DC.CursorMaxPos.x - window->DC.CursorStartPos.x);
5225 content_size_current->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_FLOOR(window->DC.CursorMaxPos.y - window->DC.CursorStartPos.y);
5226 content_size_ideal->x = (window->ContentSizeExplicit.x != 0.0f) ? window->ContentSizeExplicit.x : IM_FLOOR(ImMax(window->DC.CursorMaxPos.x, window->DC.IdealMaxPos.x) - window->DC.CursorStartPos.x);
5227 content_size_ideal->y = (window->ContentSizeExplicit.y != 0.0f) ? window->ContentSizeExplicit.y : IM_FLOOR(ImMax(window->DC.CursorMaxPos.y, window->DC.IdealMaxPos.y) - window->DC.CursorStartPos.y);
5228}
5229
5230static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_contents)
5231{

Callers 2

BeginMethod · 0.70

Calls 1

ImMaxFunction · 0.70

Tested by

no test coverage detected