pub struct MacPathControl<'a> { /* private fields */ }Expand description
Authentic macOS AppKit breadcrumb path bar (NSPathControl equivalent).
§Example
use egui_macview::{MacAppearance, MacPathComponent, MacPathControl, MacTheme};
let theme = MacTheme::new(MacAppearance::Aqua);
let path = [
MacPathComponent::folder("Users"),
MacPathComponent::folder("Projects"),
MacPathComponent::file("Cargo.toml"),
];
let res = MacPathControl::new("file_breadcrumbs", &path)
.show_choose_button(true)
.theme(&theme)
.show(ui);
if let Some(idx) = res.clicked_segment {
// Navigated to segment `idx`
}Implementations§
Source§impl<'a> MacPathControl<'a>
impl<'a> MacPathControl<'a>
Sourcepub fn from_segments(
id_source: impl Hash + Debug,
segments: &'a [&'a str],
) -> Self
pub fn from_segments( id_source: impl Hash + Debug, segments: &'a [&'a str], ) -> Self
Creates a new MacPathControl from a slice of string segment names (all folders except last).
Sourcepub fn new(
id_source: impl Hash + Debug,
components: &'a [MacPathComponent<'a>],
) -> Self
pub fn new( id_source: impl Hash + Debug, components: &'a [MacPathComponent<'a>], ) -> Self
Creates a new MacPathControl from explicit MacPathComponent items.
Shows or hides the trailing Choose... button.
Sourcepub fn choose_label(self, label: &'a str) -> Self
pub fn choose_label(self, label: &'a str) -> Self
Sets custom label for the trailing choose button.
Sourcepub fn show(self, ui: &mut Ui) -> MacPathControlResponse
pub fn show(self, ui: &mut Ui) -> MacPathControlResponse
Renders the path control bar in ui.
Auto Trait Implementations§
impl<'a> Forget for MacPathControl<'a>
impl<'a> Freeze for MacPathControl<'a>
impl<'a> RefUnwindSafe for MacPathControl<'a>
impl<'a> Send for MacPathControl<'a>
impl<'a> Sync for MacPathControl<'a>
impl<'a> Unpin for MacPathControl<'a>
impl<'a> UnsafeUnpin for MacPathControl<'a>
impl<'a> UnwindSafe for MacPathControl<'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