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>) -> Self
pub fn new(value: Binding<String>) -> Self
A name bound to value, which changes only when the new name is confirmed.
Sourcepub fn editing(self, editing: Binding<bool>) -> Self
pub fn editing(self, editing: Binding<bool>) -> Self
Whether it is being edited, for starting from elsewhere, such as a menu.
Sourcepub fn on_rename(self, handler: impl Fn(String) + 'static) -> Self
pub fn on_rename(self, handler: impl Fn(String) + 'static) -> Self
Called with the new name when it is confirmed and differs from the old one.
Sourcepub fn on_click(self, handler: impl Fn() + 'static) -> Self
pub fn on_click(self, handler: impl Fn() + 'static) -> Self
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) -> Self
pub fn size(self, size: ButtonSize) -> Self
The height and text size, in both forms so that nothing moves (Small by default).
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
Fixed width in logical pixels. It takes the width of its content by default.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
What is being named, such as “Preset name”, for screen readers.
Sourcepub fn placeholder(self, text: impl Into<String>) -> Self
pub fn placeholder(self, text: impl Into<String>) -> Self
Muted text shown while the name is empty.
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§
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<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>
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.