mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Internals: Renaming. Renamed ImGuiPopupRef to ImGuiPopupData for consistency and added constructor.
This commit is contained in:
17
imgui.cpp
17
imgui.cpp
@ -1068,6 +1068,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb
|
||||
static ImVec2 NavCalcPreferredRefPos();
|
||||
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
||||
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
||||
static int FindWindowFocusIndex(ImGuiWindow* window);
|
||||
|
||||
// Misc
|
||||
static void UpdateMouseInputs();
|
||||
@ -3602,7 +3603,7 @@ void ImGui::NewFrame()
|
||||
|
||||
// Closing the focused window restore focus to the first active root window in descending z-order
|
||||
if (g.NavWindow && !g.NavWindow->WasActive)
|
||||
FocusPreviousWindowIgnoringOne(NULL);
|
||||
FocusTopMostWindowIgnoringOne(NULL);
|
||||
|
||||
// No window should be open at the beginning of the frame.
|
||||
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
||||
@ -5002,7 +5003,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
|
||||
if (flags & ImGuiWindowFlags_Popup)
|
||||
{
|
||||
ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
||||
ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
||||
window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed
|
||||
window_just_activated_by_user |= (window != popup_ref.Window);
|
||||
}
|
||||
@ -5035,7 +5036,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
CheckStacksSize(window, true);
|
||||
if (flags & ImGuiWindowFlags_Popup)
|
||||
{
|
||||
ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
||||
ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size];
|
||||
popup_ref.Window = window;
|
||||
g.BeginPopupStack.push_back(popup_ref);
|
||||
window->PopupId = popup_ref.PopupId;
|
||||
@ -5724,7 +5725,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
||||
BringWindowToDisplayFront(window);
|
||||
}
|
||||
|
||||
void ImGui::FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window)
|
||||
void ImGui::FocusTopMostWindowIgnoringOne(ImGuiWindow* ignore_window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = g.WindowsFocusOrder.Size - 1; i >= 0; i--)
|
||||
@ -6944,7 +6945,7 @@ void ImGui::OpenPopupEx(ImGuiID id)
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* parent_window = g.CurrentWindow;
|
||||
int current_stack_size = g.BeginPopupStack.Size;
|
||||
ImGuiPopupRef popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
|
||||
ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
|
||||
popup_ref.PopupId = id;
|
||||
popup_ref.Window = NULL;
|
||||
popup_ref.ParentWindow = parent_window;
|
||||
@ -7008,7 +7009,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
|
||||
// Find the highest popup which is a descendant of the reference window (generally reference window = NavWindow)
|
||||
for (; popup_count_to_keep < g.OpenPopupStack.Size; popup_count_to_keep++)
|
||||
{
|
||||
ImGuiPopupRef& popup = g.OpenPopupStack[popup_count_to_keep];
|
||||
ImGuiPopupData& popup = g.OpenPopupStack[popup_count_to_keep];
|
||||
if (!popup.Window)
|
||||
continue;
|
||||
IM_ASSERT((popup.Window->Flags & ImGuiWindowFlags_Popup) != 0);
|
||||
@ -8129,7 +8130,7 @@ static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
static int FindWindowFocusIndex(ImGuiWindow* window) // FIXME-OPT O(N)
|
||||
static int ImGui::FindWindowFocusIndex(ImGuiWindow* window) // FIXME-OPT O(N)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = g.WindowsFocusOrder.Size-1; i >= 0; i--)
|
||||
@ -8154,7 +8155,7 @@ static void NavUpdateWindowingHighlightWindow(int focus_change_dir)
|
||||
if (g.NavWindowingTarget->Flags & ImGuiWindowFlags_Modal)
|
||||
return;
|
||||
|
||||
const int i_current = FindWindowFocusIndex(g.NavWindowingTarget);
|
||||
const int i_current = ImGui::FindWindowFocusIndex(g.NavWindowingTarget);
|
||||
ImGuiWindow* window_target = FindWindowNavFocusable(i_current + focus_change_dir, -INT_MAX, focus_change_dir);
|
||||
if (!window_target)
|
||||
window_target = FindWindowNavFocusable((focus_change_dir < 0) ? (g.WindowsFocusOrder.Size - 1) : 0, i_current, focus_change_dir);
|
||||
|
Reference in New Issue
Block a user