debugger: Start on tabless design (#27837)

![image](https://github.com/user-attachments/assets/1cd54b70-5457-4c64-95bd-45a7055ea165)

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
Piotr Osiewicz 2025-04-03 18:11:14 +02:00 committed by GitHub
parent 9986a21970
commit ece4a1cd7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1287 additions and 1092 deletions

View file

@ -71,6 +71,18 @@ impl SelectableButton for ToggleButton {
}
}
impl FixedWidth for ToggleButton {
fn width(mut self, width: DefiniteLength) -> Self {
self.base.width = Some(width);
self
}
fn full_width(mut self) -> Self {
self.base.width = Some(relative(1.));
self
}
}
impl Disableable for ToggleButton {
fn disabled(mut self, disabled: bool) -> Self {
self.base = self.base.disabled(disabled);

View file

@ -253,6 +253,7 @@ pub struct CheckboxWithLabel {
on_click: Arc<dyn Fn(&ToggleState, &mut Window, &mut App) + 'static>,
filled: bool,
style: ToggleStyle,
checkbox_position: IconPosition,
}
// TODO: Remove `CheckboxWithLabel` now that `label` is a method of `Checkbox`.
@ -271,6 +272,7 @@ impl CheckboxWithLabel {
on_click: Arc::new(on_click),
filled: false,
style: ToggleStyle::default(),
checkbox_position: IconPosition::Start,
}
}
@ -291,31 +293,51 @@ impl CheckboxWithLabel {
self.filled = true;
self
}
pub fn checkbox_position(mut self, position: IconPosition) -> Self {
self.checkbox_position = position;
self
}
}
impl RenderOnce for CheckboxWithLabel {
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
h_flex()
.gap(DynamicSpacing::Base08.rems(cx))
.child(
Checkbox::new(self.id.clone(), self.checked)
.style(self.style)
.when(self.filled, Checkbox::fill)
.on_click({
let on_click = self.on_click.clone();
move |checked, window, cx| {
(on_click)(checked, window, cx);
}
}),
)
.when(self.checkbox_position == IconPosition::Start, |this| {
this.child(
Checkbox::new(self.id.clone(), self.checked)
.style(self.style.clone())
.when(self.filled, Checkbox::fill)
.on_click({
let on_click = self.on_click.clone();
move |checked, window, cx| {
(on_click)(checked, window, cx);
}
}),
)
})
.child(
div()
.id(SharedString::from(format!("{}-label", self.id)))
.on_click(move |_event, window, cx| {
(self.on_click)(&self.checked.inverse(), window, cx);
.on_click({
let on_click = self.on_click.clone();
move |_event, window, cx| {
(on_click)(&self.checked.inverse(), window, cx);
}
})
.child(self.label),
)
.when(self.checkbox_position == IconPosition::End, |this| {
this.child(
Checkbox::new(self.id.clone(), self.checked)
.style(self.style)
.when(self.filled, Checkbox::fill)
.on_click(move |checked, window, cx| {
(self.on_click)(checked, window, cx);
}),
)
})
}
}