Open adnsv opened 3 years ago
You aren’t providing an actual example of what you are doing with it.
Its perfectly acceptable and frequently used to submit a Selectable() without a visible label and then render the text yourself above it, that can be done without modifying the function. Why not doing that?
A selectable item with an image/thumbnail, and/or complex content (title + faded-out description), etc. would be a good example.
Before Selectable() exits, it pops a few things: (Disabled, Columns/Table background). It is hard to find out which background color was used inside the RenderFrame. Those are the appearance-related things that can be used for correct content rendering.
Omar,
I my development I frequently find a need for a customizable version of Selectable() that would show things other than a simple text label. So far, my solution is to have a copy and paste the whole Selectable(), use pre-calculated size instead of CalcTextSize and replace RenderTextClipped with a user-provided callback. Since your Selectable() implementation changes quite often, I am finding myself often repeating the same copy-and-paste operation over and over again.
Since those two places are the only things in the function that are responsible for measuring and rendering the content, I believe it would be beneficial to generalize it in the library to allow for all sorts of custom selectable components.
For example: move all the code from Selectable() to BaseSelectable(), replace CalcTextSize and RenderTextClipped in it with callbacks. Then change the Selectable to simply call BaseSelectable with CalcTextSize and RenderTextClipped - based implementations.
Thanks
btw, the new PushDisabled()/PopDisabled() looks very good.