use std::any::Any; use std::sync::Arc; use gpui::{ AnyElement, AnyView, App, Element, Entity, EventEmitter, FocusHandle, Focusable, Render, SharedString, Window, }; use gpui_base::dock::{PanelId, PanelState}; use crate::button::Button; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PanelEvent {} pub trait Panel: EventEmitter + Render + Focusable { /// The name of the panel used to serialize, deserialize and identify the panel. fn panel_id(&self) -> SharedString; /// The title of the panel fn title(&self, _cx: &App) -> AnyElement { SharedString::from("Unnamed").into_any() } /// Whether the panel can be closed, default is `true`. fn closable(&self, _cx: &App) -> bool { true } /// Whether the panel is zoomable, default is `true`. fn zoomable(&self, _cx: &App) -> bool { true } /// Return false to hide panel, true to show panel, default is `true`. fn visible(&self, _cx: &App) -> bool { true } /// Set active state of the panel. fn set_active(&self, _active: bool, _window: &mut Window, _cx: &mut App) {} /// Set zoomed state of the panel. fn set_zoomed(&self, _zoomed: bool, _cx: &mut App) {} /// Toolbar buttons shown at the right of the title bar. fn toolbar_buttons(&self, _window: &Window, _cx: &App) -> Vec