-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Moving the tabbar of a docked panel else where #8349
Description
Version/Branch of Dear ImGui:
Version 1.90.5, Branch: docking
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
Compiler, OS:
Windows 11 + MSVC 2022
Full config/build information:
Dear ImGui 1.90.5 WIP (19046)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1942
define: _MSVC_LANG=202002
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000040
DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000C0E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
HasMouseHoveredViewport
RendererHasVtxOffset
--------------------------------
io.Fonts: 6 fonts, Flags: 0x00000000, TexSize: 2048,4096
io.DisplaySize: 1608.00,935.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 4.00,4.00
style.WindowBorderSize: 0.00
style.FramePadding: 8.00,4.00
style.FrameRounding: 4.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
My Issue/Question:
Hi!
I'm wondering how I could move & constraint the size the TabBar of a docking panel onto my custom title bar.
Here is my current setup:
Currently, everything under the custom title bar is just empty space that my docking window is taking.
I have tried using the DockNodeBeginAmendTabBar/DockNodeEndAmendTabBar but it seems to only be useful to modify the content of the tab bar(like adding elements before or after).
Here is what I tried:
// Creating the dockspace
ImGuiWindowClass top_level_class;
top_level_class.ClassId = ImHashStr("SceneEditor");
top_level_class.DockingAllowUnclassed = false;
ImGui::DockSpace(ImGui::GetID("SceneEditorDockSpace"), {0, 0}, 0, &top_level_class);
// Offsetting the tab bar vertically to step onto the title bar above it
ImGuiDockNode* node = (ImGuiDockNode*)GImGui->DockContext.Nodes.GetVoidPtr(ImGui::GetID("SceneEditorDockSpace"));
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 32); // <--- This has no effect
if(ImGui::DockNodeBeginAmendTabBar(node))
{
ImGui::SetNextItemWidth(48);
if (ImGui::BeginTabItem("##logoPadding", 0, ImGuiTabItemFlags_Leading))
{
ImGui::EndTabItem();
}
ImGui::DockNodeEndAmendTabBar();
}Another solution I thought of is to hide the actual tab bar, and make one from scratch that mimicks the actual real tab bar.
Is there any system that would allow me to avoid making one from scratch and simply move/size the real tab bar?
Thanks!
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
// Creating the dockspace
ImGuiWindowClass top_level_class;
top_level_class.ClassId = ImHashStr("SceneEditor");
top_level_class.DockingAllowUnclassed = false;
ImGui::DockSpace(ImGui::GetID("SceneEditorDockSpace"), {0, 0}, 0, &top_level_class);
// Offsetting the tab bar vertically to step onto the title bar above it
ImGuiDockNode* node = (ImGuiDockNode*)GImGui->DockContext.Nodes.GetVoidPtr(ImGui::GetID("SceneEditorDockSpace"));
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 32); // <--- This has no effect
if(ImGui::DockNodeBeginAmendTabBar(node))
{
ImGui::SetNextItemWidth(48);
if (ImGui::BeginTabItem("##logoPadding", 0, ImGuiTabItemFlags_Leading))
{
ImGui::EndTabItem();
}
ImGui::DockNodeEndAmendTabBar();
}