pub struct Waveform {
paintable: WaveformPaintable,
position: Cell<f32>,
animation: OnceCell<TimedAnimation>,
hover_position: Cell<Option<f32>>,
paintable_cache: RefCell<Option<Paintable>>,
}Fields§
§paintable: WaveformPaintableThe paintable that draws the waveform.
position: Cell<f32>The current position in the audio stream.
Must be a value between 0 and 1.
animation: OnceCell<TimedAnimation>The animation for the transition between waveforms.
hover_position: Cell<Option<f32>>The current hover position, if any.
paintable_cache: RefCell<Option<Paintable>>The cached paintable.
We only need to redraw it when the waveform changes of the widget is resized.
Implementations§
Source§impl Waveform
impl Waveform
Sourcefn register_type()
fn register_type()
Registers the type only once.
Source§impl Waveform
impl Waveform
Sourcepub(super) fn set_waveform(&self, waveform: Vec<f32>)
pub(super) fn set_waveform(&self, waveform: Vec<f32>)
Set the waveform to display.
The values must be normalized between 0 and 1.
Sourcepub(super) fn set_position(&self, position: f32)
pub(super) fn set_position(&self, position: f32)
Set the current position in the audio stream.
Sourcefn animation(&self) -> &TimedAnimation
fn animation(&self) -> &TimedAnimation
The animation for the waveform change.
fn paintable(&self) -> Option<Paintable>
Sourcefn x_coord_to_position(&self, x: f64) -> f32
fn x_coord_to_position(&self, x: f64) -> f32
Convert the given x coordinate on the waveform to a relative position.
Takes into account the text direction.
Returns a value between 0 and 1.
Sourcefn emit_seek(&self, new_position: f32)
fn emit_seek(&self, new_position: f32)
Emit the seek signal with the given new position, if it is
different from the current position.
Sourcefn init_event_controllers(&self)
fn init_event_controllers(&self)
Initialize the event controllers on the waveform.
Trait Implementations§
Source§impl DerivedObjectProperties for Waveform
impl DerivedObjectProperties for Waveform
Source§fn derived_properties() -> &'static [ParamSpec]
fn derived_properties() -> &'static [ParamSpec]
Source§fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
ObjectImpl but auto-generated by the Properties macro
to allow handling more complex use-cases.Source§fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
ObjectImpl but auto-generated by the Properties macro
to allow handling more complex use-cases.Source§impl ObjectImpl for Waveform
impl ObjectImpl for Waveform
Source§fn constructed(&self)
fn constructed(&self)
Source§fn properties() -> &'static [ParamSpec]
fn properties() -> &'static [ParamSpec]
Source§fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
Source§fn notify(&self, pspec: &ParamSpec)
fn notify(&self, pspec: &ParamSpec)
self.notify("property").fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])
Source§impl ObjectSubclass for Waveform
impl ObjectSubclass for Waveform
Source§type Interfaces = ()
type Interfaces = ()
Source§type ParentType = Widget
type ParentType = Widget
Source§fn class_init(klass: &mut Self::Class)
fn class_init(klass: &mut Self::Class)
Source§const ALLOW_NAME_CONFLICT: bool = false
const ALLOW_NAME_CONFLICT: bool = false
Source§fn type_init(_type_: &mut InitializingType<Self>)
fn type_init(_type_: &mut InitializingType<Self>)
Source§fn with_class(_klass: &Self::Class) -> Self
fn with_class(_klass: &Self::Class) -> Self
Source§fn instance_init(_obj: &InitializingObject<Self>)
fn instance_init(_obj: &InitializingObject<Self>)
Source§impl ObjectSubclassType for Waveform
impl ObjectSubclassType for Waveform
Source§impl WidgetImpl for Waveform
impl WidgetImpl for Waveform
fn request_mode(&self) -> SizeRequestMode
fn measure( &self, orientation: Orientation, _for_size: i32, ) -> (i32, i32, i32, i32)
fn size_allocate(&self, width: i32, _height: i32, _baseline: i32)
fn snapshot(&self, snapshot: &Snapshot)
fn compute_expand(&self, hexpand: &mut bool, vexpand: &mut bool)
fn contains(&self, x: f64, y: f64) -> bool
fn direction_changed(&self, previous_direction: TextDirection)
fn focus(&self, direction_type: DirectionType) -> bool
fn grab_focus(&self) -> bool
fn map(&self)
fn mnemonic_activate(&self, group_cycling: bool) -> bool
fn move_focus(&self, direction_type: DirectionType)
fn query_tooltip( &self, x: i32, y: i32, keyboard_tooltip: bool, tooltip: &Tooltip, ) -> bool
fn realize(&self)
fn root(&self)
fn set_focus_child(&self, child: Option<&Widget>)
fn state_flags_changed(&self, state_flags: &StateFlags)
fn system_setting_changed(&self, settings: &SystemSetting)
fn unmap(&self)
fn unrealize(&self)
fn unroot(&self)
Auto Trait Implementations§
impl !Freeze for Waveform
impl !RefUnwindSafe for Waveform
impl !Send for Waveform
impl !Sync for Waveform
impl Unpin for Waveform
impl UnwindSafe for Waveform
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
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
Source§fn parent_constructed(&self)
fn parent_constructed(&self)
glib::Object::constructed().Source§fn parent_notify(&self, pspec: &ParamSpec)
fn parent_notify(&self, pspec: &ParamSpec)
glib::Object::notify().Source§fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
glib::Object::dispatch_properties_changed().Source§fn signal_chain_from_overridden(
&self,
token: &SignalClassHandlerToken,
values: &[Value],
) -> Option<Value>
fn signal_chain_from_overridden( &self, token: &SignalClassHandlerToken, values: &[Value], ) -> Option<Value>
Source§impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
Source§fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Source§fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
Source§fn ref_counted(&self) -> ObjectImplRef<T>
fn ref_counted(&self) -> ObjectImplRef<T>
self.