pub struct SegmentedButton<'a> { /* private fields */ }Expand description
A toggle button with a built-in LED dot.
let mut on = false;
if ui.add(SegmentedButton::new(&mut on, "Continuous").accent(Accent::Green))
.clicked()
{
// ...
}Implementations§
Source§impl<'a> SegmentedButton<'a>
impl<'a> SegmentedButton<'a>
Sourcepub fn new(on: &'a mut bool, label: impl Into<WidgetText>) -> Self
pub fn new(on: &'a mut bool, label: impl Into<WidgetText>) -> Self
Create a segmented button bound to on with the given label.
Sourcepub fn accent(self, accent: Accent) -> Self
pub fn accent(self, accent: Accent) -> Self
Pick the on-state colour from one of the theme’s accents. Default: Accent::Green.
Sourcepub fn dim_when_on(self, dim: bool) -> Self
pub fn dim_when_on(self, dim: bool) -> Self
When the button is on, render its fill dimmed and the label muted. Used to indicate “enabled but not currently applicable”.
Sourcepub fn rounded(self, rounded: bool) -> Self
pub fn rounded(self, rounded: bool) -> Self
Set whether the button has rounded corners. Disable for segmented groups where neighbours share edges.
Sourcepub fn corner_radius(self, radius: impl Into<CornerRadius>) -> Self
pub fn corner_radius(self, radius: impl Into<CornerRadius>) -> Self
Explicitly set the corner radius (per-corner). Overrides Self::rounded.
Useful for segmented strips where only the end cells should be rounded.
Trait Implementations§
Source§impl<'a> Debug for SegmentedButton<'a>
impl<'a> Debug for SegmentedButton<'a>
Auto Trait Implementations§
impl<'a> Freeze for SegmentedButton<'a>
impl<'a> RefUnwindSafe for SegmentedButton<'a>
impl<'a> Send for SegmentedButton<'a>
impl<'a> Sync for SegmentedButton<'a>
impl<'a> Unpin for SegmentedButton<'a>
impl<'a> UnsafeUnpin for SegmentedButton<'a>
impl<'a> !UnwindSafe for SegmentedButton<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more