pub struct InlineRename { /* private fields */ }Expand description
A name that turns into a field: a double click, F2 or Enter starts, Enter confirms, Escape cancels, and clicking elsewhere confirms. The keyboard goes back to the name after Enter or Escape. An empty name, or one that did not change, changes nothing.
use ravenrs_reactive::State;
use ravenrs_widgets::{InlineRename, Ui};
let name = State::new(String::from("Warm evening"));
let rename = InlineRename::new(name.binding()).label("Preset name").on_rename(|new| println!("{new}"));
let mut ui = Ui::new(rename, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl InlineRename
impl InlineRename
Sourcepub fn new(value: Binding<String>) -> InlineRename
pub fn new(value: Binding<String>) -> InlineRename
A name bound to value, which changes only when the new name is confirmed.
Sourcepub fn editing(self, editing: Binding<bool>) -> InlineRename
pub fn editing(self, editing: Binding<bool>) -> InlineRename
Whether it is being edited, for starting from elsewhere, such as a menu.
Sourcepub fn on_rename(self, handler: impl Fn(String) + 'static) -> InlineRename
pub fn on_rename(self, handler: impl Fn(String) + 'static) -> InlineRename
Called with the new name when it is confirmed and differs from the old one.
Sourcepub fn on_click(self, handler: impl Fn() + 'static) -> InlineRename
pub fn on_click(self, handler: impl Fn() + 'static) -> InlineRename
What a single click on the name does, such as selecting its row, since the name takes the clicks that land on it.
Sourcepub fn size(self, size: ButtonSize) -> InlineRename
pub fn size(self, size: ButtonSize) -> InlineRename
The height and text size, in both forms so that nothing moves (Small by default).
Sourcepub fn width(self, width: f32) -> InlineRename
pub fn width(self, width: f32) -> InlineRename
Fixed width in logical pixels. It takes the width of its content by default.
Sourcepub fn label(self, label: impl Into<String>) -> InlineRename
pub fn label(self, label: impl Into<String>) -> InlineRename
What is being named, such as “Preset name”, for screen readers.
Sourcepub fn placeholder(self, text: impl Into<String>) -> InlineRename
pub fn placeholder(self, text: impl Into<String>) -> InlineRename
Muted text shown while the name is empty.
Sourcepub fn disabled(self, disabled: bool) -> InlineRename
pub fn disabled(self, disabled: bool) -> InlineRename
Shows the name and does not let it change.
Trait Implementations§
Source§impl Debug for InlineRename
impl Debug for InlineRename
Auto Trait Implementations§
impl !RefUnwindSafe for InlineRename
impl !Send for InlineRename
impl !Sync for InlineRename
impl !UnwindSafe for InlineRename
impl Freeze for InlineRename
impl Unpin for InlineRename
impl UnsafeUnpin for InlineRename
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.