Docking: Added DockNodeFlagsOverrideSet/DockNodeFlagsOverrideClear (experimental)

This commit is contained in:
omar 2019-11-28 22:42:13 +01:00
parent f1b5c742ff
commit f68075b333
2 changed files with 13 additions and 1 deletions

View File

@ -12313,6 +12313,7 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
DockNodeUpdateVisibleFlagAndInactiveChilds(node->ChildNodes[1]);
// Remove inactive windows
// Merge node flags overrides stored in windows
for (int window_n = 0; window_n < node->Windows.Size; window_n++)
{
ImGuiWindow* window = node->Windows[window_n];
@ -12336,6 +12337,11 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
DockNodeRemoveWindow(node, window, node->ID);
window_n--;
}
else
{
node->LocalFlags &= ~window->WindowClass.DockNodeFlagsOverrideClear;
node->LocalFlags |= window->WindowClass.DockNodeFlagsOverrideSet;
}
}
// Auto-hide tab bar option
@ -12344,6 +12350,10 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
node->WantHiddenTabBarToggle = true;
node->WantHiddenTabBarUpdate = false;
// Cancel toggling if we know our tab bar is enforced to be hidden at all times
if (node->WantHiddenTabBarToggle && node->VisibleWindow && (node->VisibleWindow->WindowClass.DockNodeFlagsOverrideSet & ImGuiDockNodeFlags_HiddenTabBar))
node->WantHiddenTabBarToggle = false;
// Apply toggles at a single point of the frame (here!)
if (node->Windows.Size > 1)
node->LocalFlags &= ~ImGuiDockNodeFlags_HiddenTabBar;

View File

@ -1646,10 +1646,12 @@ struct ImGuiWindowClass
ImGuiID ParentViewportId; // Hint for the platform back-end. If non-zero, the platform back-end can create a parent<>child relationship between the platform windows. Not conforming back-ends are free to e.g. parent every viewport to the main viewport or not.
ImGuiViewportFlags ViewportFlagsOverrideSet; // Viewport flags to set when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
ImGuiViewportFlags ViewportFlagsOverrideClear; // Viewport flags to clear when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
ImGuiDockNodeFlags DockNodeFlagsOverrideSet; // [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
ImGuiDockNodeFlags DockNodeFlagsOverrideClear; // [EXPERIMENTAL]
bool DockingAlwaysTabBar; // Set to true to enforce single floating windows of this class always having their own docking node (equivalent of setting the global io.ConfigDockingAlwaysTabBar)
bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window.
ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideSet = ViewportFlagsOverrideClear = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; }
ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideSet = ViewportFlagsOverrideClear = 0x00; DockNodeFlagsOverrideSet = DockNodeFlagsOverrideClear = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; }
};
// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()