[−][src]Struct cursive::views::SliderView
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 get_value(&self) -> usize
[src]
Gets the current value.
pub fn get_max_value(&self) -> usize
[src]
Gets the max value.
pub fn on_change<F>(self, callback: F) -> Self where
F: Fn(&mut Cursive, usize) + 'static,
[src]
F: Fn(&mut Cursive, usize) + 'static,
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]
F: Fn(&mut Cursive, usize) + 'static,
Sets a callback to be called when the
Trait Implementations
impl View for SliderView
[src]
fn draw(&self, printer: &Printer)
[src]
fn required_size(&mut self, _: Vec2) -> Vec2
[src]
fn on_event(&mut self, event: Event) -> EventResult
[src]
fn take_focus(&mut self, _: Direction) -> bool
[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 Unpin for SliderView
impl !Sync for SliderView
impl !Send for SliderView
impl !UnwindSafe for SliderView
impl !RefUnwindSafe for SliderView
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,