MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / SetNavFocusScope

Method SetNavFocusScope

include/imgui/imgui.cpp:8741–8766  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8739}
8740
8741void ImGui::SetNavFocusScope(ImGuiID focus_scope_id)
8742{
8743 ImGuiContext& g = *GImGui;
8744 g.NavFocusScopeId = focus_scope_id;
8745 g.NavFocusRoute.resize(0); // Invalidate
8746 if (focus_scope_id == 0)
8747 return;
8748 IM_ASSERT(g.NavWindow != NULL);
8749
8750 // Store current path (in reverse order)
8751 if (focus_scope_id == g.CurrentFocusScopeId)
8752 {
8753 // Top of focus stack contains local focus scopes inside current window
8754 for (int n = g.FocusScopeStack.Size - 1; n >= 0 && g.FocusScopeStack.Data[n].WindowID == g.CurrentWindow->ID; n--)
8755 g.NavFocusRoute.push_back(g.FocusScopeStack.Data[n]);
8756 }
8757 else if (focus_scope_id == g.NavWindow->NavRootFocusScopeId)
8758 g.NavFocusRoute.push_back({ focus_scope_id, g.NavWindow->ID });
8759 else
8760 return;
8761
8762 // Then follow on manually set ParentWindowForFocusRoute field (#6798)
8763 for (ImGuiWindow* window = g.NavWindow->ParentWindowForFocusRoute; window != NULL; window = window->ParentWindowForFocusRoute)
8764 g.NavFocusRoute.push_back({ window->NavRootFocusScopeId, window->ID });
8765 IM_ASSERT(g.NavFocusRoute.Size < 100); // Maximum depth is technically 251 as per CalcRoutingScore(): 254 - 3
8766}
8767
8768// Focus = move navigation cursor, set scrolling, set focus window.
8769void ImGui::FocusItem()

Callers

nothing calls this directly

Calls 2

resizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected