Rename again, add fun cx APIs using new traits

This commit is contained in:
Mikayla 2023-11-17 10:06:41 -08:00
parent 01d9d53f4a
commit 17d53d0e38
No known key found for this signature in database
10 changed files with 77 additions and 35 deletions

View file

@ -1,6 +1,6 @@
use crate::{
AnyView, AnyWindowHandle, AppCell, AppContext, BackgroundExecutor, Context, FocusableView,
ForegroundExecutor, Model, ModelContext, Render, Result, Task, View, ViewContext,
ForegroundExecutor, ManagedEvent, Model, ModelContext, Render, Result, Task, View, ViewContext,
VisualContext, WindowContext, WindowHandle,
};
use anyhow::{anyhow, Context as _};
@ -320,4 +320,13 @@ impl VisualContext for AsyncWindowContext {
view.read(cx).focus_handle(cx).clone().focus(cx);
})
}
fn dismiss_view<V>(&mut self, view: &View<V>) -> Self::Result<()>
where
V: crate::ManagedView,
{
self.window.update(self, |_, cx| {
view.update(cx, |_, cx| cx.emit(ManagedEvent::Dismiss))
})
}
}