update dock

This commit is contained in:
2026-08-19 11:00:21 +07:00
parent c8bf7eb5d3
commit cc4fcd315c
6 changed files with 25 additions and 126 deletions
+1 -26
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use gpui::{
AnyElement, AnyView, App, AppContext as _, Context, Entity, EntityId, EventEmitter,
FocusHandle, Focusable, Global, Hsla, IntoElement, Render, SharedString, WeakEntity, Window,
FocusHandle, Focusable, Global, IntoElement, Render, SharedString, WeakEntity, Window,
};
use gpui_component::button::Button;
use gpui_component::menu::PopupMenu;
@@ -18,21 +18,6 @@ pub enum PanelEvent {
LayoutChanged,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum PanelStyle {
/// Display the TabBar when there are multiple tabs, otherwise display the simple title.
#[default]
Auto,
/// Always display the tab bar.
TabBar,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TitleStyle {
pub background: Hsla,
pub foreground: Hsla,
}
#[derive(Clone, Copy, Default)]
pub enum PanelControl {
Both,
@@ -74,11 +59,6 @@ pub trait Panel: EventEmitter<PanelEvent> + Render + Focusable {
t("Dock.Unnamed")
}
/// The theme of the panel title, default is `None`.
fn title_style(&self, cx: &App) -> Option<TitleStyle> {
None
}
/// The suffix of the panel title, default is `None`.
///
/// This is used to add a suffix element to the panel title.
@@ -182,7 +162,6 @@ pub trait PanelView: 'static + Send + Sync {
fn tab_name(&self, cx: &App) -> Option<SharedString>;
fn title(&self, window: &mut Window, cx: &mut App) -> AnyElement;
fn title_suffix(&self, window: &mut Window, cx: &mut App) -> Option<AnyElement>;
fn title_style(&self, cx: &App) -> Option<TitleStyle>;
fn closable(&self, cx: &App) -> bool;
fn zoomable(&self, cx: &App) -> Option<PanelControl>;
fn visible(&self, cx: &App) -> bool;
@@ -222,10 +201,6 @@ impl<T: Panel> PanelView for Entity<T> {
})
}
fn title_style(&self, cx: &App) -> Option<TitleStyle> {
self.read(cx).title_style(cx)
}
fn closable(&self, cx: &App) -> bool {
self.read(cx).closable(cx)
}