Nav: Exposed NavInitWindow() in imgui_internal (#787)

This commit is contained in:
omar 2017-11-24 16:50:11 +01:00
parent f5c47faee8
commit 4e3c7f1557
2 changed files with 4 additions and 2 deletions

View File

@ -2528,7 +2528,7 @@ int ImGui::GetFrameCount()
} }
// This needs to be called before we submit any widget (aka in or before Begin) // This needs to be called before we submit any widget (aka in or before Begin)
static void NavInitWindow(ImGuiWindow* window, bool force_reinit) void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
IM_ASSERT(window == g.NavWindow); IM_ASSERT(window == g.NavWindow);
@ -4724,7 +4724,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id) if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id)
{ {
ImGui::FocusWindow(child_window); ImGui::FocusWindow(child_window);
NavInitWindow(child_window, false); ImGui::NavInitWindow(child_window, false);
ImGui::SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item ImGui::SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
g.ActiveIdSource = ImGuiInputSource_Nav; g.ActiveIdSource = ImGuiInputSource_Nav;
} }

View File

@ -914,6 +914,8 @@ namespace ImGui
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true); IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate); IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
IMGUI_API void Scrollbar(ImGuiLayoutType direction); IMGUI_API void Scrollbar(ImGuiLayoutType direction);