mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Internals: Nav: Extracted code into IsWindowNavFocusable(). (#787)
This commit is contained in:
parent
bdd868704f
commit
8cc2dbc3bd
14
imgui.cpp
14
imgui.cpp
@ -2669,11 +2669,8 @@ static ImGuiWindow* FindWindowNavigable(int i_start, int i_stop, int dir) // FIX
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = i_start; i >= 0 && i < g.Windows.Size && i != i_stop; i += dir)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[i];
|
||||
if (window->Active && window == window->RootNonPopupWindow && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow))
|
||||
return window;
|
||||
}
|
||||
if (ImGui::IsWindowNavFocusable(g.Windows[i]))
|
||||
return g.Windows[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -6650,6 +6647,13 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
||||
}
|
||||
}
|
||||
|
||||
// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)
|
||||
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
return window->Active && window == window->RootNonPopupWindow && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
||||
}
|
||||
|
||||
float ImGui::GetWindowWidth()
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
|
@ -1001,6 +1001,7 @@ namespace ImGui
|
||||
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
||||
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||
|
||||
IMGUI_API void Initialize();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user