Browse Source

Navigation: Moving NavInitWindow() around and making it static (#323)

pull/1608/head
ocornut 8 years ago
parent
commit
4bbdaa4e3c
  1. 36
      imgui.cpp
  2. 1
      imgui_internal.h

36
imgui.cpp

@ -2265,6 +2265,24 @@ int ImGui::GetFrameCount()
return GImGui->FrameCount;
}
// This needs to be called before we submit any widget (aka in or before Begin)
static void NavInitWindow(ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
if (!(window->Flags & ImGuiWindowFlags_ChildWindow) || (window->Flags & ImGuiWindowFlags_Popup) || (window->NavLastId == 0))
{
g.NavId = window->NavLastId = 0;
g.NavInitDefaultRequest = true;
g.NavInitDefaultResultExplicit = false;
g.NavInitDefaultResultId = 0;
}
else
{
g.NavId = window->NavLastId;
}
g.NavWindow = window;
}
static ImVec2 NavCalcPreferredMousePos()
{
ImGuiContext& g = *GImGui;
@ -5059,24 +5077,6 @@ void ImGui::FocusWindow(ImGuiWindow* window)
g.Windows.push_back(window);
}
// This needs to be called before we submit any widget (aka in or before Begin)
void ImGui::NavInitWindow(ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
if (!(window->Flags & ImGuiWindowFlags_ChildWindow) || (window->Flags & ImGuiWindowFlags_Popup) || (window->NavLastId == 0))
{
g.NavId = window->NavLastId = 0;
g.NavInitDefaultRequest = true;
g.NavInitDefaultResultExplicit = false;
g.NavInitDefaultResultId = 0;
}
else
{
g.NavId = window->NavLastId;
}
g.NavWindow = window;
}
void ImGui::PushItemWidth(float item_width)
{
ImGuiWindow* window = GetCurrentWindow();

1
imgui_internal.h

@ -773,7 +773,6 @@ namespace ImGui
IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing);
IMGUI_API void NavInitWindow(ImGuiWindow* window);
IMGUI_API ImVec2 NavGetTweakDelta();
inline IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul) { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * alpha_mul; return ImGui::ColorConvertFloat4ToU32(c); }

Loading…
Cancel
Save