add dock layout component
This commit is contained in:
@@ -40,6 +40,7 @@ pub struct Button {
|
||||
variant: ButtonVariant,
|
||||
size: Size,
|
||||
disabled: bool,
|
||||
tab_stop: bool,
|
||||
a11y_label: Option<SharedString>,
|
||||
tooltip: Option<TooltipBuilder>,
|
||||
on_click: Option<ClickHandler>,
|
||||
@@ -58,6 +59,7 @@ impl Button {
|
||||
variant: ButtonVariant::default(),
|
||||
size: Size::default(),
|
||||
disabled: false,
|
||||
tab_stop: true,
|
||||
a11y_label: None,
|
||||
tooltip: None,
|
||||
on_click: None,
|
||||
@@ -88,13 +90,19 @@ impl Button {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the visual treatment.
|
||||
/// Sets the button's visual language.
|
||||
pub fn variant(mut self, variant: ButtonVariant) -> Self {
|
||||
self.variant = variant;
|
||||
self
|
||||
}
|
||||
|
||||
/// Renders the button inert, unfocusable, and dimmed; disabled always wins.
|
||||
/// Whether the button is a keyboard tab stop, dense toolbars turn it off.
|
||||
pub fn tab_stop(mut self, tab_stop: bool) -> Self {
|
||||
self.tab_stop = tab_stop;
|
||||
self
|
||||
}
|
||||
|
||||
/// Renders the button inert, unfocusable, and dimmed.
|
||||
pub fn disabled(mut self, disabled: bool) -> Self {
|
||||
self.disabled = disabled;
|
||||
self
|
||||
@@ -193,7 +201,7 @@ impl RenderOnce for Button {
|
||||
button
|
||||
.cursor_pointer()
|
||||
.focusable()
|
||||
.tab_stop(true)
|
||||
.tab_stop(self.tab_stop)
|
||||
.hover(move |style| style.bg(hover))
|
||||
.active(move |style| style.bg(pressed))
|
||||
.focus_visible(|style| style.shadow(focus_ring(colors.ring)))
|
||||
|
||||
Reference in New Issue
Block a user