[][src]Struct cursive::views::SliderView

pub struct SliderView { /* fields omitted */ }

A horizontal or vertical slider.

Methods

impl SliderView[src]

pub fn new(orientation: Orientation, max_value: usize) -> Self[src]

Creates a new SliderView in the given orientation.

The view will have a fixed length of max_value, with one tick per block.

pub fn vertical(max_value: usize) -> Self[src]

Creates a new vertical SliderView.

pub fn horizontal(max_value: usize) -> Self[src]

Creates a new horizontal SliderView.

pub fn set_value(&mut self, value: usize) -> EventResult[src]

Sets the current value.

Returns an event result with a possible callback, if on_change was set..

pub fn value(self, value: usize) -> Self[src]

Sets the current value.

Chainable variant.

pub fn on_change<F>(self, callback: F) -> Self where
    F: Fn(&mut Cursive, usize) + 'static, 
[src]

Sets a callback to be called when the slider is moved.

pub fn on_enter<F>(self, callback: F) -> Self where
    F: Fn(&mut Cursive, usize) + 'static, 
[src]

Sets a callback to be called when the key is pressed.

Trait Implementations

impl View for SliderView[src]

fn layout(&mut self, _: Vec2)[src]

Called once the size for this view has been decided. Read more

fn needs_relayout(&self) -> bool[src]

Should return true if the view content changed since the last call to layout(). Read more

fn call_on_any<'a>(&mut self, _: &Selector, _: AnyCb<'a>)[src]

Runs a closure on the view identified by the given selector. Read more

fn focus_view(&mut self, _: &Selector) -> Result<(), ()>[src]

Moves the focus to the view identified by the given selector. Read more

fn important_area(&self, view_size: Vec2) -> Rect[src]

What part of the view is important and should be visible? Read more

Auto Trait Implementations

impl !Send for SliderView

impl !Sync for SliderView

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Erased for T[src]