pub struct ToolRail { /* private fields */ }Expand description
A narrow bar of tools with their names under their icons, of which one is open: what sits along the side of an editor, with the open tool’s panel next to it.
selected counts every tool in order, the variants of a place included. It can
also show only icons, in one column or more, with lines between groups of tools.
use ravenrs_reactive::State;
use ravenrs_widgets::{IconName, ToolRail, ToolRailItem};
let open = State::new(0);
let rail = ToolRail::new(open.binding(), [(IconName::Type, "Text"), (IconName::ZoomIn, "Zoom")]);
let tool = State::new(0);
let editor = ToolRail::new(tool.binding(), [(IconName::Pencil, "Brush")])
.separator()
.tool(
ToolRailItem::new(IconName::Square, "Rectangle")
.shortcut("M")
.variant(IconName::Circle, "Ellipse"),
)
.columns(2);Implementations§
Source§impl ToolRail
impl ToolRail
Sourcepub fn new<S>(
selected: Binding<usize>,
tools: impl IntoIterator<Item = (IconName, S)>,
) -> ToolRail
pub fn new<S>( selected: Binding<usize>, tools: impl IntoIterator<Item = (IconName, S)>, ) -> ToolRail
A rail of these tools; selected says which one is open.
Sourcepub fn tool(self, item: ToolRailItem) -> ToolRail
pub fn tool(self, item: ToolRailItem) -> ToolRail
Adds a place with a tool and its variants.
Sourcepub fn width(self, width: f32) -> ToolRail
pub fn width(self, width: f32) -> ToolRail
Its width, in logical pixels (76 by default, or what the columns take).
Sourcepub fn icons_only(self, icons_only: bool) -> ToolRail
pub fn icons_only(self, icons_only: bool) -> ToolRail
Shows only icons, with the names as tooltips.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRail
impl !Send for ToolRail
impl !Sync for ToolRail
impl !UnwindSafe for ToolRail
impl Freeze for ToolRail
impl Unpin for ToolRail
impl UnsafeUnpin for ToolRail
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
Mutably borrows from an owned value. Read more
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>
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.