MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ShowDemoWindowLayout

Function ShowDemoWindowLayout

lib/imgui/imgui_demo.cpp:1775–2465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1773}
1774
1775static void ShowDemoWindowLayout()
1776{
1777 if (!ImGui::CollapsingHeader("Layout"))
1778 return;
1779
1780 if (ImGui::TreeNode("Child windows"))
1781 {
1782 HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window.");
1783 static bool disable_mouse_wheel = false;
1784 static bool disable_menu = false;
1785 ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
1786 ImGui::Checkbox("Disable Menu", &disable_menu);
1787
1788 static int line = 50;
1789 bool goto_line = ImGui::Button("Goto");
1790 ImGui::SameLine();
1791 ImGui::SetNextItemWidth(100);
1792 goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
1793
1794 // Child 1: no border, enable horizontal scrollbar
1795 {
1796 ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0);
1797 ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags);
1798 for (int i = 0; i < 100; i++)
1799 {
1800 ImGui::Text("%04d: scrollable region", i);
1801 if (goto_line && line == i)
1802 ImGui::SetScrollHereY();
1803 }
1804 if (goto_line && line >= 100)
1805 ImGui::SetScrollHereY();
1806 ImGui::EndChild();
1807 }
1808
1809 ImGui::SameLine();
1810
1811 // Child 2: rounded border
1812 {
1813 ImGuiWindowFlags window_flags = (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar);
1814 ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
1815 ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags);
1816 if (!disable_menu && ImGui::BeginMenuBar())
1817 {
1818 if (ImGui::BeginMenu("Menu"))
1819 {
1820 ShowExampleMenuFile();
1821 ImGui::EndMenu();
1822 }
1823 ImGui::EndMenuBar();
1824 }
1825 ImGui::Columns(2);
1826 for (int i = 0; i < 100; i++)
1827 {
1828 char buf[32];
1829 sprintf(buf, "%03d", i);
1830 ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));
1831 ImGui::NextColumn();
1832 }

Callers 1

ShowDemoWindowMethod · 0.85

Calls 6

HelpMarkerFunction · 0.85
ImVec2Class · 0.85
ShowExampleMenuFileFunction · 0.85
ImVec4Class · 0.85
AddRectFilledMethod · 0.80
AddTextMethod · 0.80

Tested by

no test coverage detected