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 functions begin_popup_context_*. #738

Merged
merged 4 commits into from Sep 23, 2023

Conversation

rodrigorc
Copy link
Contributor

Hi!

In ImGui there are these handy functions to do pop-up menus, usually by right-clicking the mouse. This PR adds basic wrappers around these.

The code is quite self-explanatory. The most notable thing missing is the ability to specify a flag other than ImGuiPopupFlags_MouseButtonRight. For me, I only open pop-ups when doing a MouseButtonRight, so this is good enough. But if you think it is wort it, we could ad an enum wrapper and a way to specify it, maybe a builder helper struct o a few begin_popup_context_*_with_flags() functions.

@rodrigorc rodrigorc force-pushed the PopupContext branch 3 times, most recently from dabd2a4 to c6decca Compare July 23, 2023 11:54
@sanbox-irl
Copy link
Member

Hey, thanks for this PR! This looks great -- I'll take a deeper look soon and likely merge!

Copy link
Member

@sanbox-irl sanbox-irl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a look -- I think yup, your instinct is correct -- we'll need a version that can take an optional mouse button.

I'll push a version and let me know how it looks?

@sanbox-irl
Copy link
Member

okay @rodrigorc I added a few extra methods to handle setting a label or not. I agree that handling the non-RMB case should be deferred till we have a user who wants that, since it sounds...awfully niche and annoying.

Let me know what you think of these additions and we can merge it!

@rodrigorc
Copy link
Contributor Author

I see the changes all fine, thanks.

@sanbox-irl sanbox-irl merged commit 8b2722d into imgui-rs:main Sep 23, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants