| 7286 | } |
| 7287 | |
| 7288 | bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags) |
| 7289 | { |
| 7290 | IM_ASSERT((flags & ~ImGuiHoveredFlags_AllowedMaskForIsWindowHovered) == 0 && "Invalid flags for IsWindowHovered()!"); |
| 7291 | |
| 7292 | ImGuiContext& g = *GImGui; |
| 7293 | ImGuiWindow* ref_window = g.HoveredWindow; |
| 7294 | ImGuiWindow* cur_window = g.CurrentWindow; |
| 7295 | if (ref_window == NULL) |
| 7296 | return false; |
| 7297 | |
| 7298 | if ((flags & ImGuiHoveredFlags_AnyWindow) == 0) |
| 7299 | { |
| 7300 | IM_ASSERT(cur_window); // Not inside a Begin()/End() |
| 7301 | const bool popup_hierarchy = (flags & ImGuiHoveredFlags_NoPopupHierarchy) == 0; |
| 7302 | if (flags & ImGuiHoveredFlags_RootWindow) |
| 7303 | cur_window = GetCombinedRootWindow(cur_window, popup_hierarchy); |
| 7304 | |
| 7305 | bool result; |
| 7306 | if (flags & ImGuiHoveredFlags_ChildWindows) |
| 7307 | result = IsWindowChildOf(ref_window, cur_window, popup_hierarchy); |
| 7308 | else |
| 7309 | result = (ref_window == cur_window); |
| 7310 | if (!result) |
| 7311 | return false; |
| 7312 | } |
| 7313 | |
| 7314 | if (!IsWindowContentHoverable(ref_window, flags)) |
| 7315 | return false; |
| 7316 | if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) |
| 7317 | if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != ref_window->MoveId) |
| 7318 | return false; |
| 7319 | |
| 7320 | // When changing hovered window we requires a bit of stationary delay before activating hover timer. |
| 7321 | // FIXME: We don't support delay other than stationary one for now, other delay would need a way |
| 7322 | // to fullfill the possibility that multiple IsWindowHovered() with varying flag could return true |
| 7323 | // for different windows of the hierarchy. Possibly need a Hash(Current+Flags) ==> (Timer) cache. |
| 7324 | // We can implement this for _Stationary because the data is linked to HoveredWindow rather than CurrentWindow. |
| 7325 | if (flags & ImGuiHoveredFlags_ForTooltip) |
| 7326 | flags |= g.Style.HoverFlagsForTooltipMouse; |
| 7327 | if ((flags & ImGuiHoveredFlags_Stationary) != 0 && g.HoverWindowUnlockedStationaryId != ref_window->ID) |
| 7328 | return false; |
| 7329 | |
| 7330 | return true; |
| 7331 | } |
| 7332 | |
| 7333 | bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags) |
| 7334 | { |
nothing calls this directly
no test coverage detected