|
@@ -1383,22 +1383,6 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|
ImGui::EndPopup();
|
|
ImGui::EndPopup();
|
|
}
|
|
}
|
|
|
|
|
|
- ImGui::Spacing();
|
|
|
|
- ImGui::TextWrapped("Below we are testing adding menu items to a regular window. It's rather unusual but should work!");
|
|
|
|
- ImGui::Separator();
|
|
|
|
- // NB: As a quirk in this very specific example, we want to differentiate the parent of this menu from the parent of the various popup menus above.
|
|
|
|
- // To do so we are encloding the items in a PushID()/PopID() block to make them two different menusets. If we don't, opening any popup above and hovering our menu here
|
|
|
|
- // would open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it, which is the desired behavior for regular menus.
|
|
|
|
- ImGui::PushID("foo");
|
|
|
|
- ImGui::MenuItem("Menu item", "CTRL+M");
|
|
|
|
- if (ImGui::BeginMenu("Menu inside a regular window"))
|
|
|
|
- {
|
|
|
|
- ShowExampleMenuFile();
|
|
|
|
- ImGui::EndMenu();
|
|
|
|
- }
|
|
|
|
- ImGui::PopID();
|
|
|
|
- ImGui::Separator();
|
|
|
|
-
|
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1415,7 +1399,9 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|
{
|
|
{
|
|
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
|
if (ImGui::Selectable("Set to zero")) value = 0.0f;
|
|
if (ImGui::Selectable("Set to PI")) value = 3.1415f;
|
|
if (ImGui::Selectable("Set to PI")) value = 3.1415f;
|
|
- ImGui::DragFloat("Value", &value, 0.1f, 0.0f, 0.0f);
|
|
|
|
|
|
+ ImGui::PushItemWidth(-1);
|
|
|
|
+ ImGui::DragFloat("##Value", &value, 0.1f, 0.0f, 0.0f);
|
|
|
|
+ ImGui::PopItemWidth();
|
|
ImGui::EndPopup();
|
|
ImGui::EndPopup();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1485,6 +1471,25 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|
|
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (ImGui::TreeNode("Menus inside a regular window"))
|
|
|
|
+ {
|
|
|
|
+ ImGui::TextWrapped("Below we are testing adding menu items to a regular window. It's rather unusual but should work!");
|
|
|
|
+ ImGui::Separator();
|
|
|
|
+ // NB: As a quirk in this very specific example, we want to differentiate the parent of this menu from the parent of the various popup menus above.
|
|
|
|
+ // To do so we are encloding the items in a PushID()/PopID() block to make them two different menusets. If we don't, opening any popup above and hovering our menu here
|
|
|
|
+ // would open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it, which is the desired behavior for regular menus.
|
|
|
|
+ ImGui::PushID("foo");
|
|
|
|
+ ImGui::MenuItem("Menu item", "CTRL+M");
|
|
|
|
+ if (ImGui::BeginMenu("Menu inside a regular window"))
|
|
|
|
+ {
|
|
|
|
+ ShowExampleMenuFile();
|
|
|
|
+ ImGui::EndMenu();
|
|
|
|
+ }
|
|
|
|
+ ImGui::PopID();
|
|
|
|
+ ImGui::Separator();
|
|
|
|
+ ImGui::TreePop();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (ImGui::CollapsingHeader("Columns"))
|
|
if (ImGui::CollapsingHeader("Columns"))
|