Files
zed/crates/debugger_ui/src/session/inert.rs
2025-02-17 21:51:12 +01:00

52 lines
1.5 KiB
Rust

use gpui::{App, FocusHandle, Focusable};
use ui::{
div, h_flex, v_flex, Button, ButtonCommon, ButtonStyle, Context, ContextMenu, DropdownMenu,
Element, InteractiveElement, ParentElement, Render, Styled,
};
pub(super) struct InertState {
focus_handle: FocusHandle,
}
impl InertState {
pub(super) fn new(cx: &mut Context<Self>) -> Self {
Self {
focus_handle: cx.focus_handle(),
}
}
}
impl Focusable for InertState {
fn focus_handle(&self, cx: &App) -> FocusHandle {
self.focus_handle.clone()
}
}
impl Render for InertState {
fn render(
&mut self,
window: &mut ui::Window,
cx: &mut ui::Context<'_, Self>,
) -> impl ui::IntoElement {
v_flex()
.track_focus(&self.focus_handle)
.size_full()
.gap_1()
.p_1()
.child(h_flex().child(DropdownMenu::new(
"dap-adapter-picker",
"Select Debug Adapter",
ContextMenu::build(window, cx, |this, _, _| {
this.entry("GDB", None, |_, _| {})
.entry("Delve", None, |_, _| {})
.entry("LLDB", None, |_, _| {})
}),
)))
.child(
h_flex()
.gap_1()
.child(Button::new("launch-dap", "Launch").style(ButtonStyle::Filled))
.child(Button::new("attach-dap", "Attach").style(ButtonStyle::Filled)),
)
}
}