|
|
|
@ -5452,7 +5452,9 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b |
|
|
|
|
const float backup_border_size = g.Style.ChildBorderSize; |
|
|
|
|
if (!border) |
|
|
|
|
g.Style.ChildBorderSize = 0.0f; |
|
|
|
|
bool ret = Begin(temp_window_name, NULL, flags); |
|
|
|
|
|
|
|
|
|
// Begin into window
|
|
|
|
|
const bool ret = Begin(temp_window_name, NULL, flags); |
|
|
|
|
g.Style.ChildBorderSize = backup_border_size; |
|
|
|
|
|
|
|
|
|
ImGuiWindow* child_window = g.CurrentWindow; |
|
|
|
@ -5464,7 +5466,7 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b |
|
|
|
|
parent_window->DC.CursorPos = child_window->Pos; |
|
|
|
|
|
|
|
|
|
// Process navigation-in immediately so NavInit can run on first frame
|
|
|
|
|
// Can enter a child if (A) it has navigatable items or (B) it can be scrolled.
|
|
|
|
|
// Can enter a child if (A) it has navigable items or (B) it can be scrolled.
|
|
|
|
|
const ImGuiID temp_id_for_activation = ImHashStr("##Child", 0, id); |
|
|
|
|
if (g.ActiveId == temp_id_for_activation) |
|
|
|
|
ClearActiveID(); |
|
|
|
@ -5481,26 +5483,26 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b |
|
|
|
|
void ImGui::EndChild() |
|
|
|
|
{ |
|
|
|
|
ImGuiContext& g = *GImGui; |
|
|
|
|
ImGuiWindow* window = g.CurrentWindow; |
|
|
|
|
ImGuiWindow* child_window = g.CurrentWindow; |
|
|
|
|
|
|
|
|
|
IM_ASSERT(g.WithinEndChild == false); |
|
|
|
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
|
|
|
|
|
IM_ASSERT(child_window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
|
|
|
|
|
|
|
|
|
|
g.WithinEndChild = true; |
|
|
|
|
ImVec2 child_size = window->Size; |
|
|
|
|
ImVec2 child_size = child_window->Size; |
|
|
|
|
End(); |
|
|
|
|
if (window->BeginCount == 1) |
|
|
|
|
if (child_window->BeginCount == 1) |
|
|
|
|
{ |
|
|
|
|
ImGuiWindow* parent_window = g.CurrentWindow; |
|
|
|
|
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size); |
|
|
|
|
ItemSize(child_size); |
|
|
|
|
if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavWindowHasScrollY) && !(window->Flags & ImGuiWindowFlags_NavFlattened)) |
|
|
|
|
if ((child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavWindowHasScrollY) && !(child_window->Flags & ImGuiWindowFlags_NavFlattened)) |
|
|
|
|
{ |
|
|
|
|
ItemAdd(bb, window->ChildId); |
|
|
|
|
RenderNavHighlight(bb, window->ChildId); |
|
|
|
|
ItemAdd(bb, child_window->ChildId); |
|
|
|
|
RenderNavHighlight(bb, child_window->ChildId); |
|
|
|
|
|
|
|
|
|
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying)
|
|
|
|
|
if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow) |
|
|
|
|
if (child_window->DC.NavLayersActiveMask == 0 && child_window == g.NavWindow) |
|
|
|
|
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -5509,10 +5511,10 @@ void ImGui::EndChild() |
|
|
|
|
ItemAdd(bb, 0); |
|
|
|
|
|
|
|
|
|
// But when flattened we directly reach items, adjust active layer mask accordingly
|
|
|
|
|
if (window->Flags & ImGuiWindowFlags_NavFlattened) |
|
|
|
|
parent_window->DC.NavLayersActiveMaskNext |= window->DC.NavLayersActiveMaskNext; |
|
|
|
|
if (child_window->Flags & ImGuiWindowFlags_NavFlattened) |
|
|
|
|
parent_window->DC.NavLayersActiveMaskNext |= child_window->DC.NavLayersActiveMaskNext; |
|
|
|
|
} |
|
|
|
|
if (g.HoveredWindow == window) |
|
|
|
|
if (g.HoveredWindow == child_window) |
|
|
|
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow; |
|
|
|
|
} |
|
|
|
|
g.WithinEndChild = false; |
|
|
|
@ -6314,7 +6316,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) |
|
|
|
|
window->IDStack.push_back(window->ID); |
|
|
|
|
|
|
|
|
|
// Add to stack
|
|
|
|
|
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
|
|
|
|
g.CurrentWindow = window; |
|
|
|
|
ImGuiWindowStackData window_stack_data; |
|
|
|
|
window_stack_data.Window = window; |
|
|
|
@ -6332,6 +6333,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Add to focus scope stack
|
|
|
|
|
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
|
|
|
|
PushFocusScope(window->ID); |
|
|
|
|
window->NavRootFocusScopeId = g.CurrentFocusScopeId; |
|
|
|
|
g.CurrentWindow = NULL; |
|
|
|
|