Added IsRootWindowOrAnyChildHovered() helper (#615)

This commit is contained in:
ocornut
2016-05-01 12:14:07 +02:00
parent 60d6c6d0e8
commit befe02559a
2 changed files with 10 additions and 5 deletions

View File

@ -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()