pub struct Scrollbar { /* private fields */ }Expand description
Scrollbar control for scroll-area or a uniform-list.
Implementations§
Source§impl Scrollbar
impl Scrollbar
Sourcepub fn new<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
pub fn new<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
Create a new scrollbar.
This will have both vertical and horizontal scrollbars.
Sourcepub fn horizontal<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
pub fn horizontal<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
Create with horizontal scrollbar.
Sourcepub fn vertical<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
pub fn vertical<H>(scroll_handle: &H) -> Scrollbarwhere
H: ScrollbarHandle + Clone,
Create with vertical scrollbar.
Sourcepub fn id(self, id: impl Into<ElementId>) -> Scrollbar
pub fn id(self, id: impl Into<ElementId>) -> Scrollbar
Set a specific element id, default is the Location::caller.
NOTE: In most cases, you don’t need to set a specific id for scrollbar.
Sourcepub fn mode(self, mode: ScrollbarMode) -> Scrollbar
pub fn mode(self, mode: ScrollbarMode) -> Scrollbar
Set the scrollbar show mode ScrollbarMode.
If unset, the current application theme projection is used.
Sourcepub fn scroll_size(self, scroll_size: Size<Pixels>) -> Scrollbar
pub fn scroll_size(self, scroll_size: Size<Pixels>) -> Scrollbar
Set a special scroll size of the content area, default is None.
Default will sync the content_size from scroll_handle.
Sourcepub fn viewport_bounds(self, bounds: Bounds<Pixels>) -> Scrollbar
pub fn viewport_bounds(self, bounds: Bounds<Pixels>) -> Scrollbar
Override the viewport bounds that this scrollbar overlays.
Most scroll containers should rely on the bounds reported by their scroll handle. Custom-painted viewports, such as the text editor, can use this when their visible bounds differ from the handle’s layout bounds.
Sourcepub fn viewport_from_layout(self) -> Scrollbar
pub fn viewport_from_layout(self) -> Scrollbar
Use the scrollbar element’s layout bounds as its viewport.
This is useful for composite widgets whose scrollbar viewport excludes fixed headers or columns and is therefore defined by a positioned overlay container rather than by the underlying scroll handle.
Sourcepub fn axis(self, axis: impl Into<ScrollbarAxis>) -> Scrollbar
pub fn axis(self, axis: impl Into<ScrollbarAxis>) -> Scrollbar
Set scrollbar axis.
pub fn styles( self, build: impl FnOnce(ScrollbarStyles) -> ScrollbarStyles, ) -> Scrollbar
Trait Implementations§
Source§impl Element for Scrollbar
impl Element for Scrollbar
Source§type RequestLayoutState = ()
type RequestLayoutState = ()
Element::request_layout. A mutable reference to this state is subsequently
provided to Element::prepaint and Element::paint.Source§type PrepaintState = PrepaintState
type PrepaintState = PrepaintState
Element::prepaint. A mutable reference to this state is subsequently
provided to Element::paint.Source§fn id(&self) -> Option<ElementId>
fn id(&self) -> Option<ElementId>
Source§fn source_location(&self) -> Option<&'static Location<'static>>
fn source_location(&self) -> Option<&'static Location<'static>>
Source§fn request_layout(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
window: &mut Window,
cx: &mut App,
) -> (LayoutId, <Scrollbar as Element>::RequestLayoutState)
fn request_layout( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, window: &mut Window, cx: &mut App, ) -> (LayoutId, <Scrollbar as Element>::RequestLayoutState)
Source§fn prepaint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
bounds: Bounds<Pixels>,
_: &mut <Scrollbar as Element>::RequestLayoutState,
window: &mut Window,
cx: &mut App,
) -> <Scrollbar as Element>::PrepaintState
fn prepaint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, bounds: Bounds<Pixels>, _: &mut <Scrollbar as Element>::RequestLayoutState, window: &mut Window, cx: &mut App, ) -> <Scrollbar as Element>::PrepaintState
Element::request_layout().Source§fn paint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
_: Bounds<Pixels>,
_: &mut <Scrollbar as Element>::RequestLayoutState,
prepaint: &mut <Scrollbar as Element>::PrepaintState,
window: &mut Window,
cx: &mut App,
)
fn paint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, _: Bounds<Pixels>, _: &mut <Scrollbar as Element>::RequestLayoutState, prepaint: &mut <Scrollbar as Element>::PrepaintState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn a11y_role(&self) -> Option<Role>
fn a11y_role(&self) -> Option<Role>
None are not included in the accessibility tree. Read moreSource§fn write_a11y_info(&self, _node: &mut Node)
fn write_a11y_info(&self, _node: &mut Node)
a11y_role() returns Some. Read moreSource§fn a11y_synthetic_children(
&mut self,
_prepaint: &mut Self::PrepaintState,
_builder: &mut A11ySubtreeBuilder<'_>,
)
fn a11y_synthetic_children( &mut self, _prepaint: &mut Self::PrepaintState, _builder: &mut A11ySubtreeBuilder<'_>, )
Source§fn into_any(self) -> AnyElement
fn into_any(self) -> AnyElement
AnyElement.Source§impl IntoElement for Scrollbar
impl IntoElement for Scrollbar
Source§type Element = Scrollbar
type Element = Scrollbar
Source§fn into_element(self) -> <Scrollbar as IntoElement>::Element
fn into_element(self) -> <Scrollbar as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Auto Trait Implementations§
impl !RefUnwindSafe for Scrollbar
impl !Send for Scrollbar
impl !Sync for Scrollbar
impl !UnwindSafe for Scrollbar
impl Freeze for Scrollbar
impl Unpin for Scrollbar
impl UnsafeUnpin for Scrollbar
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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