Add small checkboxes
I recently ran into a use case where I wanted a checkbox, but the vertical size needed messed with the space between lines. I looked around the demo and found ImGui::SmallButton() covered a similar case, so I reused its code to make a smaller checkbox.
My usecase in a very WIP debugger window showing what a SmallCheckbox() looks like compared to a Checkbox().
In the middle of text as shown in the demo window.
I understand if the need for this is too rare to justify a new widget and PR. Feel free to reject it.
Hello Kellan,
Thanks for the PR. Although this is no doubt useful, presently I would prefer to avoid adding those variants as they tend to easily multiply.
Note that the API design using a namespace means you can add this function (with same ImGui::SmallCheckbox() name) in your own source file so presently given the low complexity of that function I'd recommend people to do that.
One small tangential thing is that I've been considering adding X/Y variant of style variables, e.g. ImGuiStyleVar_FramePaddingY so people inclined to use public Push/Pop API can perform an Y only override more easily.
(Practically speaking, I do prefer the approach of backuping old value on the stack as this tends to be simpler and faster when done in a helper function like this).
Good luck on the emulators :)
Closing this as discussed.
Note that since bf75504 i have added PushStyleVarX(), PushStyleVarY() helpers to make it even to modify a single component of a style variable.
So this becomes equivalent to doing:
PushStyleVarY(ImGuiStyleVar_FramePadding, 0.0f);
CheckBox(...);
PopStyleVar();
And I don't believe needs its own entry point. Thanks for the suggestion!