| 12869 | } |
| 12870 | |
| 12871 | void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) |
| 12872 | { |
| 12873 | ImGuiContext& g = *GImGui; |
| 12874 | IM_ASSERT(id != 0); |
| 12875 | |
| 12876 | if (g.NavWindow != window) |
| 12877 | SetNavWindow(window); |
| 12878 | |
| 12879 | // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and g.CurrentFocusScopeId are valid. |
| 12880 | // Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text) |
| 12881 | const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent; |
| 12882 | g.NavId = id; |
| 12883 | g.NavLayer = nav_layer; |
| 12884 | SetNavFocusScope(g.CurrentFocusScopeId); |
| 12885 | window->NavLastIds[nav_layer] = id; |
| 12886 | if (g.LastItemData.ID == id) |
| 12887 | window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect); |
| 12888 | |
| 12889 | if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) |
| 12890 | g.NavHighlightItemUnderNav = true; |
| 12891 | else if (g.IO.ConfigNavCursorVisibleAuto) |
| 12892 | g.NavCursorVisible = false; |
| 12893 | |
| 12894 | // Clear preferred scoring position (NavMoveRequestApplyResult() will tend to restore it) |
| 12895 | NavClearPreferredPosForAxis(ImGuiAxis_X); |
| 12896 | NavClearPreferredPosForAxis(ImGuiAxis_Y); |
| 12897 | } |
| 12898 | |
| 12899 | static ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy) |
| 12900 | { |
nothing calls this directly
no test coverage detected