diff --git a/assets/icons/resize-corner.svg b/assets/icons/resize-corner.svg
new file mode 100644
index 0000000..31065be
--- /dev/null
+++ b/assets/icons/resize-corner.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/crates/app/src/views/dock/chat/mod.rs b/crates/app/src/views/dock/chat/mod.rs
index e7addd8..e336c75 100644
--- a/crates/app/src/views/dock/chat/mod.rs
+++ b/crates/app/src/views/dock/chat/mod.rs
@@ -1,6 +1,6 @@
use coop_ui::{
button::Button,
- dock::{DockItemState, Panel, PanelEvent, TitleStyle},
+ dock::{Panel, PanelEvent, PanelState, TitleStyle},
popup_menu::PopupMenu,
};
use form::Form;
@@ -75,8 +75,8 @@ impl Panel for ChatPanel {
vec![]
}
- fn dump(&self, _cx: &AppContext) -> DockItemState {
- DockItemState::new(self)
+ fn dump(&self, _cx: &AppContext) -> PanelState {
+ PanelState::new(self)
}
}
diff --git a/crates/app/src/views/dock/left_dock.rs b/crates/app/src/views/dock/left_dock.rs
index f722a6d..0a08d9c 100644
--- a/crates/app/src/views/dock/left_dock.rs
+++ b/crates/app/src/views/dock/left_dock.rs
@@ -1,6 +1,6 @@
use coop_ui::{
button::Button,
- dock::{DockItemState, Panel, PanelEvent, TitleStyle},
+ dock::{Panel, PanelEvent, PanelState, TitleStyle},
popup_menu::PopupMenu,
scroll::ScrollbarAxis,
StyledExt,
@@ -68,8 +68,8 @@ impl Panel for LeftDock {
vec![]
}
- fn dump(&self, _cx: &AppContext) -> DockItemState {
- DockItemState::new(self)
+ fn dump(&self, _cx: &AppContext) -> PanelState {
+ PanelState::new(self)
}
}
diff --git a/crates/app/src/views/dock/welcome.rs b/crates/app/src/views/dock/welcome.rs
index fce2478..d7a0077 100644
--- a/crates/app/src/views/dock/welcome.rs
+++ b/crates/app/src/views/dock/welcome.rs
@@ -1,6 +1,6 @@
use coop_ui::{
button::Button,
- dock::{DockItemState, Panel, PanelEvent, TitleStyle},
+ dock::{Panel, PanelEvent, PanelState, TitleStyle},
popup_menu::PopupMenu,
theme::{ActiveTheme, Colorize},
StyledExt,
@@ -58,8 +58,8 @@ impl Panel for WelcomePanel {
vec![]
}
- fn dump(&self, _cx: &AppContext) -> DockItemState {
- DockItemState::new(self)
+ fn dump(&self, _cx: &AppContext) -> PanelState {
+ PanelState::new(self)
}
}
diff --git a/crates/ui/src/dock/dock.rs b/crates/ui/src/dock/dock.rs
index 98f7637..7325aaf 100644
--- a/crates/ui/src/dock/dock.rs
+++ b/crates/ui/src/dock/dock.rs
@@ -1,7 +1,3 @@
-//! Dock is a fixed container that places at left, bottom, right of the Windows.
-
-use std::sync::Arc;
-
use gpui::{
div, prelude::FluentBuilder as _, px, Axis, Element, Entity, InteractiveElement as _,
IntoElement, MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Render,
@@ -9,6 +5,7 @@ use gpui::{
WeakView, WindowContext,
};
use serde::{Deserialize, Serialize};
+use std::sync::Arc;
use crate::{
resizable::{HANDLE_PADDING, HANDLE_SIZE, PANEL_MIN_SIZE},
@@ -193,6 +190,16 @@ impl Dock {
}
});
}
+ DockItem::Tiles { view, .. } => {
+ cx.defer({
+ let view = view.clone();
+ move |cx| {
+ _ = dock_area.update(cx, |this, cx| {
+ this.subscribe_panel(&view, cx);
+ });
+ }
+ });
+ }
DockItem::Panel { .. } => {
// Not supported
}
@@ -376,6 +383,8 @@ impl Render for Dock {
DockItem::Split { view, .. } => this.child(view.clone()),
DockItem::Tabs { view, .. } => this.child(view.clone()),
DockItem::Panel { view, .. } => this.child(view.clone().view()),
+ // Not support to render Tiles and Tile into Dock
+ DockItem::Tiles { .. } => this,
})
.child(self.render_resize_handle(cx))
.child(DockElement {
diff --git a/crates/ui/src/dock/invalid_panel.rs b/crates/ui/src/dock/invalid_panel.rs
index fbdb1d6..7e514e3 100644
--- a/crates/ui/src/dock/invalid_panel.rs
+++ b/crates/ui/src/dock/invalid_panel.rs
@@ -3,18 +3,17 @@ use gpui::{
Styled as _, WindowContext,
};
-use crate::theme::ActiveTheme as _;
-
-use super::{DockItemState, Panel, PanelEvent};
+use super::{Panel, PanelEvent, PanelState};
+use crate::theme::ActiveTheme;
pub(crate) struct InvalidPanel {
name: SharedString,
focus_handle: FocusHandle,
- old_state: DockItemState,
+ old_state: PanelState,
}
impl InvalidPanel {
- pub(crate) fn new(name: &str, state: DockItemState, cx: &mut WindowContext) -> Self {
+ pub(crate) fn new(name: &str, state: PanelState, cx: &mut WindowContext) -> Self {
Self {
focus_handle: cx.focus_handle(),
name: SharedString::from(name.to_owned()),
@@ -27,7 +26,7 @@ impl Panel for InvalidPanel {
"InvalidPanel"
}
- fn dump(&self, _cx: &AppContext) -> super::DockItemState {
+ fn dump(&self, _cx: &AppContext) -> super::PanelState {
self.old_state.clone()
}
}
diff --git a/crates/ui/src/dock/mod.rs b/crates/ui/src/dock/mod.rs
index 29659dd..1d1a0b2 100644
--- a/crates/ui/src/dock/mod.rs
+++ b/crates/ui/src/dock/mod.rs
@@ -5,9 +5,9 @@ mod panel;
mod stack_panel;
mod state;
mod tab_panel;
+mod tiles;
use anyhow::Result;
-
use gpui::{
actions, canvas, div, prelude::FluentBuilder, AnyElement, AnyView, AppContext, Axis, Bounds,
Edges, Entity as _, EntityId, EventEmitter, InteractiveElement as _, IntoElement,
@@ -21,6 +21,7 @@ pub use panel::*;
pub use stack_panel::*;
pub use state::*;
pub use tab_panel::*;
+pub use tiles::*;
use crate::theme::ActiveTheme;
@@ -74,7 +75,7 @@ pub struct DockArea {
pub enum DockItem {
/// Split layout
Split {
- axis: gpui::Axis,
+ axis: Axis,
items: Vec,
sizes: Vec