ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
59.11k stars 10.09k forks source link

Question: Styling window title when docked inside another window? #5322

Open Jaysmito101 opened 2 years ago

Jaysmito101 commented 2 years ago
Dear ImGui 1.88 WIP (18716)
--------------------------------

sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1930
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------

io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000041
 NavEnableKeyboard
 DockingEnable
io.ConfigViewportsNoAutoMerge
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------

io.Fonts: 5 fonts, Flags: 0x00000000, TexSize: 512,512
io.DisplaySize: 1366.00,705.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------

style.WindowPadding: 15.00,15.00
style.WindowBorderSize: 1.00
style.FramePadding: 5.00,5.00
style.FrameRounding: 3.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 12.00,8.00
style.ItemInnerSpacing: 8.00,6.00

My Issue/Question:

I was trying to style the title bar of the window with Push/Pop StyleVar calls. I tried placing the calls before and after ImGui::Begin and that works perfectly when the window is not docked but when its docked the style is not applied. I guessed this is because the title is drawn by the dockspace when its docked so i added the style Push/Pop calls before the main dockspace and it works when the windows are docked in the main dockspace but when its docked inside another window it doesn't work. So, is there a way to modify the style of window title when docked?

ocornut commented 2 years ago

Hello,

You are not specifying which StyleVar you are trying to alter. The effect of varying tabs using varying style vars when docked is tricky to settle for and specific to each style var. The values of style variable between NewFrame() will alter some of those for docking tab bars.

See #2700, #2539, #3537, #3521, #4953.

Jaysmito101 commented 2 years ago

@ocornut Sorry for not mentioning.

I am trying to increase FramePadding of the title when the window is docked. To be exact I i want to have the same style of the title as in the docking preview in the docked window. Here is a screen shot: I want the title to look like: Screenshot (545) And not like: Screenshot (546)

With what I get I will need to increase FramePadding. (For the font I think I will change the default font to the required one as suggested in https://github.com/ocornut/imgui/issues/4953#issuecomment-1023473332)

ocornut commented 2 years ago

As with #4953 and others you can set the FramePadding value before calling NewFrame().

I am not sure how you expect this to be handled automatically with heterogeneous values. Perhaps the docking tab bar could use the MAX of all FramePadding ?