-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 Ui::close
and Response::should_close
#5729
Conversation
Preview available at https://egui-pr-preview.github.io/pr/5729-lucasui-close |
814cf53
to
51cf5e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice!
crates/egui/src/containers/window.rs
Outdated
// TODO(lucas): I feel stupid, is there some better way to pass the &mut open | ||
// without moving it? | ||
match &mut open { | ||
None => None, | ||
Some(open) => Some(open), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO(lucas): I feel stupid, is there some better way to pass the &mut open | |
// without moving it? | |
match &mut open { | |
None => None, | |
Some(open) => Some(open), | |
}, | |
open.as_mut(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this I get a Option<&mut &mut bool>. But turns out open.as_deref_mut()
works! Not very intuitive 😅
Co-authored-by: Emil Ernerfeldt <[email protected]>
This adds a generic way of telling containers to close from their child
Ui
s.Response::closed
and investigate generalizingpopup::OpenKind
as something that could be used withWindow
,Collapsing
,Area
etc... #5727