pub struct MacStackView<'a> { /* private fields */ }Expand description
Authentic macOS AppKit linear stacking container (NSStackView equivalent).
Supports automatic horizontal or vertical component stacking, configurable token-driven spacing and padding, grouped sections with header labels, and optional hairline divider lines between items.
§Example
use egui_macview::{MacStackView, MacTheme};
let theme = MacTheme::default();
MacStackView::vertical()
.theme(&theme)
.spacing(12.0)
.show_separators(true)
.show(ui, |stack| {
stack.add(|ui| {
ui.label("First item");
});
stack.add_section(Some("Section 2"), |ui| {
ui.label("Section content");
});
});Implementations§
Source§impl<'a> MacStackView<'a>
impl<'a> MacStackView<'a>
Sourcepub fn new(orientation: MacStackOrientation) -> Self
pub fn new(orientation: MacStackOrientation) -> Self
Creates a new stack view with the specified orientation.
Sourcepub fn horizontal() -> Self
pub fn horizontal() -> Self
Creates a horizontal row stack view.
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.
Sourcepub fn alignment(self, alignment: MacStackAlignment) -> Self
pub fn alignment(self, alignment: MacStackAlignment) -> Self
Sets cross-axis alignment.
Sourcepub fn spacing(self, spacing: f32) -> Self
pub fn spacing(self, spacing: f32) -> Self
Customizes spacing between adjacent elements in points.
Sourcepub fn padding(self, padding: f32) -> Self
pub fn padding(self, padding: f32) -> Self
Customizes outer edge padding around all stacked elements in points.
Sourcepub fn show_separators(self, show: bool) -> Self
pub fn show_separators(self, show: bool) -> Self
Enables automatic hairline separators between adjacent items and sections.
Sourcepub fn show<R>(
self,
ui: &mut Ui,
add_contents: impl FnOnce(&mut MacStackUi<'_>) -> R,
) -> MacStackViewOutput<R>
pub fn show<R>( self, ui: &mut Ui, add_contents: impl FnOnce(&mut MacStackUi<'_>) -> R, ) -> MacStackViewOutput<R>
Renders the linear stack and executes the items closure.
Auto Trait Implementations§
impl<'a> Forget for MacStackView<'a>
impl<'a> Freeze for MacStackView<'a>
impl<'a> RefUnwindSafe for MacStackView<'a>
impl<'a> Send for MacStackView<'a>
impl<'a> Sync for MacStackView<'a>
impl<'a> Unpin for MacStackView<'a>
impl<'a> UnsafeUnpin for MacStackView<'a>
impl<'a> UnwindSafe for MacStackView<'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