MCPcopy Create free account
hub / github.com/AlexandreRouma/SDRPlusPlus / ShowExampleAppAutoResize

Function ShowExampleAppAutoResize

core/src/imgui/imgui_demo.cpp:7008–7025  ·  view source on GitHub ↗

Demonstrate creating a window which gets auto-resized according to its content.

Source from the content-addressed store, hash-verified

7006
7007// Demonstrate creating a window which gets auto-resized according to its content.
7008static void ShowExampleAppAutoResize(bool* p_open)
7009{
7010 if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize))
7011 {
7012 ImGui::End();
7013 return;
7014 }
7015
7016 static int lines = 10;
7017 ImGui::TextUnformatted(
7018 "Window will resize every-frame to the size of its content.\n"
7019 "Note that you probably don't want to query the window size to\n"
7020 "output your content because that would create a feedback loop.");
7021 ImGui::SliderInt("Number of lines", &lines, 1, 20);
7022 for (int i = 0; i < lines; i++)
7023 ImGui::Text("%*sThis is line %d", i * 4, "", i); // Pad with space to extend size horizontally
7024 ImGui::End();
7025}
7026
7027//-----------------------------------------------------------------------------
7028// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 2

BeginFunction · 0.85
EndFunction · 0.85

Tested by

no test coverage detected