MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ShowExampleAppAutoResize

Function ShowExampleAppAutoResize

plugins/Cardinal/src/DearImGui/imgui_demo.cpp:7122–7140  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

7120
7121// Demonstrate creating a window which gets auto-resized according to its content.
7122static void ShowExampleAppAutoResize(bool* p_open)
7123{
7124 if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize))
7125 {
7126 ImGui::End();
7127 return;
7128 }
7129 IMGUI_DEMO_MARKER("Examples/Auto-resizing window");
7130
7131 static int lines = 10;
7132 ImGui::TextUnformatted(
7133 "Window will resize every-frame to the size of its content.\n"
7134 "Note that you probably don't want to query the window size to\n"
7135 "output your content because that would create a feedback loop.");
7136 ImGui::SliderInt("Number of lines", &lines, 1, 20);
7137 for (int i = 0; i < lines; i++)
7138 ImGui::Text("%*sThis is line %d", i * 4, "", i); // Pad with space to extend size horizontally
7139 ImGui::End();
7140}
7141
7142//-----------------------------------------------------------------------------
7143// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()

Callers 1

ShowDemoWindowMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected