Skip to main content

MacTabView

Struct MacTabView 

Source
pub struct MacTabView<'a> { /* private fields */ }
Expand description

Authentic macOS AppKit Tab View container (NSTabView equivalent).

Features hardware-calibrated content insets, flipped coordinate layout, animated segment transitions, and bezel border strokes.

§Example

use egui_macview::{MacAppearance, MacTabView, MacTheme};

let theme = MacTheme::new(MacAppearance::Aqua);
let mut active_tab = 0usize;

MacTabView::new(&mut active_tab)
    .theme(&theme)
    .tab("General", |ui| {
        ui.label("General preferences");
    })
    .tab("Advanced", |ui| {
        ui.label("Advanced settings");
    })
    .show(ui);

Implementations§

Source§

impl<'a> MacTabView<'a>

Source

pub fn new(selected_index: &'a mut usize) -> Self

Creates a new tab view bound to an active tab selection index.

Source

pub fn style(self, style: MacTabStyle) -> Self

Sets the tab display style (TopTabsBezelBorder or NoTabsNoBorder).

Source

pub fn control_size(self, size: MacControlSize) -> Self

Sets the control size (Regular, Small, or Mini).

Source

pub fn theme(self, theme: &'a MacTheme) -> Self

Injects dynamic theme.

Source

pub fn tab( self, title: impl Into<WidgetText>, content: impl FnOnce(&mut Ui) + 'a, ) -> Self

Appends a tab with a title and content closure.

Source

pub fn tab_bar_height(&self) -> f32

Resolves tab bar header height in points.

Source

pub fn content_insets(&self) -> MacInsets

Resolves exact MacBook content insets from outer container bounds.

Source

pub fn min_container_size(&self) -> Vec2

Resolves MacBook minimum container dimensions across control sizes.

Source

pub fn tab_bar_rect(&self, container_rect: Rect, ui: &Ui) -> Rect

Computes the layout rectangle of the top segmented tab bar within a container.

Source

pub fn show(self, ui: &mut Ui) -> Response

Shows the tab view layout with tab bar and selected content panel.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for MacTabView<'a>

§

impl<'a> !Send for MacTabView<'a>

§

impl<'a> !Sync for MacTabView<'a>

§

impl<'a> !UnwindSafe for MacTabView<'a>

§

impl<'a> Forget for MacTabView<'a>

§

impl<'a> Freeze for MacTabView<'a>

§

impl<'a> Move for MacTabView<'a>

§

impl<'a> Unpin for MacTabView<'a>

§

impl<'a> UnsafeUnpin for MacTabView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.