use crate::{button::Button, popup_menu::PopupMenu}; use gpui::{ AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla, IntoElement, Render, SharedString, Window, }; pub enum PanelEvent { ZoomIn, ZoomOut, LayoutChanged, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PanelStyle { /// Display the TabBar when there are multiple tabs, otherwise display the simple title. Default, /// Always display the tab bar. TabBar, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct TitleStyle { pub background: Hsla, pub foreground: Hsla, } pub trait Panel: EventEmitter + Render + Focusable { /// The name of the panel used to serialize, deserialize and identify the panel. /// /// This is used to identify the panel when deserializing the panel. /// Once you have defined a panel id, this must not be changed. fn panel_id(&self) -> SharedString; /// The optional facepile of the panel fn panel_facepile(&self, _cx: &App) -> Option> { None } /// The title of the panel fn title(&self, _cx: &App) -> AnyElement { SharedString::from("Unamed").into_any_element() } /// Whether the panel can be closed, default is `true`. fn closeable(&self, _cx: &App) -> bool { true } /// Return true if the panel is zoomable, default is `false`. fn zoomable(&self, _cx: &App) -> bool { true } /// The addition popup menu of the panel, default is `None`. fn popup_menu(&self, this: PopupMenu, _cx: &App) -> PopupMenu { this } /// The addition toolbar buttons of the panel used to show in the right of the title bar, default is `None`. fn toolbar_buttons(&self, _window: &Window, _cx: &App) -> Vec