mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Added ImGuiDockNodeFlags_AutoHideTabBar. (#2109)
This commit is contained in:
parent
2ccc6d2ed1
commit
86d3bba157
11
imgui.cpp
11
imgui.cpp
@ -10743,7 +10743,7 @@ ImGuiDockNode::ImGuiDockNode(ImGuiID id)
|
||||
InitFromFirstWindowPosSize = InitFromFirstWindowViewport = false;
|
||||
IsVisible = true;
|
||||
IsFocused = IsCentralNode = IsHiddenTabBar = HasCloseButton = HasCollapseButton = false;
|
||||
WantCloseAll = WantLockSizeOnce = WantMouseMove = WantHiddenTabBarToggle = false;
|
||||
WantCloseAll = WantLockSizeOnce = WantMouseMove = WantHiddenTabBarUpdate = WantHiddenTabBarToggle = false;
|
||||
}
|
||||
|
||||
ImGuiDockNode::~ImGuiDockNode()
|
||||
@ -10774,6 +10774,7 @@ static void ImGui::DockNodeAddWindow(ImGuiDockNode* node, ImGuiWindow* window, b
|
||||
IM_ASSERT(window->DockNode == NULL || window->DockNodeAsHost == NULL);
|
||||
|
||||
node->Windows.push_back(window);
|
||||
node->WantHiddenTabBarUpdate = true;
|
||||
window->DockNode = node;
|
||||
window->DockId = node->ID;
|
||||
window->DockIsActive = (node->Windows.Size > 1);
|
||||
@ -10841,6 +10842,7 @@ static void ImGui::DockNodeRemoveWindow(ImGuiDockNode* node, ImGuiWindow* window
|
||||
node->VisibleWindow = NULL;
|
||||
|
||||
// Remove tab and possibly tab bar
|
||||
node->WantHiddenTabBarUpdate = true;
|
||||
if (node->TabBar)
|
||||
{
|
||||
TabBarRemoveTab(node->TabBar, window->ID);
|
||||
@ -11033,6 +11035,11 @@ static void ImGui::DockNodeUpdateVisibleFlagAndInactiveChilds(ImGuiDockNode* nod
|
||||
window_n--;
|
||||
}
|
||||
|
||||
// Auto-hide tab bar option
|
||||
if (node->WantHiddenTabBarUpdate && node->Windows.Size == 1 && (node->Flags & ImGuiDockNodeFlags_AutoHideTabBar) && !node->IsHiddenTabBar)
|
||||
node->WantHiddenTabBarToggle = true;
|
||||
node->WantHiddenTabBarUpdate = false;
|
||||
|
||||
// Apply toggles at a single point of the frame (here!)
|
||||
if (node->Windows.Size > 1)
|
||||
node->IsHiddenTabBar = false;
|
||||
@ -12863,7 +12870,7 @@ void ImGui::BeginAsDockableDragDropTarget(ImGuiWindow* window)
|
||||
else
|
||||
allow_null_target_node = true; // Dock into a regular window
|
||||
|
||||
const ImRect explicit_target_rect = (target_node && target_node->TabBar) ? target_node->TabBar->BarRect : ImRect(window->Pos, window->Pos + ImVec2(window->Size.x, GetFrameHeight()));
|
||||
const ImRect explicit_target_rect = (target_node && target_node->TabBar && !target_node->IsHiddenTabBar) ? target_node->TabBar->BarRect : ImRect(window->Pos, window->Pos + ImVec2(window->Size.x, GetFrameHeight()));
|
||||
const bool is_explicit_target = g.IO.ConfigDockingWithShift || IsMouseHoveringRect(explicit_target_rect.Min, explicit_target_rect.Max);
|
||||
|
||||
// Preview docking request and find out split direction/ratio
|
||||
|
5
imgui.h
5
imgui.h
@ -879,7 +879,8 @@ enum ImGuiDockNodeFlags_
|
||||
ImGuiDockNodeFlags_NoDockingInCentralNode = 1 << 3, // Disable docking inside the Central Node, which will be always kept empty.
|
||||
//ImGuiDockNodeFlags_NoLayoutChanges = 1 << 4, // Disable adding/removing nodes interactively. Useful with programatically setup dockspaces.
|
||||
ImGuiDockNodeFlags_NoResize = 1 << 5, // Disable resizing child nodes using the splitter/separators. Useful with programatically setup dockspaces.
|
||||
ImGuiDockNodeFlags_PassthruDockspace = 1 << 6 // 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background.
|
||||
ImGuiDockNodeFlags_PassthruDockspace = 1 << 6, // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background.
|
||||
ImGuiDockNodeFlags_AutoHideTabBar = 1 << 7 // Tab bar will automatically hide when there is a single window in the dock node.
|
||||
};
|
||||
|
||||
// Flags for ImGui::IsWindowFocused()
|
||||
@ -1373,7 +1374,7 @@ struct ImGuiIO
|
||||
bool ConfigDockingNoSplit; // = false // Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars.
|
||||
bool ConfigDockingWithShift; // = false // Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space)
|
||||
bool ConfigDockingTabBarOnSingleWindows; // = false // [BETA] Make every single floating window display within a docking node.
|
||||
bool ConfigDockingTransparentPayload;// = false // [BETA] Make window or viewport transparent when docking and only display docking boxes on the target viewport. Useful if rendering of multiple viewport can be synced. Best used with ImGuiConfigFlags_ViewportsNoMerge.
|
||||
bool ConfigDockingTransparentPayload;// = false // [BETA] Make window or viewport transparent when docking and only display docking boxes on the target viewport. Useful if rendering of multiple viewport cannot be synced. Best used with ConfigViewportsNoAutoMerge.
|
||||
|
||||
// Viewport options (when ImGuiConfigFlags_ViewportsEnable is set)
|
||||
bool ConfigViewportsNoAutoMerge; // = false; // Set to make all floating imgui windows always create their own viewport. Otherwise, they are merged into the main host viewports when overlapping it.
|
||||
|
@ -4100,6 +4100,7 @@ void ShowExampleAppDockSpace(bool* p_open)
|
||||
if (ImGui::MenuItem("Flag: NoDockingInCentralNode", "", (opt_flags & ImGuiDockNodeFlags_NoDockingInCentralNode) != 0)) opt_flags ^= ImGuiDockNodeFlags_NoDockingInCentralNode;
|
||||
if (ImGui::MenuItem("Flag: NoResize", "", (opt_flags & ImGuiDockNodeFlags_NoResize) != 0)) opt_flags ^= ImGuiDockNodeFlags_NoResize;
|
||||
if (ImGui::MenuItem("Flag: PassthruDockspace", "", (opt_flags & ImGuiDockNodeFlags_PassthruDockspace) != 0)) opt_flags ^= ImGuiDockNodeFlags_PassthruDockspace;
|
||||
if (ImGui::MenuItem("Flag: AutoHideTabBar", "", (opt_flags & ImGuiDockNodeFlags_AutoHideTabBar) != 0)) opt_flags ^= ImGuiDockNodeFlags_AutoHideTabBar;
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Close DockSpace", NULL, false, p_open != NULL))
|
||||
*p_open = false;
|
||||
|
@ -854,6 +854,7 @@ struct ImGuiDockNode
|
||||
bool WantCloseAll :1; // Set when closing all tabs at once.
|
||||
bool WantLockSizeOnce :1;
|
||||
bool WantMouseMove :1; // After a node extraction we need to transition toward moving the newly created host window
|
||||
bool WantHiddenTabBarUpdate :1;
|
||||
bool WantHiddenTabBarToggle :1;
|
||||
|
||||
ImGuiDockNode(ImGuiID id);
|
||||
|
Loading…
Reference in New Issue
Block a user