Struct rat_widget::scrolled::ScrolledState
source · pub struct ScrolledState<WidgetState> {
pub widget: WidgetState,
pub area: Rect,
pub view_area: Rect,
pub h_scrollbar_area: Option<Rect>,
pub v_scrollbar_area: Option<Rect>,
pub v_overscroll: usize,
pub h_overscroll: usize,
pub v_drag: bool,
pub h_drag: bool,
pub non_exhaustive: NonExhaustive,
}Expand description
Scrolled state.
Fields§
§widget: WidgetStateState of the scrolled widget.
area: RectTotal screen area.
view_area: RectView area.
h_scrollbar_area: Option<Rect>Scrollbar area.
v_scrollbar_area: Option<Rect>Scrollbar area.
v_overscroll: usizeAllow overscroll by n items.
h_overscroll: usizeAllow overscroll by n items.
v_drag: boolmouse action in progress
h_drag: bool§non_exhaustive: NonExhaustiveImplementations§
source§impl<WState> ScrolledState<WState>where
WState: ScrollingState,
impl<WState> ScrolledState<WState>where
WState: ScrollingState,
sourcepub fn vertical_offset(&self) -> usize
pub fn vertical_offset(&self) -> usize
Current vertical offset.
sourcepub fn horizontal_offset(&self) -> usize
pub fn horizontal_offset(&self) -> usize
Current horizontal offset.
sourcepub fn set_vertical_offset(&mut self, offset: usize) -> bool
pub fn set_vertical_offset(&mut self, offset: usize) -> bool
Change the offset. Limits the offset to max_v_offset + v_overscroll.
Due to overscroll it’s possible that this is an invalid offset for the widget. The widget must deal with this situation.
sourcepub fn set_horizontal_offset(&mut self, offset: usize) -> bool
pub fn set_horizontal_offset(&mut self, offset: usize) -> bool
Change the offset. Limits the offset to max_h_offset + h_overscroll.
Due to overscroll it’s possible that this is an invalid offset for the widget. The widget must deal with this situation.
sourcepub fn scroll_down(&mut self, n: usize) -> bool
pub fn scroll_down(&mut self, n: usize) -> bool
Scroll down by n, but limited by the max_offset + overscroll
sourcepub fn scroll_left(&mut self, n: usize) -> bool
pub fn scroll_left(&mut self, n: usize) -> bool
Scroll up by n.
sourcepub fn scroll_right(&mut self, n: usize) -> bool
pub fn scroll_right(&mut self, n: usize) -> bool
Scroll right by n, but limited by the max_offset + overscroll
pub fn widget_mut(&mut self) -> &mut WState
Trait Implementations§
source§impl<WidgetState> Clone for ScrolledState<WidgetState>where
WidgetState: Clone,
impl<WidgetState> Clone for ScrolledState<WidgetState>where
WidgetState: Clone,
source§fn clone(&self) -> ScrolledState<WidgetState>
fn clone(&self) -> ScrolledState<WidgetState>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<WidgetState> Debug for ScrolledState<WidgetState>where
WidgetState: Debug,
impl<WidgetState> Debug for ScrolledState<WidgetState>where
WidgetState: Debug,
source§impl<WState> Default for ScrolledState<WState>where
WState: Default,
impl<WState> Default for ScrolledState<WState>where
WState: Default,
source§fn default() -> ScrolledState<WState>
fn default() -> ScrolledState<WState>
source§impl<R, WState> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ScrolledState<WState>where
WState: ScrollingState + HandleEvent<Event, FocusKeys, R> + HandleEvent<Event, MouseOnly, R>,
R: ConsumedEvent,
impl<R, WState> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ScrolledState<WState>where
WState: ScrollingState + HandleEvent<Event, FocusKeys, R> + HandleEvent<Event, MouseOnly, R>,
R: ConsumedEvent,
Handle events or the scrolled widget and forward to the inner widget.
source§impl<WState, Q, R> HandleEvent<Event, Inner<Q>, ScrollOutcome<R>> for ScrolledState<WState>
impl<WState, Q, R> HandleEvent<Event, Inner<Q>, ScrollOutcome<R>> for ScrolledState<WState>
Forward event-handling to the inner widget.
source§impl<R, WState> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ScrolledState<WState>
impl<R, WState> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ScrolledState<WState>
Handle events for the Scrolled widget and the scrollbars.
Auto Trait Implementations§
impl<WidgetState> Freeze for ScrolledState<WidgetState>where
WidgetState: Freeze,
impl<WidgetState> RefUnwindSafe for ScrolledState<WidgetState>where
WidgetState: RefUnwindSafe,
impl<WidgetState> Send for ScrolledState<WidgetState>where
WidgetState: Send,
impl<WidgetState> Sync for ScrolledState<WidgetState>where
WidgetState: Sync,
impl<WidgetState> Unpin for ScrolledState<WidgetState>where
WidgetState: Unpin,
impl<WidgetState> UnwindSafe for ScrolledState<WidgetState>where
WidgetState: UnwindSafe,
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
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