Skip to main content

HSlider

Struct HSlider 

Source
pub struct HSlider<'a, Message, Theme: StyleSheet> { /* private fields */ }
Expand description

A horizontal slider GUI widget that controls a NormalParam

an HSlider will try to fill the horizontal space of its container.

Implementations§

Source§

impl<'a, Message, Theme> HSlider<'a, Message, Theme>
where Theme: StyleSheet,

Source

pub fn new(normal_param: impl Into<NormalParam>) -> Self
where <Theme as StyleSheet>::Style: Default,

Creates a new HSlider.

  • normal_param - The normalized value of the parameter.
Source

pub fn on_gesture(self, on_gesture: impl 'a + FnMut(Gesture) -> Message) -> Self

Sets the message to emit when the user gestures this widget.

Source

pub fn config(self, config: &Config) -> Self

Set a custom configuration to use for this virtual slider.

Source

pub fn drag_horizontally(self, drag_horizontally: bool) -> Self

Set whether this slider is dragged horizontally (true) or vertically (false).

The default value is true.

Source

pub const fn enabled(self, enabled: bool) -> Self

Enable/disable this widget.

The default is true.

Source

pub fn width(self, width: Length) -> Self

Sets the width of the HSlider.

The default height is Length::Fill.

Source

pub fn height(self, height: Length) -> Self

Sets the height of the HSlider.

The default height is Length::Fixed(14).

Source

pub fn style(self, style: impl Into<<Theme as StyleSheet>::Style>) -> Self

Sets the style of the HSlider.

Source

pub fn tick_marks(self, tick_marks: &'a Group) -> Self

Sets the tick marks to display. Note your StyleSheet must also implement tick_marks_style(&self) -> Option<tick_marks::Style> for them to display (which the default style does).

Source

pub fn text_marks(self, text_marks: &'a Group) -> Self

Sets the text marks to display. Note your StyleSheet must also implement text_marks_style(&self) -> Option<text_marks::Style> for them to display (which the default style does).

Source

pub fn mod_range(self, mod_range: Option<&'a ModulationRange>) -> Self

Sets a ModulationRange to display. Note your StyleSheet must also implement mod_range_style(&self) -> Option<ModRangeStyle> for them to display.

Source

pub fn mod_range_2(self, mod_range: Option<&'a ModulationRange>) -> Self

Sets a second ModulationRange to display. Note your StyleSheet must also implement mod_range_style_2(&self) -> Option<ModRangeStyle> for them to display.

Trait Implementations§

Source§

impl<'a, Message, Theme, Renderer> From<HSlider<'a, Message, Theme>> for Element<'a, Message, Theme, Renderer>
where Message: 'a, Theme: 'a + StyleSheet, Renderer: Renderer + Renderer<Font = Font> + Renderer<Handle = Handle>,

Source§

fn from(h_slider: HSlider<'a, Message, Theme>) -> Self

Converts to this type from the input type.
Source§

impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> for HSlider<'a, Message, Theme>
where Theme: StyleSheet, Renderer: Renderer + Renderer<Font = Font> + Renderer<Handle = Handle>,

Source§

fn tag(&self) -> Tag

Returns the Tag of the Widget.
Source§

fn state(&self) -> State

Returns the State of the Widget.
Source§

fn size(&self) -> Size<Length>

Returns the Size of the Widget in lengths.
Source§

fn layout( &mut self, _tree: &mut Tree, _renderer: &Renderer, limits: &Limits, ) -> Node

Returns the layout::Node of the Widget. Read more
Source§

fn update( &mut self, tree: &mut Tree, event: &Event, layout: Layout<'_>, cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, _viewport: &Rectangle, )

Processes a runtime Event. Read more
Source§

fn draw( &self, state: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, )

Draws the Widget using the associated Renderer.
Source§

fn size_hint(&self) -> Size<Length>

Returns a Size hint for laying out the Widget. Read more
Source§

fn children(&self) -> Vec<Tree>

Returns the state Tree of the children of the Widget.
Source§

fn diff(&self, tree: &mut Tree)

Reconciles the Widget with the provided Tree.
Source§

fn operate( &mut self, _tree: &mut Tree, _layout: Layout<'_>, _renderer: &Renderer, _operation: &mut dyn Operation, )

Applies an Operation to the Widget.
Source§

fn mouse_interaction( &self, _tree: &Tree, _layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction

Returns the current mouse::Interaction of the Widget. Read more
Source§

fn overlay<'a>( &'a mut self, _tree: &'a mut Tree, _layout: Layout<'a>, _renderer: &Renderer, _viewport: &Rectangle, _translation: Vector, ) -> Option<Element<'a, Message, Theme, Renderer>>

Returns the overlay of the Widget, if there is any.

Auto Trait Implementations§

§

impl<'a, Message, Theme> !RefUnwindSafe for HSlider<'a, Message, Theme>

§

impl<'a, Message, Theme> !Send for HSlider<'a, Message, Theme>

§

impl<'a, Message, Theme> !Sync for HSlider<'a, Message, Theme>

§

impl<'a, Message, Theme> !UnwindSafe for HSlider<'a, Message, Theme>

§

impl<'a, Message, Theme> Freeze for HSlider<'a, Message, Theme>
where <Theme as StyleSheet>::Style: Freeze,

§

impl<'a, Message, Theme> Unpin for HSlider<'a, Message, Theme>
where <Theme as StyleSheet>::Style: Unpin,

§

impl<'a, Message, Theme> UnsafeUnpin for HSlider<'a, Message, Theme>
where <Theme as StyleSheet>::Style: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.