pub struct Scrollbar<'a> { /* private fields */ }Expand description
Scrollbar widget for altui-core library.
This widget can be used to display a scrollbar in a terminal user interface. The following components of the scrollbar are customizable in symbol and style.
<--▮------->
^ ^ ^ ^
│ │ │ └ end
│ │ └──── track
│ └──────── thumb
└─────────── beginImplementations§
Source§impl<'a> Scrollbar<'a>
impl<'a> Scrollbar<'a>
pub fn new(orientation: ScrollbarOrientation) -> Self
Sourcepub fn orientation(self, orientation: ScrollbarOrientation) -> Self
pub fn orientation(self, orientation: ScrollbarOrientation) -> Self
Sets the orientation of the scrollbar.
Resets the symbols to DOUBLE_VERTICAL or DOUBLE_HORIZONTAL based on orientation
Sourcepub fn show_orientation(&self) -> ScrollbarOrientation
pub fn show_orientation(&self) -> ScrollbarOrientation
Shows scrollbar orientation
Sourcepub fn orientation_and_symbol(
self,
orientation: ScrollbarOrientation,
set: Set,
) -> Self
pub fn orientation_and_symbol( self, orientation: ScrollbarOrientation, set: Set, ) -> Self
Sets the orientation and symbols for the scrollbar from a [Set].
Sourcepub fn thumb_symbol(self, thumb_symbol: &'a str) -> Self
pub fn thumb_symbol(self, thumb_symbol: &'a str) -> Self
Sets the symbol that represents the thumb of the scrollbar.
Sourcepub fn thumb_style(self, thumb_style: Style) -> Self
pub fn thumb_style(self, thumb_style: Style) -> Self
Sets the style that represents the thumb of the scrollbar.
Sourcepub fn track_symbol(self, track_symbol: &'a str) -> Self
pub fn track_symbol(self, track_symbol: &'a str) -> Self
Sets the symbol that represents the track of the scrollbar.
Sourcepub fn track_style(self, track_style: Style) -> Self
pub fn track_style(self, track_style: Style) -> Self
Sets the style that is used for the track of the scrollbar.
Sourcepub fn begin_symbol(self, begin_symbol: Option<&'a str>) -> Self
pub fn begin_symbol(self, begin_symbol: Option<&'a str>) -> Self
Sets the symbol that represents the beginning of the scrollbar.
Sourcepub fn begin_style(self, begin_style: Style) -> Self
pub fn begin_style(self, begin_style: Style) -> Self
Sets the style that is used for the beginning of the scrollbar.
Sourcepub fn end_symbol(self, end_symbol: Option<&'a str>) -> Self
pub fn end_symbol(self, end_symbol: Option<&'a str>) -> Self
Sets the symbol that represents the end of the scrollbar.
Sourcepub fn end_style(self, end_style: Style) -> Self
pub fn end_style(self, end_style: Style) -> Self
Sets the style that is used for the end of the scrollbar.
Sourcepub fn symbols(self, symbol: Set) -> Self
pub fn symbols(self, symbol: Set) -> Self
Sets the symbols used for the various parts of the scrollbar from a [Set].
<--▮------->
^ ^ ^ ^
│ │ │ └ end
│ │ └──── track
│ └──────── thumb
└─────────── beginOnly sets begin_symbol and end_symbol if they already contain a value.
If begin_symbol and/or end_symbol were set to None explicitly, this function will respect
that choice.
Sourcepub fn style(self, style: Style) -> Self
pub fn style(self, style: Style) -> Self
Sets the style used for the various parts of the scrollbar from a Style.
<--▮------->
^ ^ ^ ^
│ │ │ └ end
│ │ └──── track
│ └──────── thumb
└─────────── beginSourcepub fn offset(&mut self, offset: u16)
pub fn offset(&mut self, offset: u16)
Sets the scroll position of the scrollbar and returns the modified ScrollbarState.
Sourcepub fn position(&mut self, position: u16)
pub fn position(&mut self, position: u16)
Sets the scroll position of the scrollbar and returns the modified ScrollbarState.
Sourcepub fn content_length(&mut self, content_length: u16)
pub fn content_length(&mut self, content_length: u16)
Sets the length of the scrollable content and returns the modified ScrollbarState.
Sourcepub fn viewport_content_length(&mut self, viewport_content_length: u16)
pub fn viewport_content_length(&mut self, viewport_content_length: u16)
Sets the length of the viewport content and returns the modified ScrollbarState.
Sourcepub fn prev(&mut self)
pub fn prev(&mut self)
Decrements the scroll position by one, ensuring it doesn’t go below zero.
Sourcepub fn next(&mut self)
pub fn next(&mut self)
Increments the scroll position by one, ensuring it doesn’t exceed the length of the content.
Sourcepub fn scroll(&mut self, direction: ScrollDirection)
pub fn scroll(&mut self, direction: ScrollDirection)
Changes the scroll position based on the provided ScrollDirection.