pub struct Editor { /* private fields */ }Expand description
Editor component
Implementations§
Source§impl Editor
API for use by EditGuard implementations
impl Editor
API for use by EditGuard implementations
Sourcepub fn clone_string(&self) -> String
pub fn clone_string(&self) -> String
Get the text contents as a String
Sourcepub fn pre_commit(&mut self)
pub fn pre_commit(&mut self)
Commit outstanding changes to the undo history
Call this before changing the text with set_str or set_string
to commit changes to the undo history.
Sourcepub fn clear(&mut self, cx: &mut EventState)
pub fn clear(&mut self, cx: &mut EventState)
Clear text contents and undo history
This method does not call any EditGuard actions; consider also
calling EditField::call_guard_edit.
Sourcepub fn set_str(&mut self, cx: &mut EventState, text: &str) -> bool
pub fn set_str(&mut self, cx: &mut EventState, text: &str) -> bool
Set text contents from a str
This does not interact with undo history; see also Self::clear,
Self::pre_commit.
This method does not call any EditGuard actions; consider also
calling EditField::call_guard_edit.
Returns true if the text may have changed.
Sourcepub fn set_string(&mut self, cx: &mut EventState, string: String) -> bool
pub fn set_string(&mut self, cx: &mut EventState, string: String) -> bool
Set text contents from a String
This does not interact with undo history or call action handlers on the guard.
This method clears the error state but does not call any EditGuard
actions; consider also calling EditField::call_guard_edit.
Returns true if the text is ready and may have changed.
Sourcepub fn replace_selected_text(&mut self, cx: &mut EventState, text: &str) -> bool
pub fn replace_selected_text(&mut self, cx: &mut EventState, text: &str) -> bool
Replace selected text
This does not interact with undo history or call action handlers on the guard.
This method clears the error state but does not call any EditGuard
actions; consider also calling EditField::call_guard_edit.
Returns true if the text is ready and may have changed.
Sourcepub fn cursor_range(&self) -> CursorRange
pub fn cursor_range(&self) -> CursorRange
Access the cursor index / selection range
Sourcepub fn set_cursor_range(&mut self, range: impl Into<CursorRange>)
pub fn set_cursor_range(&mut self, range: impl Into<CursorRange>)
Set the cursor index / range
This does not interact with undo history or call action handlers on the guard.
Sourcepub fn is_editable(&self) -> bool
pub fn is_editable(&self) -> bool
Get whether this EditField is editable
Sourcepub fn set_editable(&mut self, editable: bool)
pub fn set_editable(&mut self, editable: bool)
Set whether this EditField is editable
Sourcepub fn multi_line(&self) -> bool
pub fn multi_line(&self) -> bool
True if the editor uses multi-line mode
Sourcepub fn has_input_focus(&self) -> bool
pub fn has_input_focus(&self) -> bool
Get whether the widget has input focus
This is true when the widget is has keyboard or IME focus.
Sourcepub fn set_error(
&mut self,
cx: &mut EventState,
message: Option<Cow<'static, str>>,
)
pub fn set_error( &mut self, cx: &mut EventState, message: Option<Cow<'static, str>>, )
Mark the input as erroneous with an optional message
This state should be set from EditGuard::edit when appropriate. The
state is cleared immediately before calling EditGuard::edit and also
in case a text is directly assigned (e.g. using Self::set_string).
When set, the input field’s background is drawn red. If a message is supplied, then a tooltip will be available on mouse-hover.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl !Send for Editor
impl !Sync for Editor
impl Unpin for Editor
impl UnwindSafe for Editor
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
Source§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.