Browse Source

ImGuiWindow: Storing ParentWindow (#615, #646)

pull/663/head
ocornut 9 years ago
parent
commit
b630cb5b42
  1. 2
      imgui.cpp
  2. 3
      imgui_internal.h

2
imgui.cpp

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

3
imgui_internal.h

@ -636,7 +636,8 @@ struct IMGUI_API ImGuiWindow
float FontWindowScale; // Scale multiplier per-window float FontWindowScale; // Scale multiplier per-window
ImDrawList* DrawList; 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* 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 // Focus
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister() int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()

Loading…
Cancel
Save