pub struct MacSegmentedControl<'a> { /* private fields */ }Expand description
Authentic macOS segmented pill selector (NSSegmentedControl equivalent).
Features animated sliding selection indicator pill via CASpring, token-driven padding and typography,
ambient drop shadow, keyboard arrow navigation, and crisp border separators.
§Example
use egui_macview::{MacSegmentedControl, MacTheme};
let theme = MacTheme::default();
let mut selected = 1;
let tabs = ["Day", "Week", "Month", "Year"];
MacSegmentedControl::new(&tabs, selected)
.theme(&theme)
.show(ui, |new_idx| {
selected = new_idx;
});Implementations§
Source§impl<'a> MacSegmentedControl<'a>
impl<'a> MacSegmentedControl<'a>
Sourcepub fn new(options: &'a [&'a str], selected_idx: usize) -> Self
pub fn new(options: &'a [&'a str], selected_idx: usize) -> Self
Creates a segmented control with option labels and currently selected index.
Sourcepub fn theme(self, theme: &'a MacTheme) -> Self
pub fn theme(self, theme: &'a MacTheme) -> Self
Injects dynamic theme to eliminate hardcoded metrics and colors.
Auto Trait Implementations§
impl<'a> Forget for MacSegmentedControl<'a>
impl<'a> Freeze for MacSegmentedControl<'a>
impl<'a> RefUnwindSafe for MacSegmentedControl<'a>
impl<'a> Send for MacSegmentedControl<'a>
impl<'a> Sync for MacSegmentedControl<'a>
impl<'a> Unpin for MacSegmentedControl<'a>
impl<'a> UnsafeUnpin for MacSegmentedControl<'a>
impl<'a> UnwindSafe for MacSegmentedControl<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more