imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Flag for centered tab bars?

Open aardappel opened this issue 7 months ago • 1 comments

Version/Branch of Dear ImGui:

v1.91.3 docking

Back-ends:

SDL + opengl 3

Compiler, OS:

VS 2022

Full config/build information:

No response

Details:

Would a flag for centered tab bars be a good idea?

I am aware that centering UI elements is generally difficult in single pass layout, but it the tab bar code in ImGui::TabBarLayout already does caching of all tab sizes, so this seems trivial, it seems to work great just adding something along the lines of

    auto left_over_space = tab_bar->BarRect.GetWidth() - tab_bar->WidthAllTabsIdeal;
    float tab_offset = left_over_space > 0.0f ? left_over_space * 0.5f : 0.0;

But maybe there is a more correct way, or it is not deemed a desirable feature.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

aardappel avatar May 23 '25 20:05 aardappel

Would be nice to have a way to control the alignment of text inside a tab as well. I'd like to match the alignment of the window title when it is not docked, with the alignment of the title inside a tab when the window is docked.

MirrasHue avatar May 24 '25 01:05 MirrasHue