Struct zng_wgt_text::TextEditMix
source · 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 mix-in.
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.
Sets the TEXT_SELECTABLE_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
Shorthand property, disables live parsing and parse on change stop.
This property sets txt_parse_live
and on_change_stop
on the widget.
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: impl WidgetHandler<ChangeStopArgs>)
pub fn on_change_stop(&self, handler: impl WidgetHandler<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 when the text is selectable.
If enabled on keyboard focus all text is selected and on blur any selection is cleared.
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
If the typed text is obscured 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