pub struct ScrollView { /* private fields */ }Expand description
A scrollable view widget
Implementations§
Source§impl ScrollView
impl ScrollView
Sourcepub fn content_height(self, height: u16) -> Self
pub fn content_height(self, height: u16) -> Self
Set the total content height
Sourcepub fn scroll_offset(self, offset: u16) -> Self
pub fn scroll_offset(self, offset: u16) -> Self
Set the scroll offset
Sourcepub fn show_scrollbar(self, show: bool) -> Self
pub fn show_scrollbar(self, show: bool) -> Self
Enable/disable scrollbar
Sourcepub fn scrollbar_style(self, fg: Color, bg: Color) -> Self
pub fn scrollbar_style(self, fg: Color, bg: Color) -> Self
Set scrollbar colors
Sourcepub fn min_height(self, height: u16) -> Self
pub fn min_height(self, height: u16) -> Self
Set minimum height constraint
Sourcepub fn max_height(self, height: u16) -> Self
pub fn max_height(self, height: u16) -> Self
Set maximum height constraint (0 = no limit)
Sourcepub fn max_size(self, width: u16, height: u16) -> Self
pub fn max_size(self, width: u16, height: u16) -> Self
Set both max width and height (0 = no limit)
Sourcepub fn constrain(self, min_w: u16, min_h: u16, max_w: u16, max_h: u16) -> Self
pub fn constrain(self, min_w: u16, min_h: u16, max_w: u16, max_h: u16) -> Self
Set all size constraints at once
Sourcepub fn set_offset(&mut self, offset: u16, viewport_height: u16)
pub fn set_offset(&mut self, offset: u16, viewport_height: u16)
Set scroll offset with bounds checking
Sourcepub fn scroll_down(&mut self, lines: u16, viewport_height: u16)
pub fn scroll_down(&mut self, lines: u16, viewport_height: u16)
Scroll down by lines
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Scroll to top
Sourcepub fn scroll_to_bottom(&mut self, viewport_height: u16)
pub fn scroll_to_bottom(&mut self, viewport_height: u16)
Scroll to bottom
Sourcepub fn handle_mouse(&mut self, event: &MouseEvent, viewport_height: u16) -> bool
pub fn handle_mouse(&mut self, event: &MouseEvent, viewport_height: u16) -> bool
Handle mouse events, returns true if scroll changed
Sourcepub fn handle_key(&mut self, key: &Key, viewport_height: u16) -> bool
pub fn handle_key(&mut self, key: &Key, viewport_height: u16) -> bool
Handle key input, returns true if scroll changed
Sourcepub fn is_scrollable(&self, viewport_height: u16) -> bool
pub fn is_scrollable(&self, viewport_height: u16) -> bool
Check if content is scrollable
Sourcepub fn scroll_percentage(&self, viewport_height: u16) -> f32
pub fn scroll_percentage(&self, viewport_height: u16) -> f32
Get scroll percentage (0.0 - 1.0)
Sourcepub fn render_scrollbar(&self, ctx: &mut RenderContext<'_>)
pub fn render_scrollbar(&self, ctx: &mut RenderContext<'_>)
Render scrollbar
Sourcepub fn content_area(&self, area: Rect) -> Rect
pub fn content_area(&self, area: Rect) -> Rect
Get the visible area for content (excludes scrollbar)
Sourcepub fn create_content_buffer(&self, width: u16) -> Buffer
pub fn create_content_buffer(&self, width: u16) -> Buffer
Create a clipped buffer for scrolled content
Sourcepub fn render_content(
&self,
ctx: &mut RenderContext<'_>,
content_buffer: &Buffer,
)
pub fn render_content( &self, ctx: &mut RenderContext<'_>, content_buffer: &Buffer, )
Render scrolled content from a pre-rendered buffer
Source§impl ScrollView
impl ScrollView
Trait Implementations§
Source§impl Default for ScrollView
impl Default for ScrollView
Source§impl StyledView for ScrollView
impl StyledView for ScrollView
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
Source§impl View for ScrollView
impl View for ScrollView
Source§fn meta(&self) -> WidgetMeta
fn meta(&self) -> WidgetMeta
Get widget metadata for DOM Read more
Source§fn render(&self, ctx: &mut RenderContext<'_>)
fn render(&self, ctx: &mut RenderContext<'_>)
Render the view to the given context Read more
Source§fn widget_type(&self) -> &'static str
fn widget_type(&self) -> &'static str
Get widget type name (for CSS type selectors) Read more
Source§fn needs_render(&self) -> bool
fn needs_render(&self) -> bool
Check if this widget needs re-rendering Read more
Auto Trait Implementations§
impl Freeze for ScrollView
impl RefUnwindSafe for ScrollView
impl Send for ScrollView
impl Sync for ScrollView
impl Unpin for ScrollView
impl UnsafeUnpin for ScrollView
impl UnwindSafe for ScrollView
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