Struct rat_widget::scrolled::Scrolled

source ·
pub struct Scrolled<'a, T> { /* private fields */ }
Expand description

A wrapper widget that scrolls it’s content.

Implementations§

source§

impl<'a, T> Scrolled<'a, T>

source

pub fn new(inner: T) -> Scrolled<'a, T>

New scrolled widget.

source

pub fn vertical_overscroll(self, n: usize) -> Scrolled<'a, T>

Allow overscrolling the max_offset by n.

source

pub fn horizontal_overscroll(self, n: usize) -> Scrolled<'a, T>

Allow overscrolling the max_offset by n.

source

pub fn horizontal_scrollbar_policy( self, policy: ScrollbarPolicy, ) -> Scrolled<'a, T>

Horizontal scrollbar policy.

source

pub fn vertical_scrollbar_policy( self, policy: ScrollbarPolicy, ) -> Scrolled<'a, T>

Vertical scrollbar policy.

source

pub fn horizontal_scroll_position(self, pos: HScrollPosition) -> Scrolled<'a, T>

Position

source

pub fn vertical_scroll_position(self, pos: VScrollPosition) -> Scrolled<'a, T>

Position

source

pub fn block(self, block: Block<'a>) -> Scrolled<'a, T>

Block around the scrolled widget. The scrollbars are drawn as part of the block.

Attention: There must be a border at the sides where you want the scrollbars. Otherwise, the calculations for the scrollbar placement will be off somewhat.

source

pub fn styles(self, styles: ScrolledStyle) -> Scrolled<'a, T>

source

pub fn thumb_symbol(self, thumb_symbol: &'a str) -> Scrolled<'a, T>

Symbol for the Scrollbar.

source

pub fn thumb_style<S>(self, thumb_style: S) -> Scrolled<'a, T>
where S: Into<Style>,

Style for the Scrollbar.

source

pub fn track_symbol(self, track_symbol: Option<&'a str>) -> Scrolled<'a, T>

Symbol for the Scrollbar.

source

pub fn track_style<S>(self, track_style: S) -> Scrolled<'a, T>
where S: Into<Style>,

Style for the Scrollbar.

source

pub fn begin_symbol(self, begin_symbol: Option<&'a str>) -> Scrolled<'a, T>

Symbol for the Scrollbar.

source

pub fn begin_style<S>(self, begin_style: S) -> Scrolled<'a, T>
where S: Into<Style>,

Style for the Scrollbar.

source

pub fn end_symbol(self, end_symbol: Option<&'a str>) -> Scrolled<'a, T>

Symbol for the Scrollbar.

source

pub fn end_style<S>(self, end_style: S) -> Scrolled<'a, T>
where S: Into<Style>,

Style for the Scrollbar.

source

pub fn symbols(self, symbols: Set) -> Scrolled<'a, T>

Set all Scrollbar symbols.

source

pub fn style<S>(self, style: S) -> Scrolled<'a, T>
where S: Into<Style>,

Set a style for all Scrollbar styles.

source§

impl<'a, W> Scrolled<'a, View<W>>
where W: Widget,

source

pub fn new_view(inner: W) -> Scrolled<'a, View<W>>

Create a Scrolled<View<W>> widget for widgets without builtin scrolling behaviour.

You need to set a view_size for the area the inner widget shall receive.

See Viewport too.

source

pub fn view_size(self, size: Size) -> Scrolled<'a, View<W>>

Size for the inner widget.

source

pub fn view_style(self, style: Style) -> Scrolled<'a, View<W>>

Style for the empty space outside the rendered buffer.

source§

impl<'a, W> Scrolled<'a, Viewport<W>>
where W: StatefulWidget,

source

pub fn new_viewport(inner: W) -> Scrolled<'a, Viewport<W>>

Create a Scrolled<Viewport<W>> widget for widgets without builtin scrolling behaviour.

You need to set a view_size for the area the inner widget shall receive.

See Viewport too.

source

pub fn view_size(self, size: Size) -> Scrolled<'a, Viewport<W>>

Size for the inner widget.

source

pub fn view_style(self, style: Style) -> Scrolled<'a, Viewport<W>>

Style for the empty space outside the rendered buffer.

Trait Implementations§

source§

impl<'a, T> Clone for Scrolled<'a, T>
where T: Clone,

source§

fn clone(&self) -> Scrolled<'a, T>

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<'a, T> Debug for Scrolled<'a, T>
where T: Debug,

source§

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

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

impl<'a, T> Default for Scrolled<'a, T>
where T: Default,

source§

fn default() -> Scrolled<'a, T>

Returns the “default value” for a type. Read more
source§

impl<'a, W> StatefulWidget for Scrolled<'a, W>

§

type State = ScrolledState<<W as StatefulWidget>::State>

State associated with the stateful widget. Read more
source§

fn render( self, area: Rect, buf: &mut Buffer, state: &mut <Scrolled<'a, W> as StatefulWidget>::State, )

Draws the current state of the widget in the given buffer. That is the only method required to implement a custom stateful widget.
source§

impl<'a, W> StatefulWidgetRef for Scrolled<'a, W>

§

type State = ScrolledState<<W as StatefulWidgetRef>::State>

State associated with the stateful widget. Read more
source§

fn render_ref( &self, area: Rect, buf: &mut Buffer, state: &mut <Scrolled<'a, W> as StatefulWidgetRef>::State, )

Draws the current state of the widget in the given buffer. That is the only method required to implement a custom stateful widget.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Scrolled<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Scrolled<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Scrolled<'a, T>
where T: Send,

§

impl<'a, T> Sync for Scrolled<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Scrolled<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Scrolled<'a, T>
where T: 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.