Adjust the type arrangement on ManagedViews

This commit is contained in:
Mikayla 2023-11-17 09:51:11 -08:00
parent 8837045abb
commit 01d9d53f4a
No known key found for this signature in database
7 changed files with 53 additions and 47 deletions

View file

@ -193,17 +193,12 @@ 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: Render {
fn focus_handle(&self, cx: &AppContext) -> FocusHandle;
}
pub trait Managed: FocusableView + EventEmitter<ManagedView> {}
pub struct Dismiss;
impl<T: ManagedView> EventEmitter<Dismiss> for T {}
impl<M: FocusableView + EventEmitter<ManagedView>> Managed for M {}
impl<T: ManagedView> FocusableView for T {
fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
self.focus_handle(cx)
}
pub enum ManagedView {
Dismiss,
}
// Holds the state for a specific window.