Struct rat_widget::input::RTextInputState
source · pub struct RTextInputState {
pub widget: TextInputState,
pub non_exhaustive: NonExhaustive,
}Fields§
§widget: TextInputState§non_exhaustive: NonExhaustiveImplementations§
source§impl RTextInputState
impl RTextInputState
pub fn new() -> Self
sourcepub fn set_invalid(&mut self, invalid: bool)
pub fn set_invalid(&mut self, invalid: bool)
Renders the widget in invalid style.
sourcepub fn get_invalid(&self) -> bool
pub fn get_invalid(&self) -> bool
Renders the widget in invalid style.
sourcepub fn set_offset(&mut self, offset: usize)
pub fn set_offset(&mut self, offset: usize)
Offset shown. This is corrected if the cursor wouldn’t be visible.
sourcepub fn set_cursor(&mut self, cursor: usize, extend_selection: bool) -> bool
pub fn set_cursor(&mut self, cursor: usize, extend_selection: bool) -> bool
Set the cursor position, reset selection.
sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Selection.
sourcepub fn set_selection(&mut self, anchor: usize, cursor: usize) -> bool
pub fn set_selection(&mut self, anchor: usize, cursor: usize) -> bool
Selection.
sourcepub fn select_all(&mut self) -> bool
pub fn select_all(&mut self) -> bool
Selection.
sourcepub fn selected_value(&self) -> &str
pub fn selected_value(&self) -> &str
Selection.
sourcepub fn insert_char(&mut self, c: char) -> bool
pub fn insert_char(&mut self, c: char) -> bool
Insert a char at the current position.
sourcepub fn delete_range(&mut self, range: Range<usize>) -> bool
pub fn delete_range(&mut self, range: Range<usize>) -> bool
Deletes the given range.
sourcepub fn delete_next_word(&mut self) -> bool
pub fn delete_next_word(&mut self) -> bool
Deletes the next word.
sourcepub fn delete_prev_word(&mut self) -> bool
pub fn delete_prev_word(&mut self) -> bool
Deletes the given range.
sourcepub fn delete_prev_char(&mut self) -> bool
pub fn delete_prev_char(&mut self) -> bool
Delete the char before the cursor.
sourcepub fn delete_next_char(&mut self) -> bool
pub fn delete_next_char(&mut self) -> bool
Delete the char after the cursor.
pub fn move_to_next_word(&mut self, extend_selection: bool) -> bool
pub fn move_to_prev_word(&mut self, extend_selection: bool) -> bool
sourcepub fn move_to_next(&mut self, extend_selection: bool) -> bool
pub fn move_to_next(&mut self, extend_selection: bool) -> bool
Move to the next char.
sourcepub fn move_to_prev(&mut self, extend_selection: bool) -> bool
pub fn move_to_prev(&mut self, extend_selection: bool) -> bool
Move to the previous char.
sourcepub fn move_to_line_start(&mut self, extend_selection: bool) -> bool
pub fn move_to_line_start(&mut self, extend_selection: bool) -> bool
Start of line
pub fn move_to_line_end(&mut self, extend_selection: bool) -> bool
sourcepub fn to_screen_col(&self, pos: usize) -> Option<u16>
pub fn to_screen_col(&self, pos: usize) -> Option<u16>
Converts a grapheme based position to a screen position relative to the widget area.
sourcepub fn from_screen_col(&self, x: usize) -> Option<usize>
pub fn from_screen_col(&self, x: usize) -> Option<usize>
Converts from a widget relative screen coordinate to a grapheme index. x is the relative screen position.
sourcepub fn set_screen_cursor(
&mut self,
cursor: isize,
extend_selection: bool,
) -> bool
pub fn set_screen_cursor( &mut self, cursor: isize, extend_selection: bool, ) -> bool
Set the cursor position from a visual position relative to the origin.
sourcepub fn screen_cursor(&self) -> Option<(u16, u16)>
pub fn screen_cursor(&self) -> Option<(u16, u16)>
The current text cursor as an absolute screen position.
Trait Implementations§
source§impl Clone for RTextInputState
impl Clone for RTextInputState
source§fn clone(&self) -> RTextInputState
fn clone(&self) -> RTextInputState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RTextInputState
impl Debug for RTextInputState
source§impl Default for RTextInputState
impl Default for RTextInputState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextInputState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextInputState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextInputState
source§impl HasFocusFlag for RTextInputState
impl HasFocusFlag for RTextInputState
Auto Trait Implementations§
impl !Freeze for RTextInputState
impl !RefUnwindSafe for RTextInputState
impl Send for RTextInputState
impl !Sync for RTextInputState
impl Unpin for RTextInputState
impl UnwindSafe for RTextInputState
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<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more