pub struct Timeline<'a, Message> { /* private fields */ }timeline only.Expand description
A timeline builder. Convert it into an Element to render.
A timeline without a message is rendered disabled.
Implementations§
Source§impl<'a, Message> Timeline<'a, Message>
impl<'a, Message> Timeline<'a, Message>
Sourcepub fn lanes(self, lanes: impl IntoIterator<Item = Lane<'a>>) -> Self
pub fn lanes(self, lanes: impl IntoIterator<Item = Lane<'a>>) -> Self
Adds several lanes below the track.
Sourcepub fn label_width(self, width: f32) -> Self
pub fn label_width(self, width: f32) -> Self
Width of the lane labels. Only used when there are lanes.
pub fn width(self, width: impl Into<Length>) -> Self
Sourcepub fn label(self, label: impl IntoFragment<'a>) -> Self
pub fn label(self, label: impl IntoFragment<'a>) -> Self
The name tests and assistive tools know it by. “Timeline” by default.
Sourcepub fn on_select(self, on_select: impl Fn(usize) -> Message + 'a) -> Self
pub fn on_select(self, on_select: impl Fn(usize) -> Message + 'a) -> Self
Sets the message sent with the step under the pointer while pressing or dragging, or the step a shortcut moves to.
Sourcepub fn on_hover(self, on_hover: impl Fn(Option<usize>) -> Message + 'a) -> Self
pub fn on_hover(self, on_hover: impl Fn(Option<usize>) -> Message + 'a) -> Self
Sets the message sent with the step under the pointer as it moves
over the timeline, and with None once it leaves, so the app can
preview a step without selecting it. Nothing is sent during a drag,
which reports its steps through on_select. It works on a timeline
without on_select too.
Sourcepub fn keymap(self, keymap: Keymap<Action>) -> Self
pub fn keymap(self, keymap: Keymap<Action>) -> Self
Replaces the default_keymap the timeline resolves keys with
while it has keyboard focus or was the last thing pressed.
Sourcepub fn times(self, times: impl IntoIterator<Item = Duration>) -> Self
pub fn times(self, times: impl IntoIterator<Item = Duration>) -> Self
Places each step by the moment it began, such as its offset from
the start of a run, instead of evenly. Steps past the last time
given take that time. See Timing::new for how close and
backward times are handled.
Sourcepub fn end(self, end: Duration) -> Self
pub fn end(self, end: Duration) -> Self
When the last step finished, so the track runs on past it. Only
used with times.
Sourcepub fn compress_gaps(self, longer_than: Duration) -> Self
pub fn compress_gaps(self, longer_than: Duration) -> Self
Draws each gap between timed steps longer than longer_than as if
it lasted longer_than, with a break in the rail, so long idle
stretches do not squeeze the busy parts. Only used with
times.
Sourcepub fn ruler(self, ruler: bool) -> Self
pub fn ruler(self, ruler: bool) -> Self
Shows a ruler of labelled marks below the track and lanes: round times for a timed timeline, step numbers for an even one.
Sourcepub fn ruler_format(self, format: impl Fn(Duration) -> String + 'a) -> Self
pub fn ruler_format(self, format: impl Fn(Duration) -> String + 'a) -> Self
Replaces the ruler’s labels for times, which by default read like
250 ms, 1.5 s or 2:05 depending on the length of the track.
pub fn current(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_enabled(&self) -> bool
Trait Implementations§
Source§impl<Message> Widget<Message, Theme, ()> for Timeline<'_, Message>
impl<Message> Widget<Message, Theme, ()> for Timeline<'_, Message>
Source§fn draw(
&self,
tree: &Tree,
renderer: &mut Renderer,
theme: &Theme,
_style: &Style,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
)
fn draw( &self, tree: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, )
Widget using the associated Renderer.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 mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<'a, Message> !RefUnwindSafe for Timeline<'a, Message>
impl<'a, Message> !Send for Timeline<'a, Message>
impl<'a, Message> !Sync for Timeline<'a, Message>
impl<'a, Message> !UnwindSafe for Timeline<'a, Message>
impl<'a, Message> Forget for Timeline<'a, Message>
impl<'a, Message> Freeze for Timeline<'a, Message>where
*const u8 is !null: Freeze,
PhantomData<Tone>: Freeze,
PhantomData<Lane<'a>>: Freeze,
&'a str: Freeze,
String: Freeze,
PhantomData<(Chord, Action)>: Freeze,
PhantomData<Duration>: Freeze,
PhantomData<f32>: Freeze,
PhantomData<(Duration, f32)>: Freeze,
PhantomData<Break>: Freeze,
*const dyn Fn(Duration) -> String + 'a is !null: Freeze,
PhantomData<dyn Fn(Duration) -> String + 'a>: Freeze,
*const dyn Fn(usize) -> Message + 'a is !null: Freeze,
PhantomData<dyn Fn(usize) -> Message + 'a>: Freeze,
*const dyn Fn(Option<usize>) -> Message + 'a is !null: Freeze,
PhantomData<dyn Fn(Option<usize>) -> Message + 'a>: Freeze,
impl<'a, Message> Move for Timeline<'a, Message>
impl<'a, Message> Unpin for Timeline<'a, Message>
impl<'a, Message> UnsafeUnpin for Timeline<'a, Message>where
*const u8 is !null: UnsafeUnpin,
PhantomData<Tone>: UnsafeUnpin,
PhantomData<Lane<'a>>: UnsafeUnpin,
&'a str: UnsafeUnpin,
String: UnsafeUnpin,
PhantomData<(Chord, Action)>: UnsafeUnpin,
PhantomData<Duration>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
PhantomData<(Duration, f32)>: UnsafeUnpin,
PhantomData<Break>: UnsafeUnpin,
*const dyn Fn(Duration) -> String + 'a is !null: UnsafeUnpin,
PhantomData<dyn Fn(Duration) -> String + 'a>: UnsafeUnpin,
*const dyn Fn(usize) -> Message + 'a is !null: UnsafeUnpin,
PhantomData<dyn Fn(usize) -> Message + 'a>: UnsafeUnpin,
*const dyn Fn(Option<usize>) -> Message + 'a is !null: UnsafeUnpin,
PhantomData<dyn Fn(Option<usize>) -> Message + 'a>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.