mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Internals: rename ImGuiNextWindowData::Flags to HasFlags for consistency and to reduce mistakes.
This commit is contained in:
		
							
								
								
									
										52
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -6068,7 +6068,7 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, I | |||||||
|     // A SetNextWindowSize() call always has priority (#8020) |     // A SetNextWindowSize() call always has priority (#8020) | ||||||
|     // (since the code in Begin() never supported SizeVal==0.0f aka auto-resize via SetNextWindowSize() call, we don't support it here for now) |     // (since the code in Begin() never supported SizeVal==0.0f aka auto-resize via SetNextWindowSize() call, we don't support it here for now) | ||||||
|     // FIXME: We only support ImGuiCond_Always in this path. Supporting other paths would requires to obtain window pointer. |     // FIXME: We only support ImGuiCond_Always in this path. Supporting other paths would requires to obtain window pointer. | ||||||
|     if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) != 0 && (g.NextWindowData.SizeCond & ImGuiCond_Always) != 0) |     if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) != 0 && (g.NextWindowData.SizeCond & ImGuiCond_Always) != 0) | ||||||
|     { |     { | ||||||
|         if (g.NextWindowData.SizeVal.x > 0.0f) |         if (g.NextWindowData.SizeVal.x > 0.0f) | ||||||
|         { |         { | ||||||
| @@ -6084,11 +6084,11 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, I | |||||||
|     SetNextWindowSize(size); |     SetNextWindowSize(size); | ||||||
|  |  | ||||||
|     // Forward child flags (we allow prior settings to merge but it'll only work for adding flags) |     // Forward child flags (we allow prior settings to merge but it'll only work for adding flags) | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasChildFlags) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasChildFlags) | ||||||
|         g.NextWindowData.ChildFlags |= child_flags; |         g.NextWindowData.ChildFlags |= child_flags; | ||||||
|     else |     else | ||||||
|         g.NextWindowData.ChildFlags = child_flags; |         g.NextWindowData.ChildFlags = child_flags; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasChildFlags; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasChildFlags; | ||||||
|  |  | ||||||
|     // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value. |     // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value. | ||||||
|     // FIXME: 2023/11/14: commented out shorted version. We had an issue with multiple ### in child window path names, which the trailing hash helped workaround. |     // FIXME: 2023/11/14: commented out shorted version. We had an issue with multiple ### in child window path names, which the trailing hash helped workaround. | ||||||
| @@ -6302,7 +6302,7 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& s | |||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     ImVec2 new_size = size_desired; |     ImVec2 new_size = size_desired; | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSizeConstraint) | ||||||
|     { |     { | ||||||
|         // See comments in SetNextWindowSizeConstraints() for details about setting size_min an size_max. |         // See comments in SetNextWindowSizeConstraints() for details about setting size_min an size_max. | ||||||
|         ImRect cr = g.NextWindowData.SizeConstraintRect; |         ImRect cr = g.NextWindowData.SizeConstraintRect; | ||||||
| @@ -6780,7 +6780,7 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar | |||||||
|             ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window)); |             ImU32 bg_col = GetColorU32(GetWindowBgColorIdx(window)); | ||||||
|             bool override_alpha = false; |             bool override_alpha = false; | ||||||
|             float alpha = 1.0f; |             float alpha = 1.0f; | ||||||
|             if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasBgAlpha) |             if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasBgAlpha) | ||||||
|             { |             { | ||||||
|                 alpha = g.NextWindowData.BgAlphaVal; |                 alpha = g.NextWindowData.BgAlphaVal; | ||||||
|                 override_alpha = true; |                 override_alpha = true; | ||||||
| @@ -6950,7 +6950,7 @@ void ImGui::UpdateWindowSkipRefresh(ImGuiWindow* window) | |||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     window->SkipRefresh = false; |     window->SkipRefresh = false; | ||||||
|     if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasRefreshPolicy) == 0) |     if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasRefreshPolicy) == 0) | ||||||
|         return; |         return; | ||||||
|     if (g.NextWindowData.RefreshFlagsVal & ImGuiWindowRefreshFlags_TryToAvoidRefresh) |     if (g.NextWindowData.RefreshFlagsVal & ImGuiWindowRefreshFlags_TryToAvoidRefresh) | ||||||
|     { |     { | ||||||
| @@ -7031,7 +7031,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | |||||||
|     { |     { | ||||||
|         UpdateWindowInFocusOrderList(window, window_just_created, flags); |         UpdateWindowInFocusOrderList(window, window_just_created, flags); | ||||||
|         window->Flags = (ImGuiWindowFlags)flags; |         window->Flags = (ImGuiWindowFlags)flags; | ||||||
|         window->ChildFlags = (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasChildFlags) ? g.NextWindowData.ChildFlags : 0; |         window->ChildFlags = (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasChildFlags) ? g.NextWindowData.ChildFlags : 0; | ||||||
|         window->LastFrameActive = current_frame; |         window->LastFrameActive = current_frame; | ||||||
|         window->LastTimeActive = (float)g.Time; |         window->LastTimeActive = (float)g.Time; | ||||||
|         window->BeginOrderWithinParent = 0; |         window->BeginOrderWithinParent = 0; | ||||||
| @@ -7095,7 +7095,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | |||||||
|     // (FIXME: Consider splitting the HasXXX flags into X/Y components |     // (FIXME: Consider splitting the HasXXX flags into X/Y components | ||||||
|     bool window_pos_set_by_api = false; |     bool window_pos_set_by_api = false; | ||||||
|     bool window_size_x_set_by_api = false, window_size_y_set_by_api = false; |     bool window_size_x_set_by_api = false, window_size_y_set_by_api = false; | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasPos) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasPos) | ||||||
|     { |     { | ||||||
|         window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0; |         window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0; | ||||||
|         if (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f) |         if (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f) | ||||||
| @@ -7111,7 +7111,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | |||||||
|             SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond); |             SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) | ||||||
|     { |     { | ||||||
|         window_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f); |         window_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f); | ||||||
|         window_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f); |         window_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f); | ||||||
| @@ -7121,7 +7121,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | |||||||
|             g.NextWindowData.SizeVal.y = window->SizeFull.y; |             g.NextWindowData.SizeVal.y = window->SizeFull.y; | ||||||
|         SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond); |         SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond); | ||||||
|     } |     } | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasScroll) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasScroll) | ||||||
|     { |     { | ||||||
|         if (g.NextWindowData.ScrollVal.x >= 0.0f) |         if (g.NextWindowData.ScrollVal.x >= 0.0f) | ||||||
|         { |         { | ||||||
| @@ -7134,13 +7134,13 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) | |||||||
|             window->ScrollTargetCenterRatio.y = 0.0f; |             window->ScrollTargetCenterRatio.y = 0.0f; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasContentSize) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasContentSize) | ||||||
|         window->ContentSizeExplicit = g.NextWindowData.ContentSizeVal; |         window->ContentSizeExplicit = g.NextWindowData.ContentSizeVal; | ||||||
|     else if (first_begin_of_the_frame) |     else if (first_begin_of_the_frame) | ||||||
|         window->ContentSizeExplicit = ImVec2(0.0f, 0.0f); |         window->ContentSizeExplicit = ImVec2(0.0f, 0.0f); | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasCollapsed) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasCollapsed) | ||||||
|         SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond); |         SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond); | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasFocus) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasFocus) | ||||||
|         FocusWindow(window); |         FocusWindow(window); | ||||||
|     if (window->Appearing) |     if (window->Appearing) | ||||||
|         SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false); |         SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false); | ||||||
| @@ -8223,7 +8223,7 @@ void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pi | |||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. |     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasPos; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasPos; | ||||||
|     g.NextWindowData.PosVal = pos; |     g.NextWindowData.PosVal = pos; | ||||||
|     g.NextWindowData.PosPivotVal = pivot; |     g.NextWindowData.PosPivotVal = pivot; | ||||||
|     g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always; |     g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always; | ||||||
| @@ -8233,7 +8233,7 @@ void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond) | |||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. |     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSize; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasSize; | ||||||
|     g.NextWindowData.SizeVal = size; |     g.NextWindowData.SizeVal = size; | ||||||
|     g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always; |     g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always; | ||||||
| } | } | ||||||
| @@ -8245,7 +8245,7 @@ void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond) | |||||||
| void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data) | void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasSizeConstraint; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasSizeConstraint; | ||||||
|     g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max); |     g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max); | ||||||
|     g.NextWindowData.SizeCallback = custom_callback; |     g.NextWindowData.SizeCallback = custom_callback; | ||||||
|     g.NextWindowData.SizeCallbackUserData = custom_callback_user_data; |     g.NextWindowData.SizeCallbackUserData = custom_callback_user_data; | ||||||
| @@ -8256,14 +8256,14 @@ void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& s | |||||||
| void ImGui::SetNextWindowContentSize(const ImVec2& size) | void ImGui::SetNextWindowContentSize(const ImVec2& size) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasContentSize; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasContentSize; | ||||||
|     g.NextWindowData.ContentSizeVal = ImTrunc(size); |     g.NextWindowData.ContentSizeVal = ImTrunc(size); | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGui::SetNextWindowScroll(const ImVec2& scroll) | void ImGui::SetNextWindowScroll(const ImVec2& scroll) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasScroll; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasScroll; | ||||||
|     g.NextWindowData.ScrollVal = scroll; |     g.NextWindowData.ScrollVal = scroll; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -8271,7 +8271,7 @@ void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond) | |||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. |     IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasCollapsed; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasCollapsed; | ||||||
|     g.NextWindowData.CollapsedVal = collapsed; |     g.NextWindowData.CollapsedVal = collapsed; | ||||||
|     g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always; |     g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always; | ||||||
| } | } | ||||||
| @@ -8279,7 +8279,7 @@ void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond) | |||||||
| void ImGui::SetNextWindowBgAlpha(float alpha) | void ImGui::SetNextWindowBgAlpha(float alpha) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasBgAlpha; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasBgAlpha; | ||||||
|     g.NextWindowData.BgAlphaVal = alpha; |     g.NextWindowData.BgAlphaVal = alpha; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -8287,7 +8287,7 @@ void ImGui::SetNextWindowBgAlpha(float alpha) | |||||||
| void ImGui::SetNextWindowRefreshPolicy(ImGuiWindowRefreshFlags flags) | void ImGui::SetNextWindowRefreshPolicy(ImGuiWindowRefreshFlags flags) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasRefreshPolicy; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasRefreshPolicy; | ||||||
|     g.NextWindowData.RefreshFlagsVal = flags; |     g.NextWindowData.RefreshFlagsVal = flags; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -11301,7 +11301,7 @@ bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext | |||||||
|         // See FindBestWindowPosForPopup() for positionning logic of other tooltips (not drag and drop ones). |         // See FindBestWindowPosForPopup() for positionning logic of other tooltips (not drag and drop ones). | ||||||
|         //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; |         //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; | ||||||
|         const bool is_touchscreen = (g.IO.MouseSource == ImGuiMouseSource_TouchScreen); |         const bool is_touchscreen = (g.IO.MouseSource == ImGuiMouseSource_TouchScreen); | ||||||
|         if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasPos) == 0) |         if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasPos) == 0) | ||||||
|         { |         { | ||||||
|             ImVec2 tooltip_pos = is_touchscreen ? (g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_TOUCH * g.Style.MouseCursorScale) : (g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_MOUSE * g.Style.MouseCursorScale); |             ImVec2 tooltip_pos = is_touchscreen ? (g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_TOUCH * g.Style.MouseCursorScale) : (g.IO.MousePos + TOOLTIP_DEFAULT_OFFSET_MOUSE * g.Style.MouseCursorScale); | ||||||
|             ImVec2 tooltip_pivot = is_touchscreen ? TOOLTIP_DEFAULT_PIVOT_TOUCH : ImVec2(0.0f, 0.0f); |             ImVec2 tooltip_pivot = is_touchscreen ? TOOLTIP_DEFAULT_PIVOT_TOUCH : ImVec2(0.0f, 0.0f); | ||||||
| @@ -11724,7 +11724,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags fla | |||||||
|     // Center modal windows by default for increased visibility |     // Center modal windows by default for increased visibility | ||||||
|     // (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves) |     // (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves) | ||||||
|     // FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window. |     // FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window. | ||||||
|     if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasPos) == 0) |     if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasPos) == 0) | ||||||
|     { |     { | ||||||
|         const ImGuiViewport* viewport = GetMainViewport(); |         const ImGuiViewport* viewport = GetMainViewport(); | ||||||
|         SetNextWindowPos(viewport->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f)); |         SetNextWindowPos(viewport->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f)); | ||||||
| @@ -12017,7 +12017,7 @@ void ImGui::SetWindowFocus(const char* name) | |||||||
| void ImGui::SetNextWindowFocus() | void ImGui::SetNextWindowFocus() | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     g.NextWindowData.Flags |= ImGuiNextWindowDataFlags_HasFocus; |     g.NextWindowData.HasFlags |= ImGuiNextWindowDataFlags_HasFocus; | ||||||
| } | } | ||||||
|  |  | ||||||
| // Similar to IsWindowHovered() | // Similar to IsWindowHovered() | ||||||
| @@ -16548,7 +16548,7 @@ static void ShowDebugLogFlag(const char* name, ImGuiDebugLogFlags flags) | |||||||
| void ImGui::ShowDebugLogWindow(bool* p_open) | void ImGui::ShowDebugLogWindow(bool* p_open) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0) |     if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) == 0) | ||||||
|         SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver); |         SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver); | ||||||
|     if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1) |     if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1) | ||||||
|     { |     { | ||||||
| @@ -16868,7 +16868,7 @@ static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_f | |||||||
| void ImGui::ShowIDStackToolWindow(bool* p_open) | void ImGui::ShowIDStackToolWindow(bool* p_open) | ||||||
| { | { | ||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0) |     if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) == 0) | ||||||
|         SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver); |         SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver); | ||||||
|     if (!Begin("Dear ImGui ID Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1) |     if (!Begin("Dear ImGui ID Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -1201,7 +1201,9 @@ enum ImGuiNextWindowDataFlags_ | |||||||
| // Storage for SetNexWindow** functions | // Storage for SetNexWindow** functions | ||||||
| struct ImGuiNextWindowData | struct ImGuiNextWindowData | ||||||
| { | { | ||||||
|     ImGuiNextWindowDataFlags    Flags; |     ImGuiNextWindowDataFlags    HasFlags; | ||||||
|  |  | ||||||
|  |     // Members below are NOT cleared. Always rely on HasFlags. | ||||||
|     ImGuiCond                   PosCond; |     ImGuiCond                   PosCond; | ||||||
|     ImGuiCond                   SizeCond; |     ImGuiCond                   SizeCond; | ||||||
|     ImGuiCond                   CollapsedCond; |     ImGuiCond                   CollapsedCond; | ||||||
| @@ -1220,7 +1222,7 @@ struct ImGuiNextWindowData | |||||||
|     ImGuiWindowRefreshFlags     RefreshFlagsVal; |     ImGuiWindowRefreshFlags     RefreshFlagsVal; | ||||||
|  |  | ||||||
|     ImGuiNextWindowData()       { memset(this, 0, sizeof(*this)); } |     ImGuiNextWindowData()       { memset(this, 0, sizeof(*this)); } | ||||||
|     inline void ClearFlags()    { Flags = ImGuiNextWindowDataFlags_None; } |     inline void ClearFlags()    { HasFlags = ImGuiNextWindowDataFlags_None; } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| enum ImGuiNextItemDataFlags_ | enum ImGuiNextItemDataFlags_ | ||||||
| @@ -1237,7 +1239,8 @@ struct ImGuiNextItemData | |||||||
| { | { | ||||||
|     ImGuiNextItemDataFlags      HasFlags;           // Called HasFlags instead of Flags to avoid mistaking this |     ImGuiNextItemDataFlags      HasFlags;           // Called HasFlags instead of Flags to avoid mistaking this | ||||||
|     ImGuiItemFlags              ItemFlags;          // Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData. |     ImGuiItemFlags              ItemFlags;          // Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData. | ||||||
|     // Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem() |  | ||||||
|  |     // Members below are NOT cleared by ItemAdd() meaning they are still valid during e.g. NavProcessItem(). Always rely on HasFlags. | ||||||
|     ImGuiID                     FocusScopeId;       // Set by SetNextItemSelectionUserData() |     ImGuiID                     FocusScopeId;       // Set by SetNextItemSelectionUserData() | ||||||
|     ImGuiSelectionUserData      SelectionUserData;  // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values) |     ImGuiSelectionUserData      SelectionUserData;  // Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values) | ||||||
|     float                       Width;              // Set by SetNextItemWidth() |     float                       Width;              // Set by SetNextItemWidth() | ||||||
|   | |||||||
| @@ -415,7 +415,7 @@ bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG | |||||||
|  |  | ||||||
|         // Reset scroll if we are reactivating it |         // Reset scroll if we are reactivating it | ||||||
|         if ((previous_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0) |         if ((previous_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0) | ||||||
|             if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasScroll) == 0) |             if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasScroll) == 0) | ||||||
|                 SetNextWindowScroll(ImVec2(0.0f, 0.0f)); |                 SetNextWindowScroll(ImVec2(0.0f, 0.0f)); | ||||||
|  |  | ||||||
|         // Create scrolling region (without border and zero window padding) |         // Create scrolling region (without border and zero window padding) | ||||||
|   | |||||||
| @@ -1829,7 +1829,7 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF | |||||||
|     ImGuiContext& g = *GImGui; |     ImGuiContext& g = *GImGui; | ||||||
|     ImGuiWindow* window = GetCurrentWindow(); |     ImGuiWindow* window = GetCurrentWindow(); | ||||||
|  |  | ||||||
|     ImGuiNextWindowDataFlags backup_next_window_data_flags = g.NextWindowData.Flags; |     ImGuiNextWindowDataFlags backup_next_window_data_flags = g.NextWindowData.HasFlags; | ||||||
|     g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values |     g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values | ||||||
|     if (window->SkipItems) |     if (window->SkipItems) | ||||||
|         return false; |         return false; | ||||||
| @@ -1898,7 +1898,7 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF | |||||||
|     if (!popup_open) |     if (!popup_open) | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|     g.NextWindowData.Flags = backup_next_window_data_flags; |     g.NextWindowData.HasFlags = backup_next_window_data_flags; | ||||||
|     return BeginComboPopup(popup_id, bb, flags); |     return BeginComboPopup(popup_id, bb, flags); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1913,7 +1913,7 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags | |||||||
|  |  | ||||||
|     // Set popup size |     // Set popup size | ||||||
|     float w = bb.GetWidth(); |     float w = bb.GetWidth(); | ||||||
|     if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) |     if (g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSizeConstraint) | ||||||
|     { |     { | ||||||
|         g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w); |         g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w); | ||||||
|     } |     } | ||||||
| @@ -1927,9 +1927,9 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags | |||||||
|         else if (flags & ImGuiComboFlags_HeightSmall)  popup_max_height_in_items = 4; |         else if (flags & ImGuiComboFlags_HeightSmall)  popup_max_height_in_items = 4; | ||||||
|         else if (flags & ImGuiComboFlags_HeightLarge)  popup_max_height_in_items = 20; |         else if (flags & ImGuiComboFlags_HeightLarge)  popup_max_height_in_items = 20; | ||||||
|         ImVec2 constraint_min(0.0f, 0.0f), constraint_max(FLT_MAX, FLT_MAX); |         ImVec2 constraint_min(0.0f, 0.0f), constraint_max(FLT_MAX, FLT_MAX); | ||||||
|         if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.x <= 0.0f) // Don't apply constraints if user specified a size |         if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.x <= 0.0f) // Don't apply constraints if user specified a size | ||||||
|             constraint_min.x = w; |             constraint_min.x = w; | ||||||
|         if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.y <= 0.0f) |         if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.y <= 0.0f) | ||||||
|             constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items); |             constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items); | ||||||
|         SetNextWindowSizeConstraints(constraint_min, constraint_max); |         SetNextWindowSizeConstraints(constraint_min, constraint_max); | ||||||
|     } |     } | ||||||
| @@ -2061,7 +2061,7 @@ bool ImGui::Combo(const char* label, int* current_item, const char* (*getter)(vo | |||||||
|         preview_value = getter(user_data, *current_item); |         preview_value = getter(user_data, *current_item); | ||||||
|  |  | ||||||
|     // The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here. |     // The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here. | ||||||
|     if (popup_max_height_in_items != -1 && !(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)) |     if (popup_max_height_in_items != -1 && !(g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSizeConstraint)) | ||||||
|         SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); |         SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); | ||||||
|  |  | ||||||
|     if (!BeginCombo(label, preview_value, ImGuiComboFlags_None)) |     if (!BeginCombo(label, preview_value, ImGuiComboFlags_None)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut