pub struct MacScrollView<'a> { /* private fields */ }Expand description
Authentic macOS AppKit Scroll View (NSScrollView equivalent).
Features zero-gutter content reservation (full viewport width/height), smooth hardware scroll clipping, virtual viewport computation, and interactive floating overlay scrollbars that smoothly fade out when inactive.
§Example
use egui_macview::{MacScrollView, MacTheme};
let theme = MacTheme::default();
MacScrollView::new("log_scroll")
.theme(&theme)
.max_height(200.0)
.show(ui, |content_ui| {
for i in 0..50 {
content_ui.label(format!("Log line {}", i));
}
});Implementations§
Source§impl<'a> MacScrollView<'a>
impl<'a> MacScrollView<'a>
Sourcepub fn new(id_source: impl Hash + Debug) -> Self
pub fn new(id_source: impl Hash + Debug) -> Self
Creates a scroll view with state identified by id_source.
Sourcepub fn both(id_source: impl Hash + Debug) -> Self
pub fn both(id_source: impl Hash + Debug) -> Self
Convenience constructor for both horizontal and vertical scrolling.
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 horizontal(self, enabled: bool) -> Self
pub fn horizontal(self, enabled: bool) -> Self
Enables or disables horizontal scrolling (default: false).
Sourcepub fn vertical(self, enabled: bool) -> Self
pub fn vertical(self, enabled: bool) -> Self
Enables or disables vertical scrolling (default: true).
Sourcepub fn auto_hide(self, auto_hide: bool) -> Self
pub fn auto_hide(self, auto_hide: bool) -> Self
Controls whether overlay scrollbars fade out when inactive (default: true).
Sourcepub fn max_height(self, max_h: f32) -> Self
pub fn max_height(self, max_h: f32) -> Self
Sets maximum height constraint in points.
Sourcepub fn min_scrolled_height(self, min_h: f32) -> Self
pub fn min_scrolled_height(self, min_h: f32) -> Self
Sets minimum scrolled height in points.
Sourcepub fn min_scrolled_width(self, min_w: f32) -> Self
pub fn min_scrolled_width(self, min_w: f32) -> Self
Sets minimum scrolled width in points.
Sourcepub fn with_offset(self, offset: &'a mut Vec2) -> Self
pub fn with_offset(self, offset: &'a mut Vec2) -> Self
Binds directly to an external &mut Vec2 offset variable for programmatic control.
Auto Trait Implementations§
impl<'a> !UnwindSafe for MacScrollView<'a>
impl<'a> Forget for MacScrollView<'a>
impl<'a> Freeze for MacScrollView<'a>
impl<'a> RefUnwindSafe for MacScrollView<'a>
impl<'a> Send for MacScrollView<'a>
impl<'a> Sync for MacScrollView<'a>
impl<'a> Unpin for MacScrollView<'a>
impl<'a> UnsafeUnpin for MacScrollView<'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
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> ⓘ
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> ⓘ
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