Merge branch 'main' into managed-view-adjustment

This commit is contained in:
Mikayla 2023-11-17 12:40:44 -08:00
commit 149b9d1aa6
No known key found for this signature in database
18 changed files with 330 additions and 179 deletions

View file

@ -193,11 +193,11 @@ pub trait FocusableView: Render {
/// ManagedView is a view (like a Modal, Popover, Menu, etc.)
/// where the lifecycle of the view is handled by another view.
pub trait ManagedView: FocusableView + EventEmitter<ManagedEvent> {}
pub trait ManagedView: FocusableView + EventEmitter<Manager> {}
impl<M: FocusableView + EventEmitter<ManagedEvent>> ManagedView for M {}
impl<M: FocusableView + EventEmitter<Manager>> ManagedView for M {}
pub enum ManagedEvent {
pub enum Manager {
Dismiss,
}
@ -1582,7 +1582,7 @@ impl VisualContext for WindowContext<'_> {
where
V: ManagedView,
{
self.update_view(view, |_, cx| cx.emit(ManagedEvent::Dismiss))
self.update_view(view, |_, cx| cx.emit(Manager::Dismiss))
}
}
@ -2282,7 +2282,7 @@ impl<'a, V: 'static> ViewContext<'a, V> {
where
V: ManagedView,
{
self.defer(|_, cx| cx.emit(ManagedEvent::Dismiss))
self.defer(|_, cx| cx.emit(Manager::Dismiss))
}
}