inkyblackness / imgui-go

Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree related helper function TreeNodeToLabelSpacing is missing

futjikato opened this issue · comments

Hi,

TreeAdvanceToLabelPos as well as GetTreeNodeToLabelSpacing are missing. This makes it a little harder to build nicely aligned tree menus. Is this a scope related choice not to expose these?

I am not a C/C++ dev myself and as such cant promise to make a pull request even if the addition is in scope. But I could give it a try.

Hello @futjikato , thank you for your message!
They are not intentionally hidden, just not yet required so far.
These are simple functions, you should be able to add them if you like - see for similar functions on how it is done.
For instance, TreeAdvanceToLabelPos() would be similar to TreePop(), so follow its wrapper implementation and essentially copy/paste :)
TreeNodeToLabelSpacing() isn't much different, only add a return value of float32 (and keep in mind, getter names don't have the prefix Get in go.
Take the documentation from imgui.h for the functions and you are good to go :)

Thanks! Will try to make a PR later today

As of Juli 2019 TreeAdvanceToLabelPos is deprecated so I will just add TreeNodeToLabelSpacing as that seems to be the replacement.
See: https://github.com/ocornut/imgui/blob/master/imgui.h#L1542

Thank you for your contribution! I'll do a release with that soon, I first want to handle the other issue as well.