You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! Usually live on Bitbucket, but registered here just for this. So we talked on Twitter and you already know half the details, but I guess I'll describe it from the start for anyone else reading this as well.
My suggestion is to put a public version of CloseButton() in imgui.h, and I'll explain why I think this would be nice below. Just giving you the context at the very beginning of this issue before I babble on!
Thought I'd need slightly more than Twitter's 140 characters, but didn't expect it to guess this lengthy, so I hope it's palatable and least misses out on no information.
Context
I'm working on a docking system with tabs, and today I added buttons to close the tabs. I wanted them to be consistent with those used to close windows, and to have their style and colours controlled by the same style variables, so I dug into ImGui to find out how those are added, and found the function CloseButton() in imgui_internal.h.
Here's a picture of my implementation using that function to add a close button to the tabs:
The tabs are meant to be consistent with the title bars of windows, and use the same colour.
Issue
Obviously imgui_internal.h is perfectly accessible, but as you said on Twitter it's not "designed for public consumption", and this particular function reflects this, as I had to specify the button's position globally when using it, rather than having the button show up in a relative position like when I call one of the exposed functions, like the regular Button().
I also had to calculate the size (based on radius and padding and stuff) manually, the same way the internal window code for ImGui does it, which would be nice to have abstracted away somehow as well in case of a public version.
Perhaps with a default size if the argument is omitted, so that the size is generally consistent, and only customised if really necessary... I believe my tabs have smaller buttons than the windows ATM, which also makes me think it'd be nice to access title bar size and padding to use for the tabs as well, but I may be getting off topic now, unless this should be generalised into some title bar API rather than just a close button one instead, heh...
All in all, the relevant code for adding the button to the tab looks something like this, which is quite verbose even excluding the additional call to generate the ID for the button:
So I just wanted to suggest putting a public version of CloseButton() in imgui.h for "public consumption" so that anybody who wants to add something that needs a close button can easily make it consistent with the rest of the UI, as exemplified by my tabs.
(or perhaps indeed something bigger for title bar stuff in general, which my ramblings started getting into halfway instead...)
I think it can probably be useful for immediate one-time inline stuff too, and not necessarily just full-blown custom widgets.
This may be simple enough that I could add it to imgui.h myself and submit a pull request through this new account, but yeah. Would like to hear your thoughts first, of course! c:
So, indeed, how do you feel about this suggestion?
The text was updated successfully, but these errors were encountered:
Sorry I didn't get to answer this earlier. CloseButton() is exposed in imgui_internal.h for now, so you may include that for now? Currently it would be a rather odd api to add to imgui.h since it doesn't lay itself out, takes an ImGuiID etc. so it feels it would only be used by custom widgets?
(Also adding a link to #261 since this relates to Tabs)
Was scanning old issues I think I'll be closing this for now.
Mostly because your initial intent was to use in a custom docking system, and now we have both TabBar (in master) and Docking (in a branch), reducing pressure for that.
I do agree this would be useful eventually but I would rather wait until we have a concrete use case that warrant creating a public api. There's a various subtleties (overlap, navlayer) involved and even until recently I've been changing things about the CloseButton() function, which makes me not eager to make it public unless absolutely necessary.
Hey! Usually live on Bitbucket, but registered here just for this. So we talked on Twitter and you already know half the details, but I guess I'll describe it from the start for anyone else reading this as well.
My suggestion is to put a public version of
CloseButton()
in imgui.h, and I'll explain why I think this would be nice below. Just giving you the context at the very beginning of this issue before I babble on!Thought I'd need slightly more than Twitter's 140 characters, but didn't expect it to guess this lengthy, so I hope it's palatable and least misses out on no information.
Context
I'm working on a docking system with tabs, and today I added buttons to close the tabs. I wanted them to be consistent with those used to close windows, and to have their style and colours controlled by the same style variables, so I dug into ImGui to find out how those are added, and found the function
CloseButton()
in imgui_internal.h.Here's a picture of my implementation using that function to add a close button to the tabs:
The tabs are meant to be consistent with the title bars of windows, and use the same colour.
Issue
Obviously imgui_internal.h is perfectly accessible, but as you said on Twitter it's not "designed for public consumption", and this particular function reflects this, as I had to specify the button's position globally when using it, rather than having the button show up in a relative position like when I call one of the exposed functions, like the regular
Button()
.I also had to calculate the size (based on radius and padding and stuff) manually, the same way the internal window code for ImGui does it, which would be nice to have abstracted away somehow as well in case of a public version.
Perhaps with a default size if the argument is omitted, so that the size is generally consistent, and only customised if really necessary... I believe my tabs have smaller buttons than the windows ATM, which also makes me think it'd be nice to access title bar size and padding to use for the tabs as well, but I may be getting off topic now, unless this should be generalised into some title bar API rather than just a close button one instead, heh...
All in all, the relevant code for adding the button to the tab looks something like this, which is quite verbose even excluding the additional call to generate the ID for the button:
Suggestion
So I just wanted to suggest putting a public version of
CloseButton()
in imgui.h for "public consumption" so that anybody who wants to add something that needs a close button can easily make it consistent with the rest of the UI, as exemplified by my tabs.(or perhaps indeed something bigger for title bar stuff in general, which my ramblings started getting into halfway instead...)
I think it can probably be useful for immediate one-time inline stuff too, and not necessarily just full-blown custom widgets.
This may be simple enough that I could add it to imgui.h myself and submit a pull request through this new account, but yeah. Would like to hear your thoughts first, of course! c:
So, indeed, how do you feel about this suggestion?
The text was updated successfully, but these errors were encountered: