Demonstrate creating a window which gets auto-resized according to its content.
| 7006 | |
| 7007 | // Demonstrate creating a window which gets auto-resized according to its content. |
| 7008 | static 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() |
no test coverage detected