mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
This commit is contained in:
parent
11638fdf7d
commit
a528398c77
31
imgui.cpp
31
imgui.cpp
@ -5286,6 +5286,27 @@ static void ApplyWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settin
|
||||
window->Collapsed = settings->Collapsed;
|
||||
}
|
||||
|
||||
static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, ImGuiWindowFlags new_flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiWindowFlags old_flags = window->Flags;
|
||||
const bool child_flag_changed = (new_flags & ImGuiWindowFlags_ChildWindow) != (old_flags & ImGuiWindowFlags_ChildWindow);
|
||||
|
||||
if ((just_created || child_flag_changed) && !(new_flags & ImGuiWindowFlags_ChildWindow))
|
||||
{
|
||||
g.WindowsFocusOrder.push_back(window);
|
||||
window->FocusOrder = (short)(g.WindowsFocusOrder.Size - 1);
|
||||
}
|
||||
else if (child_flag_changed && (new_flags & ImGuiWindowFlags_ChildWindow))
|
||||
{
|
||||
IM_ASSERT(g.WindowsFocusOrder[window->FocusOrder] == window);
|
||||
for (int n = window->FocusOrder + 1; n < g.WindowsFocusOrder.Size; n++)
|
||||
g.WindowsFocusOrder[n]->FocusOrder--;
|
||||
g.WindowsFocusOrder.erase(g.WindowsFocusOrder.Data + window->FocusOrder);
|
||||
window->FocusOrder = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -5325,16 +5346,12 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags)
|
||||
window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0);
|
||||
}
|
||||
|
||||
if (!(flags & ImGuiWindowFlags_ChildWindow))
|
||||
{
|
||||
g.WindowsFocusOrder.push_back(window);
|
||||
window->FocusOrder = (short)(g.WindowsFocusOrder.Size - 1);
|
||||
}
|
||||
|
||||
if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus)
|
||||
g.Windows.push_front(window); // Quite slow but rare and only once
|
||||
else
|
||||
g.Windows.push_back(window);
|
||||
UpdateWindowInFocusOrderList(window, true, window->Flags);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@ -5934,6 +5951,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
const bool window_just_created = (window == NULL);
|
||||
if (window_just_created)
|
||||
window = CreateNewWindow(name, flags);
|
||||
else
|
||||
UpdateWindowInFocusOrderList(window, window_just_created, flags);
|
||||
|
||||
// Automatically disable manual moving/resizing when NoInputs is set
|
||||
if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs)
|
||||
|
2
imgui.h
2
imgui.h
@ -64,7 +64,7 @@ Index of this file:
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||
#define IMGUI_VERSION "1.86 WIP"
|
||||
#define IMGUI_VERSION_NUM 18519
|
||||
#define IMGUI_VERSION_NUM 18520
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user