pub struct TextEditMix<P>(/* private fields */);Expand description
m Text edit properties.
All properties in this mixin affects Text! nodes inside the widget where they are set.
Implementations§
Source§impl TextEditMix<()>
impl TextEditMix<()>
Sourcepub fn context_vars_set(set: &mut ContextValueSet)
pub fn context_vars_set(set: &mut ContextValueSet)
Insert context variables used by properties in this mixin.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn txt_editable(&self, enabled: impl IntoVar<bool>)
pub fn txt_editable(&self, enabled: impl IntoVar<bool>)
P Enable text caret, input and makes the widget focusable.
If the txt variable is read-only, this is ignored, if the var is writeable this
enables text input and modifies the variable.
Sets the TEXT_EDITABLE_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn txt_selectable(&self, enabled: impl IntoVar<bool>)
pub fn txt_selectable(&self, enabled: impl IntoVar<bool>)
P Enable text selection, copy and makes the widget focusable.
Note that if the text widget subscribes to mouse or touch events the selection gestures will interfere with those events,
you can enable txt_selectable_alt_only so that pointer selection gestures only start when the Alt keyboard modifier is pressed.
Sets the TEXT_SELECTABLE_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn txt_selectable_alt_only(&self, enabled: impl IntoVar<bool>)
pub fn txt_selectable_alt_only(&self, enabled: impl IntoVar<bool>)
P Only start mouse and touch selections from this widget when the Alt keyboard modifier is pressed.
Note that this property does not enable text selection, txt_selectable must be enabled on the widget or parent.
This property is ignored if the text is also editable. Selections started from sibling widgets in rich text also expand inside this widget normally, this property only applies to selection started from this widget.
Sets the TEXT_SELECTABLE_ALT_ONLY_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn accepts_tab(&self, enabled: impl IntoVar<bool>)
pub fn accepts_tab(&self, enabled: impl IntoVar<bool>)
P If the '\t' character is inserted when tab is pressed and the text is editable.
If not enabled or the text is not editable, then pressing tab moves the focus like normal.
Sets the ACCEPTS_TAB_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn accepts_enter(&self, enabled: impl IntoVar<bool>)
pub fn accepts_enter(&self, enabled: impl IntoVar<bool>)
P If the '\n' character is inserted when enter is pressed and the text is editable.
Sets the ACCEPTS_ENTER_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn caret_color(&self, color: impl IntoVar<Rgba>)
pub fn caret_color(&self, color: impl IntoVar<Rgba>)
P Defines the color of the non-interactive caret.
Sets the CARET_COLOR_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn interactive_caret_visual(
&self,
visual: impl IntoVar<WidgetFn<CaretShape>>,
)
pub fn interactive_caret_visual( &self, visual: impl IntoVar<WidgetFn<CaretShape>>, )
P Defines custom caret visual for interactive caret.
The visual node becomes the content of a layered widget at the ADORNER+1 layer, the text widget context is
propagated so contextual variables and value work seamless inside the node.
The visual node must set one special value during layout, the set_interactive_caret_spot must be called to
set the offset to the middle of the caret line in the visual inner-bounds, this is used to position the caret.
Sets the INTERACTIVE_CARET_VISUAL_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn interactive_caret(&self, mode: impl IntoVar<InteractiveCaretMode>)
pub fn interactive_caret(&self, mode: impl IntoVar<InteractiveCaretMode>)
P Defines when the interactive carets are used.
By default only uses interactive carets for touch selections.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn selection_color(&self, color: impl IntoVar<Rgba>)
pub fn selection_color(&self, color: impl IntoVar<Rgba>)
P Sets the SELECTION_COLOR_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn txt_parse_live(&self, enabled: impl IntoVar<bool>)
pub fn txt_parse_live(&self, enabled: impl IntoVar<bool>)
P If txt_parse tries to parse after any text change immediately.
This is enabled by default, if disabled the PARSE_CMD can be used to update pending parse.
This property sets the TXT_PARSE_LIVE_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn txt_parse_on_stop(&self, enabled: impl IntoVar<bool>)
pub fn txt_parse_on_stop(&self, enabled: impl IntoVar<bool>)
P Disable live parsing and parse on change stop.
This property sets txt_parse_live and on_change_stop on the widget.
Consider increasing the change_stop_delay if the text can change after parse.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn max_chars_count(&self, max: impl IntoVar<usize>)
pub fn max_chars_count(&self, max: impl IntoVar<usize>)
P Maximum number of characters that can be input.
Zero means no limit. Is zero by default.
This property sets the MAX_CHARS_COUNT_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn is_parse_pending(&self, state: impl IntoVar<bool>)
pub fn is_parse_pending(&self, state: impl IntoVar<bool>)
P If text has changed but txt_parse has not tried to parse the new text yet.
This can only be true if txt_parse_live is false.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn on_change_stop(&self, handler: Handler<ChangeStopArgs>)
pub fn on_change_stop(&self, handler: Handler<ChangeStopArgs>)
P Called after the text changed and interaction has stopped.
The handler will be called after change and change_stop_delay elapses, or the widget loses focus,
or the Key::Enter is pressed and accepts_enter is false.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn change_stop_delay(&self, delay: impl IntoVar<Duration>)
pub fn change_stop_delay(&self, delay: impl IntoVar<Duration>)
P Debounce time for on_change_stop.
After the text stops changing and delay is elapsed the change stop handled is called, even
if the widget is still focused.
Is 1.secs() by default.
Sets CHANGE_STOP_DELAY_VAR.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn auto_selection(&self, mode: impl IntoVar<AutoSelection>)
pub fn auto_selection(&self, mode: impl IntoVar<AutoSelection>)
P Auto-selection on focus change when the text is selectable.
If enabled on keyboard focus all text is selected and on blur any selection is cleared.
In rich text contexts applies to all sub-component texts.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn obscuring_char(&self, character: impl IntoVar<char>)
pub fn obscuring_char(&self, character: impl IntoVar<char>)
P Replacement character used when obscuring text.
When obscure_txt is enabled the text characters are replaced by this one.
Source§impl<P: WidgetImpl> TextEditMix<P>
impl<P: WidgetImpl> TextEditMix<P>
Sourcepub fn obscure_txt(&self, enabled: impl IntoVar<bool>)
pub fn obscure_txt(&self, enabled: impl IntoVar<bool>)
P Enable typed text obscuring in render.
When enabled each text character is replaced with obscuring_char, cut, copy and undo commands are disabled.
Note that the text variable is still plain text in memory, a memory dump while the widget is filled can leak the password, this is a potential security problem shared by apps that accept typed passwords. To mitigate the problem don’t use automatic crash reports with memory dump, drop the widget and the text variable as soon as possible, design the app to show the password widget last to minimize its lifetime.
Trait Implementations§
Source§impl<P> Deref for TextEditMix<P>
impl<P> Deref for TextEditMix<P>
Auto Trait Implementations§
impl<P> Freeze for TextEditMix<P>where
P: Freeze,
impl<P> RefUnwindSafe for TextEditMix<P>where
P: RefUnwindSafe,
impl<P> Send for TextEditMix<P>where
P: Send,
impl<P> Sync for TextEditMix<P>where
P: Sync,
impl<P> Unpin for TextEditMix<P>where
P: Unpin,
impl<P> UnwindSafe for TextEditMix<P>where
P: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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