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: S

Widget state.

§area: Rect

The drawing area for the viewport.

§view_area: Rect

The viewport area that the inner widget sees.

§h_offset: usize

Horizontal offset

§v_offset: usize

Vertical offset

§non_exhaustive: NonExhaustive

Only construct with ..Default::default().

Implementations§

source§

impl<S> ViewportState<S>

source

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,

source§

fn clone(&self) -> ViewportState<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S> Debug for ViewportState<S>
where S: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<S> Default for ViewportState<S>
where S: Default,

source§

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>

Handle events if the widget has the focus.

source§

fn handle(&mut self, event: &Event, _keymap: FocusKeys) -> ScrollOutcome<R>

Handle an event. Read more
source§

impl<R, S> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ViewportState<S>

Handle only mouse-events.

source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> ScrollOutcome<R>

Handle an event. Read more
source§

impl<S> ScrollingState for ViewportState<S>

source§

fn vertical_max_offset(&self) -> usize

Maximum offset that is accessible with scrolling. Read more
source§

fn vertical_offset(&self) -> usize

Current vertical offset.
source§

fn vertical_page(&self) -> usize

Vertical page-size at the current offset.
source§

fn horizontal_max_offset(&self) -> usize

Maximum offset that is accessible with scrolling. Read more
source§

fn horizontal_offset(&self) -> usize

Current horizontal offset.
source§

fn horizontal_page(&self) -> usize

Horizontal page-size at the current offset.
source§

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

Change the horizontal offset. Read more
source§

fn vertical_scroll(&self) -> usize

Suggested scroll per scroll-event.
source§

fn horizontal_scroll(&self) -> usize

Suggested scroll per scroll-event.
source§

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

Scroll down by n items. The widget returns true if the offset changed at all.
source§

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

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.