mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Feature request: centered titlebar #222
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#222
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Could you please add a flag for centering window's titlebar horizontally? I think this feature would be useful for customizing the look & feel of the UI.
Will do!
Thanks! You're great, I just become a patron (Ctrl Alt Ninja)!
Oh it was you :) I was wondering. Thanks a lot :)
I'll be adding a new set of flags for alignment parameters (left/center/right/top/bottom) so title bar can be the first use of that.
Added it, you can do:
I removed the vertical alignment features because they aren't useful yet. This is the first feature using explicit alignment option and I imagine more will follow.
If it's not too complicated, I would prefer that the titlebar centering would not take the space of the collapsing button into account. As it is now, the titlebar seems to be a little off center because the collapse button pushes the title right.
E.g. see how the title of an OS X window is centered:
http://cdn.arstechnica.net/reviews/os/mac-os-x-10-5.media/leopard-window.png
btw. what is your policy of closing issues? I mean, do you mark them as closed, or would you prefer me to do it?
That's actually because the spacing on the left is different from the one on the right, because in the case of clipping I want text to be clipped as far as possible (past the padding). I'll introduce different setting for alignment vs clipping internally.
Either way is ok. Sometimes I'm not sure and I wait for the user to close the bug when they are happy, sometimes I close it myself.
I reworked this.
For reference here where we want the alignment markers to be (regardless of the clipping marker which is always at the correct position and usually goes a little behind the "max" alignment marker, intentionally, to make clipped text most visibly "unfitting"). Notice how the two central cases which are now handled.
What does Leopard does when there's not enough room for the Leopard? I align it to the left in this case so you always see the beginning of the text.
Most OS X apps seem to set a sensible minimum window size, but for example resizing in Safari reveals that the window title x-coord is clamped to right edge of the red,yellow,green window buttons. So it's "left align" in case the text does not fit.
Cool. That's what I'm doing now. I'll close this, let me know if there's an issue.
I added adhoc code which is bit short-sighted but it's a good base to evolve it into something more generic. Current alignment shift the entire block of text so it won't work for multi-lines which is not supported for titles anyway. Eventually it should find its way to the lower levels function.
FYI @petrihakkinen
This got broken today, that code:
becomes:
It's more convenient/fast/simple to use vectors instead of enums, also potentially more flexible.
I might add some constants, e.g.
ImGuiAlign_TopLeft = ImVec2(0,0)for reference.The old
ImGuiAlign_Centerwas technically equivalent toImVec2(0.5f,0.0f)(horizontally centered, vertical top) but it doesn't make a difference for window titles and it was only publicly used for that, so I'll turn Center into (0.5f,0.5f)