pub struct Knob<T>where
T: NormalizedMap,{
pub normalized_value: f32,
pub map: T,
/* private fields */
}Fields§
§normalized_value: f32§map: TImplementations§
Source§impl<T> Knob<T>where
T: NormalizedMap,
impl<T> Knob<T>where
T: NormalizedMap,
pub fn new(map: T, normalized_default: f32) -> Knob<T>
pub fn map(&self) -> &T
Sourcepub fn on_changing<F>(self, callback: F) -> Knob<T>
pub fn on_changing<F>(self, callback: F) -> Knob<T>
Set the callback triggered when the slider value is changing (dragging).
Takes a closure which triggers when the slider value is changing, either by pressing the track or dragging the thumb along the track.
§Example
Slider::new()
.on_changing(|slider, state, entity| {
entity.emit(WindowEvent::Debug(format!("Slider on_changing: {}", slider.value)));
})
.build(state, parent, |builder| builder);pub fn set_centered(self, val: bool) -> Knob<T>
Trait Implementations§
Source§impl<T> Widget for Knob<T>where
T: NormalizedMap,
impl<T> Widget for Knob<T>where
T: NormalizedMap,
type Ret = Entity
type Data = f32
fn on_build( &mut self, state: &mut State, entity: Entity, ) -> <Knob<T> as Widget>::Ret
fn on_update( &mut self, state: &mut State, _entity: Entity, data: &<Knob<T> as Widget>::Data, )
fn on_event(&mut self, state: &mut State, entity: Entity, event: &mut Event)
fn widget_name(&self) -> String
Source§fn build<F>(
self,
state: &mut State,
parent: impl AsEntity,
builder: F,
) -> Self::Ret
fn build<F>( self, state: &mut State, parent: impl AsEntity, builder: F, ) -> Self::Ret
Adds the widget into state and returns the associated type Ret - an entity id or a tuple of entity ids
fn bind<L, F>(self, lens: L, converter: F) -> Wrapper<L, Self>
fn bind2<L>(self, lens: L) -> LensWrap<L, Self>where
L: Lens,
fn on_style( &mut self, state: &mut State, entity: Entity, property: (String, PropType), )
fn on_draw( &mut self, state: &mut State, entity: Entity, canvas: &mut Canvas<OpenGl>, )
Auto Trait Implementations§
impl<T> Freeze for Knob<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Knob<T>
impl<T> !Send for Knob<T>
impl<T> !Sync for Knob<T>
impl<T> Unpin for Knob<T>where
T: Unpin,
impl<T> !UnwindSafe for Knob<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more