mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Internals: Popup related comments. Renamed the misleading internal ClosePopup() function. Added bool* test to BeginPopupModal in demo.
This commit is contained in:
		| @@ -1981,12 +1981,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(); | ||||
| @@ -2115,6 +2116,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"); | ||||
| @@ -2147,7 +2149,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")) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user