Skip to main content

ScrollArea

Struct ScrollArea 

Source
pub struct ScrollArea {
    pub pos_x: usize,
    pub pos_y: usize,
    pub width: usize,
    pub height: usize,
    pub content_height: usize,
    pub scroll_speed: f32,
    pub scrollbar_width: usize,
    pub scrollbar_color: Color,
    pub scrollbar_track_color: Color,
    pub scrollbar_radius: usize,
    /* private fields */
}

Fields§

§pos_x: usize§pos_y: usize§width: usize§height: usize§content_height: usize§scroll_speed: f32§scrollbar_width: usize§scrollbar_color: Color§scrollbar_track_color: Color§scrollbar_radius: usize

Implementations§

Source§

impl ScrollArea

Source

pub fn position(self, x: usize, y: usize) -> Self

Source

pub fn size(self, width: usize, height: usize) -> Self

Source

pub fn content_height(self, h: usize) -> Self

Source

pub fn scroll_speed(self, speed: f32) -> Self

Source

pub fn scrollbar_width(self, w: usize) -> Self

Source

pub fn scrollbar_color(self, color: Color) -> Self

Source

pub fn scrollbar_track_color(self, color: Color) -> Self

Source

pub fn scrollbar_radius(self, r: usize) -> Self

Source

pub fn set_content_height(&mut self, h: usize)

Sets the content height dynamically (call before draw each frame if content changes)

Source

pub fn offset(&self) -> f32

Returns current scroll offset in pixels

Source

pub fn set_offset(&mut self, offset: f32)

Sets scroll offset directly

Source

pub fn can_scroll(&self) -> bool

Returns true if content overflows the visible area

Source

pub fn begin_draw(&mut self, window: &mut Window)

Updates scroll state (call once per frame, before drawing content) Pushes a clip region. Call end_draw after drawing content.

Source

pub fn end_draw(&self, window: &mut Window)

Ends the scroll area draw (pops clip) and draws scrollbar

Trait Implementations§

Source§

impl Default for ScrollArea

Source§

fn default() -> Self

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

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.