Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add small checkboxes #6526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

KellanClark
Copy link

@KellanClark KellanClark commented Jun 16, 2023

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().
Screenshot 2023-06-16 183041

In the middle of text as shown in the demo window.
Screenshot 2023-06-16 184127

I understand if the need for this is too rare to justify a new widget and PR. Feel free to reject it.

@ocornut
Copy link
Owner

ocornut commented Jun 19, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants