1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-28 09:30:56 +01:00

ImGuiWindow: Storing ParentWindow (#615, #646)

This commit is contained in:
ocornut 2016-05-10 17:00:42 +02:00
parent a59a04f4d0
commit b630cb5b42
2 changed files with 4 additions and 1 deletions

View File

@ -1641,6 +1641,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
DrawList->_OwnerName = Name;
RootWindow = NULL;
RootNonPopupWindow = NULL;
ParentWindow = NULL;
FocusIdxAllCounter = FocusIdxTabCounter = -1;
FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = IM_INT_MAX;
@ -3759,6 +3760,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
if (!(g.CurrentWindowStack[root_non_popup_idx]->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
break;
window->ParentWindow = parent_window;
window->RootWindow = g.CurrentWindowStack[root_idx];
window->RootNonPopupWindow = g.CurrentWindowStack[root_non_popup_idx]; // This is merely for displaying the TitleBgActive color.

View File

@ -636,7 +636,8 @@ struct IMGUI_API ImGuiWindow
float FontWindowScale; // Scale multiplier per-window
ImDrawList* DrawList;
ImGuiWindow* RootWindow; // If we are a child window, this is pointing to the first non-child parent window. Else point to ourself.
ImGuiWindow* RootNonPopupWindow; // If we are a child widnow, this is pointing to the first non-child non-popup parent window. Else point to ourself.
ImGuiWindow* RootNonPopupWindow; // If we are a child window, this is pointing to the first non-child non-popup parent window. Else point to ourself.
ImGuiWindow* ParentWindow; // If we are a child window, this is pointing to our parent window. Else point to NULL.
// Focus
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()