mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-07 15:05:47 +01:00
Demo: Add child window labeled border demo.
This commit is contained in:
parent
870a73e70b
commit
0788c6164f
@ -4465,8 +4465,10 @@ static void DemoWindowLayout()
|
||||
HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window.");
|
||||
static bool disable_mouse_wheel = false;
|
||||
static bool disable_menu = false;
|
||||
static bool enable_top_label = false;
|
||||
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
|
||||
ImGui::Checkbox("Disable Menu", &disable_menu);
|
||||
ImGui::Checkbox("Enable Top Label", &enable_top_label);
|
||||
|
||||
// Child 1: no border, enable horizontal scrollbar
|
||||
{
|
||||
@ -4484,12 +4486,15 @@ static void DemoWindowLayout()
|
||||
// Child 2: rounded border
|
||||
{
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_None;
|
||||
ImGuiChildFlags child_flags = ImGuiChildFlags_None;
|
||||
if (disable_mouse_wheel)
|
||||
window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
|
||||
if (!disable_menu)
|
||||
window_flags |= ImGuiWindowFlags_MenuBar;
|
||||
if(enable_top_label)
|
||||
child_flags |= ImGuiChildFlags_TopLabel;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||
ImGui::BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags_Borders, window_flags);
|
||||
ImGui::BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags_Borders | child_flags, window_flags);
|
||||
if (!disable_menu && ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("Menu"))
|
||||
@ -4570,6 +4575,7 @@ static void DemoWindowLayout()
|
||||
ImGui::SameLine(); HelpMarker("Style the child window like a framed item: use FrameBg, FrameRounding, FrameBorderSize, FramePadding instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.");
|
||||
if (child_flags & ImGuiChildFlags_FrameStyle)
|
||||
override_bg_color = false;
|
||||
ImGui::CheckboxFlags("ImGuiChildFlags_TopLabel", &child_flags, ImGuiChildFlags_TopLabel);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (float)offset_x);
|
||||
if (override_bg_color)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user