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,
impl<'a, Message, Theme> HSlider<'a, Message, Theme>where
Theme: StyleSheet,
Sourcepub fn new(normal_param: impl Into<NormalParam>) -> Self
pub fn new(normal_param: impl Into<NormalParam>) -> Self
Creates a new HSlider.
normal_param- The normalized value of the parameter.
Sourcepub fn on_gesture(self, on_gesture: impl 'a + FnMut(Gesture) -> Message) -> Self
pub fn on_gesture(self, on_gesture: impl 'a + FnMut(Gesture) -> Message) -> Self
Sets the message to emit when the user gestures this widget.
Sourcepub fn config(self, config: &Config) -> Self
pub fn config(self, config: &Config) -> Self
Set a custom configuration to use for this virtual slider.
Sourcepub fn drag_horizontally(self, drag_horizontally: bool) -> Self
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.
Sourcepub const fn enabled(self, enabled: bool) -> Self
pub const fn enabled(self, enabled: bool) -> Self
Enable/disable this widget.
The default is true.
Sourcepub fn width(self, width: Length) -> Self
pub fn width(self, width: Length) -> Self
Sets the width of the HSlider.
The default height is Length::Fill.
Sourcepub fn height(self, height: Length) -> Self
pub fn height(self, height: Length) -> Self
Sets the height of the HSlider.
The default height is Length::Fixed(14).
Sourcepub fn style(self, style: impl Into<<Theme as StyleSheet>::Style>) -> Self
pub fn style(self, style: impl Into<<Theme as StyleSheet>::Style>) -> Self
Sets the style of the HSlider.
Sourcepub fn tick_marks(self, tick_marks: &'a Group) -> Self
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).
Sourcepub fn text_marks(self, text_marks: &'a Group) -> Self
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).
Sourcepub fn mod_range(self, mod_range: Option<&'a ModulationRange>) -> Self
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.
Sourcepub fn mod_range_2(self, mod_range: Option<&'a ModulationRange>) -> Self
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>
impl<'a, Message, Theme, Renderer> From<HSlider<'a, Message, Theme>> for Element<'a, Message, Theme, Renderer>
Source§impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> for HSlider<'a, Message, Theme>
impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer> for HSlider<'a, Message, Theme>
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,
)
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, )
Source§fn draw(
&self,
state: &Tree,
renderer: &mut Renderer,
theme: &Theme,
_style: &Style,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
)
fn draw( &self, state: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, )
Widget using the associated Renderer.