pub struct FloatingToolbar<C> { /* private fields */ }Expand description
A translucent row of commands floating over its content, such as a zoom bar over a photo. Clicks on it never reach the content. Tab goes through its commands.
With FloatingToolbar::movable it has a handle: dragging it, or its arrow keys, take the
bar anywhere in the content, and a double click brings it home. Smaller content than the bar
leaves it at the top left corner.
use ravenrs_layout::Align;
use ravenrs_widgets::{FloatingToolbar, IconName, Text, ToolbarAction, Ui};
let bar = FloatingToolbar::new(Text::new("A photo"))
.label("Zoom")
.action(ToolbarAction::new("Fit").on_click(|| {}))
.separator()
.action(ToolbarAction::new("Zoom in").icon(IconName::Plus).icon_only().on_click(|| {}))
.place(Align::Start, Align::End);
let mut ui = Ui::new(bar, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl<C> FloatingToolbar<C>where
C: View,
impl<C> FloatingToolbar<C>where
C: View,
Sourcepub fn new(content: C) -> FloatingToolbar<C>
pub fn new(content: C) -> FloatingToolbar<C>
An empty bar at the bottom center of content.
Sourcepub fn action(self, action: ToolbarAction) -> FloatingToolbar<C>
pub fn action(self, action: ToolbarAction) -> FloatingToolbar<C>
Appends a command.
Sourcepub fn separator(self) -> FloatingToolbar<C>
pub fn separator(self) -> FloatingToolbar<C>
Appends a line between groups of commands.
Sourcepub fn view(self, view: impl View + 'static) -> FloatingToolbar<C>
pub fn view(self, view: impl View + 'static) -> FloatingToolbar<C>
Appends any view, such as a ValueSlider.
Sourcepub fn label(self, label: impl Into<String>) -> FloatingToolbar<C>
pub fn label(self, label: impl Into<String>) -> FloatingToolbar<C>
The name screen readers announce.
Sourcepub fn place(self, across: Align, down: Align) -> FloatingToolbar<C>
pub fn place(self, across: Align, down: Align) -> FloatingToolbar<C>
Which side of the content it stays on, across and down: Start, Center or End.
At the bottom center by default.
Sourcepub fn margin(self, margin: f32) -> FloatingToolbar<C>
pub fn margin(self, margin: f32) -> FloatingToolbar<C>
How far from the edges of the content it stays, in logical pixels (12 by default).
Sourcepub fn movable(self, place: Binding<Option<Point>>) -> FloatingToolbar<C>
pub fn movable(self, place: Binding<Option<Point>>) -> FloatingToolbar<C>
Adds a handle that moves the bar. place is where it was left, from the top left
corner of the content, written when the drag ends so that the app can keep it; None
is the place given by Self::place.
Sourcepub fn fill(self) -> FloatingToolbar<C>
pub fn fill(self) -> FloatingToolbar<C>
Takes the free space of the parent, for content that fills a stage or a whole screen.
Trait Implementations§
Source§impl<C> Debug for FloatingToolbar<C>
impl<C> Debug for FloatingToolbar<C>
Auto Trait Implementations§
impl<C> !RefUnwindSafe for FloatingToolbar<C>
impl<C> !Send for FloatingToolbar<C>
impl<C> !Sync for FloatingToolbar<C>
impl<C> !UnwindSafe for FloatingToolbar<C>
impl<C> Freeze for FloatingToolbar<C>where
C: Freeze,
impl<C> Unpin for FloatingToolbar<C>where
C: Unpin,
impl<C> UnsafeUnpin for FloatingToolbar<C>where
C: UnsafeUnpin,
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.