Struct rat_widget::scrolled::ViewportState
source · pub struct ViewportState<S> {
pub widget: S,
pub area: Rect,
pub view_area: Rect,
pub h_offset: usize,
pub v_offset: usize,
pub non_exhaustive: NonExhaustive,
}Expand description
State of the viewport.
Fields§
§widget: SWidget state.
area: RectThe drawing area for the viewport.
view_area: RectThe viewport area that the inner widget sees.
h_offset: usizeHorizontal offset
v_offset: usizeVertical offset
non_exhaustive: NonExhaustiveOnly construct with ..Default::default().
Implementations§
source§impl<S> ViewportState<S>
impl<S> ViewportState<S>
sourcepub fn relocate_crossterm(&self, event: &Event) -> Event
pub fn relocate_crossterm(&self, event: &Event) -> Event
Relocate mouse-events for use inside the viewport.
Trait Implementations§
source§impl<S> Clone for ViewportState<S>where
S: Clone,
impl<S> Clone for ViewportState<S>where
S: Clone,
source§fn clone(&self) -> ViewportState<S>
fn clone(&self) -> ViewportState<S>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<S> Debug for ViewportState<S>where
S: Debug,
impl<S> Debug for ViewportState<S>where
S: Debug,
source§impl<S> Default for ViewportState<S>where
S: Default,
impl<S> Default for ViewportState<S>where
S: Default,
source§fn default() -> ViewportState<S>
fn default() -> ViewportState<S>
Returns the “default value” for a type. Read more
source§impl<R, S> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ViewportState<S>
impl<R, S> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ViewportState<S>
Handle events if the widget has the focus.
source§impl<R, S> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ViewportState<S>
impl<R, S> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ViewportState<S>
Handle only mouse-events.
source§impl<S> ScrollingState for ViewportState<S>
impl<S> ScrollingState for ViewportState<S>
source§fn vertical_max_offset(&self) -> usize
fn vertical_max_offset(&self) -> usize
Maximum offset that is accessible with scrolling. Read more
source§fn vertical_offset(&self) -> usize
fn vertical_offset(&self) -> usize
Current vertical offset.
source§fn vertical_page(&self) -> usize
fn vertical_page(&self) -> usize
Vertical page-size at the current offset.
source§fn horizontal_max_offset(&self) -> usize
fn horizontal_max_offset(&self) -> usize
Maximum offset that is accessible with scrolling. Read more
source§fn horizontal_offset(&self) -> usize
fn horizontal_offset(&self) -> usize
Current horizontal offset.
source§fn horizontal_page(&self) -> usize
fn horizontal_page(&self) -> usize
Horizontal page-size at the current offset.
source§fn set_vertical_offset(&mut self, offset: usize) -> bool
fn set_vertical_offset(&mut self, offset: usize) -> bool
Change the vertical offset. Read more
source§fn set_horizontal_offset(&mut self, offset: usize) -> bool
fn set_horizontal_offset(&mut self, offset: usize) -> bool
Change the horizontal offset. Read more
source§fn vertical_scroll(&self) -> usize
fn vertical_scroll(&self) -> usize
Suggested scroll per scroll-event.
source§fn horizontal_scroll(&self) -> usize
fn horizontal_scroll(&self) -> usize
Suggested scroll per scroll-event.
source§fn scroll_up(&mut self, n: usize) -> bool
fn scroll_up(&mut self, n: usize) -> bool
Scroll up by n items.
The widget returns true if the offset changed at all.
source§fn scroll_down(&mut self, n: usize) -> bool
fn scroll_down(&mut self, n: usize) -> bool
Scroll down by n items.
The widget returns true if the offset changed at all.
source§fn scroll_left(&mut self, n: usize) -> bool
fn scroll_left(&mut self, n: usize) -> bool
Scroll up by n items.
The widget returns true if the offset changed at all.
source§fn scroll_right(&mut self, n: usize) -> bool
fn scroll_right(&mut self, n: usize) -> bool
Scroll down by n items.
The widget returns true if the offset changed at all.
Auto Trait Implementations§
impl<S> Freeze for ViewportState<S>where
S: Freeze,
impl<S> RefUnwindSafe for ViewportState<S>where
S: RefUnwindSafe,
impl<S> Send for ViewportState<S>where
S: Send,
impl<S> Sync for ViewportState<S>where
S: Sync,
impl<S> Unpin for ViewportState<S>where
S: Unpin,
impl<S> UnwindSafe for ViewportState<S>where
S: 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
Mutably borrows from an owned value. Read more
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>
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 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>
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