mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 04:17:00 +00:00
Minor bits. Reduce usage of GImGui multiple times in same function.
This commit is contained in:
parent
92e55a8a79
commit
113b2467cd
14
imgui.cpp
14
imgui.cpp
@ -4058,17 +4058,20 @@ bool ImGui::IsItemClicked(int mouse_button)
|
|||||||
|
|
||||||
bool ImGui::IsAnyItemHovered()
|
bool ImGui::IsAnyItemHovered()
|
||||||
{
|
{
|
||||||
return GImGui->HoveredId != 0 || GImGui->HoveredIdPreviousFrame != 0;
|
ImGuiContext& g = *GImGui;
|
||||||
|
return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::IsAnyItemActive()
|
bool ImGui::IsAnyItemActive()
|
||||||
{
|
{
|
||||||
return GImGui->ActiveId != 0;
|
ImGuiContext& g = *GImGui;
|
||||||
|
return g.ActiveId != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::IsAnyItemFocused()
|
bool ImGui::IsAnyItemFocused()
|
||||||
{
|
{
|
||||||
return GImGui->NavId != 0 && !GImGui->NavDisableHighlight;
|
ImGuiContext& g = *GImGui;
|
||||||
|
return g.NavId != 0 && !g.NavDisableHighlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::IsItemVisible()
|
bool ImGui::IsItemVisible()
|
||||||
@ -4406,6 +4409,7 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
|
|||||||
|
|
||||||
static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
|
static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
|
||||||
{
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
|
ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
|
||||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
|
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
|
||||||
|
|
||||||
@ -4434,12 +4438,12 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|||||||
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
||||||
|
|
||||||
// Process navigation-in immediately so NavInit can run on first frame
|
// Process navigation-in immediately so NavInit can run on first frame
|
||||||
if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveFlags != 0 || child_window->DC.NavHasScroll) && GImGui->NavActivateId == id)
|
if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveFlags != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id)
|
||||||
{
|
{
|
||||||
ImGui::FocusWindow(child_window);
|
ImGui::FocusWindow(child_window);
|
||||||
NavInitWindow(child_window, false);
|
NavInitWindow(child_window, false);
|
||||||
ImGui::SetActiveIDNoNav(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
|
ImGui::SetActiveIDNoNav(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
|
||||||
GImGui->ActiveIdSource = ImGuiInputSource_Nav;
|
g.ActiveIdSource = ImGuiInputSource_Nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user