Demo: Tweaked the Child demos, added a menu bar to the second child to test some navigation functions.

This commit is contained in:
omar 2018-01-31 19:13:20 +01:00
parent 9c8fb804ed
commit dbdbf01b9f

View File

@ -1051,9 +1051,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
if (ImGui::TreeNode("Child regions")) if (ImGui::TreeNode("Child regions"))
{ {
static bool disable_mouse_wheel = false; static bool disable_mouse_wheel = false;
static bool disable_menu = false;
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
ImGui::Checkbox("Disable Menu", &disable_menu);
ImGui::Text("Without border");
static int line = 50; static int line = 50;
bool goto_line = ImGui::Button("Goto"); bool goto_line = ImGui::Button("Goto");
ImGui::SameLine(); ImGui::SameLine();
@ -1080,8 +1081,16 @@ void ImGui::ShowDemoWindow(bool* p_open)
// Child 2: rounded border // Child 2: rounded border
{ {
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar));
ImGui::Text("With border"); if (!disable_menu && ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("Menu"))
{
ShowExampleMenuFile();
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::Columns(2); ImGui::Columns(2);
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {