Merge branch 'master' into docking

# Conflicts:
#	imgui.cpp
This commit is contained in:
omar
2018-12-14 18:46:24 +01:00
5 changed files with 75 additions and 58 deletions

View File

@ -2025,12 +2025,13 @@ static void ShowDemoWindowPopups()
if (!ImGui::CollapsingHeader("Popups & Modal windows"))
return;
// Popups are windows with a few special properties:
// The properties of popups windows are:
// - They block normal mouse hovering detection outside them. (*)
// - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
// - Their visibility state (~bool) is held internally by imgui instead of being held by the programmer as we are used to with regular Begin() calls.
// User can manipulate the visibility state by calling OpenPopup().
// (*) One can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even when normally blocked by a popup.
// Those three properties are intimately connected. The library needs to hold their visibility state because it can close popups at any time.
// Those three properties are connected. The library needs to hold their visibility state because it can close popups at any time.
// Typical use for regular windows:
// bool my_tool_is_active = false; if (ImGui::Button("Open")) my_tool_is_active = true; [...] if (my_tool_is_active) Begin("My Tool", &my_tool_is_active) { [...] } End();
@ -2159,6 +2160,7 @@ static void ShowDemoWindowPopups()
if (ImGui::Button("Delete.."))
ImGui::OpenPopup("Delete?");
if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n");
@ -2191,7 +2193,11 @@ static void ShowDemoWindowPopups()
if (ImGui::Button("Add another modal.."))
ImGui::OpenPopup("Stacked 2");
if (ImGui::BeginPopupModal("Stacked 2"))
// Also demonstrate passing a bool* to BeginPopupModal(), this will create a regular close button which will close the popup.
// Note that the visibility state of popups is owned by imgui, so the input value of the bool actually doesn't matter here.
bool dummy_open = true;
if (ImGui::BeginPopupModal("Stacked 2", &dummy_open))
{
ImGui::Text("Hello from Stacked The Second!");
if (ImGui::Button("Close"))