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: View> FloatingToolbar<C>
impl<C: View> FloatingToolbar<C>
Sourcepub fn action(self, action: ToolbarAction) -> Self
pub fn action(self, action: ToolbarAction) -> Self
Appends a command.
Sourcepub fn view(self, view: impl View + 'static) -> Self
pub fn view(self, view: impl View + 'static) -> Self
Appends any view, such as a ValueSlider.
Sourcepub fn place(self, across: Align, down: Align) -> Self
pub fn place(self, across: Align, down: Align) -> Self
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) -> Self
pub fn margin(self, margin: f32) -> Self
How far from the edges of the content it stays, in logical pixels (12 by default).
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§
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.