mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Navigation: Moving NavInitWindow() around and making it static (#323)
This commit is contained in:
parent
b2ad33ce41
commit
4bbdaa4e3c
36
imgui.cpp
36
imgui.cpp
@ -2265,6 +2265,24 @@ int ImGui::GetFrameCount()
|
|||||||
return GImGui->FrameCount;
|
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()
|
static ImVec2 NavCalcPreferredMousePos()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -5059,24 +5077,6 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
g.Windows.push_back(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)
|
void ImGui::PushItemWidth(float item_width)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
|
@ -773,7 +773,6 @@ namespace ImGui
|
|||||||
|
|
||||||
IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing);
|
IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing);
|
||||||
|
|
||||||
IMGUI_API void NavInitWindow(ImGuiWindow* window);
|
|
||||||
IMGUI_API ImVec2 NavGetTweakDelta();
|
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); }
|
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…
Reference in New Issue
Block a user