mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 01:34:32 +00:00 
			
		
		
		
	Added IsRootWindowOrAnyChildHovered() helper (#615)
This commit is contained in:
		
							
								
								
									
										12
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -4579,15 +4579,19 @@ bool ImGui::IsWindowFocused()
 | 
			
		||||
bool ImGui::IsRootWindowFocused()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiState& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* root_window = g.CurrentWindow->RootWindow;
 | 
			
		||||
    return g.FocusedWindow == root_window;
 | 
			
		||||
    return g.FocusedWindow == g.CurrentWindow->RootWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsRootWindowOrAnyChildFocused()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiState& g = *GImGui;
 | 
			
		||||
    ImGuiWindow* root_window = g.CurrentWindow->RootWindow;
 | 
			
		||||
    return g.FocusedWindow && g.FocusedWindow->RootWindow == root_window;
 | 
			
		||||
    return g.FocusedWindow && g.FocusedWindow->RootWindow == g.CurrentWindow->RootWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ImGui::IsRootWindowOrAnyChildHovered()
 | 
			
		||||
{
 | 
			
		||||
    ImGuiState& g = *GImGui;
 | 
			
		||||
    return g.HoveredRootWindow && (g.HoveredRootWindow == g.CurrentWindow->RootWindow) && IsWindowContentHoverable(g.HoveredRootWindow);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float ImGui::GetWindowWidth()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								imgui.h
									
									
									
									
									
								
							@@ -385,8 +385,9 @@ namespace ImGui
 | 
			
		||||
    IMGUI_API void          SetItemAllowOverlap();                                              // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.
 | 
			
		||||
    IMGUI_API bool          IsWindowHovered();                                                  // is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others)
 | 
			
		||||
    IMGUI_API bool          IsWindowFocused();                                                  // is current window focused
 | 
			
		||||
    IMGUI_API bool          IsRootWindowFocused();                                              // is current root window focused (top parent window in case of child windows)
 | 
			
		||||
    IMGUI_API bool          IsRootWindowFocused();                                              // is current root window focused (root = top-most parent of a child, otherwise self)
 | 
			
		||||
    IMGUI_API bool          IsRootWindowOrAnyChildFocused();                                    // is current root window or any of its child (including current window) focused
 | 
			
		||||
    IMGUI_API bool          IsRootWindowOrAnyChildHovered();                                    // is current root window or any of its child (including current window) hovered and hoverable (not blocked by a popup)
 | 
			
		||||
    IMGUI_API bool          IsRectVisible(const ImVec2& size);                                  // test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side (as an optimization)
 | 
			
		||||
    IMGUI_API bool          IsPosHoveringAnyWindow(const ImVec2& pos);                          // is given position hovering any active imgui window
 | 
			
		||||
    IMGUI_API float         GetTime();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user