MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / ShowDemoWindow

Method ShowDemoWindow

imgui_tiny_app/imgui/imgui_demo.cpp:351–724  ·  view source on GitHub ↗

Demonstrate most Dear ImGui features (this is big function!) You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature.

Source from the content-addressed store, hash-verified

349// You may execute this function to experiment with the UI and understand what it does.
350// You may then search for keywords in the code when you are interested by a specific feature.
351void ImGui::ShowDemoWindow(bool* p_open)
352{
353 // Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
354 // Most functions would normally just assert/crash if the context is missing.
355 IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!");
356
357 // Verify ABI compatibility between caller code and compiled version of Dear ImGui. This helps detects some build issues.
358 IMGUI_CHECKVERSION();
359
360 // Stored data
361 static ImGuiDemoWindowData demo_data;
362
363 // Examples Apps (accessible from the "Examples" menu)
364 if (demo_data.ShowMainMenuBar) { ShowExampleAppMainMenuBar(); }
365 if (demo_data.ShowAppDockSpace) { ShowExampleAppDockSpace(&demo_data.ShowAppDockSpace); } // Important: Process the Docking app first, as explicit DockSpace() nodes needs to be submitted early (read comments near the DockSpace function)
366 if (demo_data.ShowAppDocuments) { ShowExampleAppDocuments(&demo_data.ShowAppDocuments); } // ...process the Document app next, as it may also use a DockSpace()
367 if (demo_data.ShowAppAssetsBrowser) { ShowExampleAppAssetsBrowser(&demo_data.ShowAppAssetsBrowser); }
368 if (demo_data.ShowAppConsole) { ShowExampleAppConsole(&demo_data.ShowAppConsole); }
369 if (demo_data.ShowAppCustomRendering) { ShowExampleAppCustomRendering(&demo_data.ShowAppCustomRendering); }
370 if (demo_data.ShowAppLog) { ShowExampleAppLog(&demo_data.ShowAppLog); }
371 if (demo_data.ShowAppLayout) { ShowExampleAppLayout(&demo_data.ShowAppLayout); }
372 if (demo_data.ShowAppPropertyEditor) { ShowExampleAppPropertyEditor(&demo_data.ShowAppPropertyEditor, &demo_data); }
373 if (demo_data.ShowAppSimpleOverlay) { ShowExampleAppSimpleOverlay(&demo_data.ShowAppSimpleOverlay); }
374 if (demo_data.ShowAppAutoResize) { ShowExampleAppAutoResize(&demo_data.ShowAppAutoResize); }
375 if (demo_data.ShowAppConstrainedResize) { ShowExampleAppConstrainedResize(&demo_data.ShowAppConstrainedResize); }
376 if (demo_data.ShowAppFullscreen) { ShowExampleAppFullscreen(&demo_data.ShowAppFullscreen); }
377 if (demo_data.ShowAppLongText) { ShowExampleAppLongText(&demo_data.ShowAppLongText); }
378 if (demo_data.ShowAppWindowTitles) { ShowExampleAppWindowTitles(&demo_data.ShowAppWindowTitles); }
379
380 // Dear ImGui Tools (accessible from the "Tools" menu)
381 if (demo_data.ShowMetrics) { ImGui::ShowMetricsWindow(&demo_data.ShowMetrics); }
382 if (demo_data.ShowDebugLog) { ImGui::ShowDebugLogWindow(&demo_data.ShowDebugLog); }
383 if (demo_data.ShowIDStackTool) { ImGui::ShowIDStackToolWindow(&demo_data.ShowIDStackTool); }
384 if (demo_data.ShowAbout) { ImGui::ShowAboutWindow(&demo_data.ShowAbout); }
385 if (demo_data.ShowStyleEditor)
386 {
387 ImGui::Begin("Dear ImGui Style Editor", &demo_data.ShowStyleEditor);
388 ImGui::ShowStyleEditor();
389 ImGui::End();
390 }
391
392 // Demonstrate the various window flags. Typically you would just use the default!
393 static bool no_titlebar = false;
394 static bool no_scrollbar = false;
395 static bool no_menu = false;
396 static bool no_move = false;
397 static bool no_resize = false;
398 static bool no_collapse = false;
399 static bool no_close = false;
400 static bool no_nav = false;
401 static bool no_background = false;
402 static bool no_bring_to_front = false;
403 static bool no_docking = false;
404 static bool unsaved_document = false;
405
406 ImGuiWindowFlags window_flags = 0;
407 if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
408 if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;

Callers

nothing calls this directly

Calls 15

ShowExampleAppDockSpaceFunction · 0.85
ShowExampleAppDocumentsFunction · 0.85
ShowExampleAppConsoleFunction · 0.85
ShowExampleAppLogFunction · 0.85
ShowExampleAppLayoutFunction · 0.85
ShowExampleAppAutoResizeFunction · 0.85

Tested by

no test coverage detected