[][src]Struct iced_audio::native::knob::Knob

pub struct Knob<'a, Message, Renderer: Renderer, ID> where
    ID: Debug + Copy + Clone
{ /* fields omitted */ }

A rotating knob GUI widget that controls a Param

Implementations

impl<'a, Message, Renderer: Renderer, ID> Knob<'a, Message, Renderer, ID> where
    ID: Debug + Copy + Clone
[src]

pub fn new<F>(
    state: &'a mut State,
    param: &impl Param<ID = ID>,
    on_change: F
) -> Self where
    F: 'static + Fn((ID, Normal)) -> Message, 
[src]

Creates a new Knob.

It expects:

  • the local State of the Knob
  • a Param with the current and default values
  • a function that will be called when the Knob is turned. It receives the parameter's ID and the new Normal of the Knob. ID is a user supplied type. It can be an enum, u32, i32, String, etc. Each parameter must have a unique ID value!

pub fn size(self, size: Length) -> Self[src]

Sets the diameter of the Knob. The default size is Length::from(Length::Units(31)).

pub fn style(self, style: impl Into<Renderer::Style>) -> Self[src]

Sets the style of the Knob.

pub fn scalar(self, scalar: f32) -> Self[src]

Sets how much the Normal value will change for the Knob per y pixel movement of the mouse.

The default value is 0.008

pub fn modifier_keys(self, modifier_keys: ModifiersState) -> Self[src]

Sets the modifier keys of the Knob.

The default modifier key is Ctrl.

pub fn modifier_scalar(self, scalar: f32) -> Self[src]

Sets the scalar to use when the user drags the knobs while holding down the modifier key. This is multiplied to the value set by Knob::scalar() (which the default is 0.008).

For example, a modifier_scalar of 0.5 will cause the knob to turn half as fast when the modifier key is down.

The default modifier_scalar is 0.02, and the default modifier key is Ctrl.

pub fn tick_marks(self, tick_marks: &'a TickMarkGroup) -> Self[src]

Sets the TickMarkGroup to display. Note your StyleSheet must also implement tick_mark_style(&self) -> Option<TickMarkStyle> for them to display (which the default style does).

Trait Implementations

impl<'a, Message, Renderer, ID> From<Knob<'a, Message, Renderer, ID>> for Element<'a, Message, Renderer> where
    Renderer: 'a + Renderer,
    Message: 'a,
    ID: 'a + Debug + Copy + Clone
[src]

impl<'a, Message, Renderer, ID> Widget<Message, Renderer> for Knob<'a, Message, Renderer, ID> where
    Renderer: Renderer,
    ID: Debug + Copy + Clone
[src]

Auto Trait Implementations

impl<'a, Message, Renderer, ID> !RefUnwindSafe for Knob<'a, Message, Renderer, ID>

impl<'a, Message, Renderer, ID> !Send for Knob<'a, Message, Renderer, ID>

impl<'a, Message, Renderer, ID> !Sync for Knob<'a, Message, Renderer, ID>

impl<'a, Message, Renderer, ID> Unpin for Knob<'a, Message, Renderer, ID> where
    ID: Unpin,
    <Renderer as Renderer>::Style: Unpin

impl<'a, Message, Renderer, ID> !UnwindSafe for Knob<'a, Message, Renderer, ID>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> SetParameter for T

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,