Skip to content

Commit c648e61

Browse files
committed
feat: implement set_active method for panel management
1 parent c91dce3 commit c648e61

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

crates/ui/src/dock/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl DockItem {
410410
}
411411
}
412412
DockItem::Tiles { .. } => {}
413-
DockItem::Panel { .. } => {}
413+
DockItem::Panel { view } => view.set_active(collapsed, window, cx),
414414
}
415415
}
416416

crates/ui/src/dock/stack_panel.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ impl Panel for StackPanel {
3535
fn title(&self, _window: &gpui::Window, _cx: &gpui::App) -> gpui::AnyElement {
3636
"StackPanel".into_any_element()
3737
}
38-
38+
fn set_active(&mut self, active: bool, window: &mut Window, cx: &mut App) {
39+
for panel in &self.panels {
40+
panel.set_active(active, window, cx);
41+
}
42+
}
3943
fn dump(&self, cx: &App) -> PanelState {
4044
let sizes = self.panel_group.read(cx).sizes();
4145
let mut state = PanelState::new(self);

crates/ui/src/dock/tab_panel.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,13 @@ impl TabPanel {
347347
pub(super) fn set_collapsed(
348348
&mut self,
349349
collapsed: bool,
350-
_: &mut Window,
350+
window: &mut Window,
351351
cx: &mut Context<Self>,
352352
) {
353353
self.collapsed = collapsed;
354+
if let Some(panel) = self.panels.get(self.active_ix) {
355+
panel.set_active(collapsed, window, cx);
356+
}
354357
cx.notify();
355358
}
356359

0 commit comments

Comments
 (0)