mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 06:46:36 +00:00
Docking: added comments. added experimental TabItemFlagsOverrideSet to ImGuiWindowClass.
(Could probably do something similar with TabBarFlagsOverrideSet+Clear for #2700 later.)
This commit is contained in:
parent
388ca563db
commit
9e4956d86b
49
imgui.cpp
49
imgui.cpp
@ -11930,6 +11930,50 @@ void ImGui::DestroyPlatformWindows()
|
|||||||
// Docking: Settings
|
// Docking: Settings
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Typical Docking call flow: (root level is generally public API):
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// - NewFrame() new dear imgui frame
|
||||||
|
// | DockContextUpdateUndocking() - process queued undocking requests
|
||||||
|
// | - DockContextProcessUndockWindow() - process one window undocking request
|
||||||
|
// | - DockContextProcessUndockNode() - process one whole node undocking request
|
||||||
|
// | DockContextUpdateDocking() - process queue docking requests, create floating dock nodes
|
||||||
|
// | - update g.HoveredDockNode - [debug] update node hovered by mouse
|
||||||
|
// | - DockContextProcessDock() - process one docking request
|
||||||
|
// | - DockNodeUpdate()
|
||||||
|
// | - DockNodeUpdateForRootNode()
|
||||||
|
// | - DockNodeUpdateVisibleFlagAndInactiveChilds()
|
||||||
|
// | - DockNodeFindInfo()
|
||||||
|
// | - destroy unused node or tab bar
|
||||||
|
// | - create dock node host window
|
||||||
|
// | - Begin() etc.
|
||||||
|
// | - DockNodeStartMouseMovingWindow()
|
||||||
|
// | - DockNodeTreeUpdatePosSize()
|
||||||
|
// | - DockNodeTreeUpdateSplitter()
|
||||||
|
// | - draw node background
|
||||||
|
// | - DockNodeUpdateTabBar() - create/update tab bar for a docking node
|
||||||
|
// | - DockNodeAddTabBar()
|
||||||
|
// | - DockNodeUpdateWindowMenu()
|
||||||
|
// | - DockNodeCalcTabBarLayout()
|
||||||
|
// | - BeginTabBarEx()
|
||||||
|
// | - TabItemEx() calls
|
||||||
|
// | - EndTabBar()
|
||||||
|
// | - BeginDockableDragDropTarget()
|
||||||
|
// | - DockNodeUpdate() - recurse into child nodes...
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// - DockSpace() user submit a dockspace into a window
|
||||||
|
// | Begin(Child) - create a child window
|
||||||
|
// | DockNodeUpdate() - call main dock node update function
|
||||||
|
// | End(Child)
|
||||||
|
// | ItemSize()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// - Begin()
|
||||||
|
// | BeginDocked()
|
||||||
|
// | BeginDockableDragDropSource()
|
||||||
|
// | BeginDockableDragDropTarget()
|
||||||
|
// | - DockNodePreviewDockRender()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Docking: Internal Types
|
// Docking: Internal Types
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -12191,7 +12235,9 @@ void ImGui::DockContextUpdateDocking(ImGuiContext* ctx)
|
|||||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
|
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Store hovered dock node. We could in theory use DockNodeTreeFindVisibleNodeByPos() on the root host dock node, but using ->DockNode is a good shortcut.
|
// [DEBUG] Store hovered dock node.
|
||||||
|
// We could in theory use DockNodeTreeFindVisibleNodeByPos() on the root host dock node, but using ->DockNode is a good shortcut.
|
||||||
|
// Note this is mostly a debug thing and isn't actually used for docking target, because docking involve more detailed filtering.
|
||||||
g.HoveredDockNode = NULL;
|
g.HoveredDockNode = NULL;
|
||||||
if (ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow)
|
if (ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow)
|
||||||
{
|
{
|
||||||
@ -13582,6 +13628,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
|||||||
if (window->LastFrameActive + 1 >= g.FrameCount || !node_was_active)
|
if (window->LastFrameActive + 1 >= g.FrameCount || !node_was_active)
|
||||||
{
|
{
|
||||||
ImGuiTabItemFlags tab_item_flags = 0;
|
ImGuiTabItemFlags tab_item_flags = 0;
|
||||||
|
tab_item_flags |= window->WindowClass.TabItemFlagsOverrideSet;
|
||||||
if (window->Flags & ImGuiWindowFlags_UnsavedDocument)
|
if (window->Flags & ImGuiWindowFlags_UnsavedDocument)
|
||||||
tab_item_flags |= ImGuiTabItemFlags_UnsavedDocument;
|
tab_item_flags |= ImGuiTabItemFlags_UnsavedDocument;
|
||||||
if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)
|
if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)
|
||||||
|
3
imgui.h
3
imgui.h
@ -1995,12 +1995,13 @@ struct ImGuiWindowClass
|
|||||||
ImGuiID ParentViewportId; // Hint for the platform backend. If non-zero, the platform backend can create a parent<>child relationship between the platform windows. Not conforming backends are free to e.g. parent every viewport to the main viewport or not.
|
ImGuiID ParentViewportId; // Hint for the platform backend. If non-zero, the platform backend can create a parent<>child relationship between the platform windows. Not conforming backends 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 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.
|
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.
|
||||||
|
ImGuiTabItemFlags TabItemFlagsOverrideSet; // [EXPERIMENTAL] TabItem flags to set when a window of this class gets submitted into a dock node tab bar. May use with ImGuiTabItemFlags_Leading or ImGuiTabItemFlags_Trailing.
|
||||||
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 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]
|
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 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. // FIXME-DOCK: Move to DockNodeFlags override?
|
bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window. // FIXME-DOCK: Move to DockNodeFlags override?
|
||||||
|
|
||||||
ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideSet = ViewportFlagsOverrideClear = 0x00; DockNodeFlagsOverrideSet = DockNodeFlagsOverrideClear = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; }
|
ImGuiWindowClass() { memset(this, 0, sizeof(*this)); DockingAllowUnclassed = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()
|
// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload()
|
||||||
|
@ -1253,7 +1253,7 @@ struct ImGuiDockContext
|
|||||||
ImVector<ImGuiDockRequest> Requests;
|
ImVector<ImGuiDockRequest> Requests;
|
||||||
ImVector<ImGuiDockNodeSettings> NodesSettings;
|
ImVector<ImGuiDockNodeSettings> NodesSettings;
|
||||||
bool WantFullRebuild;
|
bool WantFullRebuild;
|
||||||
ImGuiDockContext() { WantFullRebuild = false; }
|
ImGuiDockContext() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifdef IMGUI_HAS_DOCK
|
#endif // #ifdef IMGUI_HAS_DOCK
|
||||||
|
Loading…
Reference in New Issue
Block a user