pub struct ScrollState {
pub offset: usize,
/* private fields */
}Expand description
State for a scrollable container.
Pass a mutable reference to Context::scrollable each frame. The context
updates offset and the internal bounds automatically based on mouse wheel
and drag events.
Fields§
§offset: usizeCurrent vertical scroll offset in rows.
Implementations§
Source§impl ScrollState
impl ScrollState
Sourcepub fn can_scroll_up(&self) -> bool
pub fn can_scroll_up(&self) -> bool
Check if scrolling upward is possible (offset is greater than 0).
Sourcepub fn can_scroll_down(&self) -> bool
pub fn can_scroll_down(&self) -> bool
Check if scrolling downward is possible (content extends below the viewport).
Sourcepub fn content_height(&self) -> u32
pub fn content_height(&self) -> u32
Get the total content height in rows.
Sourcepub fn viewport_height(&self) -> u32
pub fn viewport_height(&self) -> u32
Get the viewport height in rows.
Sourcepub fn scroll_up(&mut self, amount: usize)
pub fn scroll_up(&mut self, amount: usize)
Scroll up by the given number of rows, clamped to 0.
Sourcepub fn scroll_down(&mut self, amount: usize)
pub fn scroll_down(&mut self, amount: usize)
Scroll down by the given number of rows, clamped to the maximum offset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnsafeUnpin for ScrollState
impl UnwindSafe for ScrollState
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