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<()>

source

pub fn context_vars_set(set: &mut ContextValueSet)

Insert context variables used by properties in this mix-in.

source§

impl<P: WidgetImpl> TextEditMix<P>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source

pub fn selection_color(&self, color: impl IntoVar<Rgba>)

P Sets the SELECTION_COLOR_VAR.

source§

impl<P: WidgetImpl> TextEditMix<P>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source

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>

source§

type Target = P

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<P> DerefMut for TextEditMix<P>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

source§

impl<T> StateValue for T
where T: Any + Send + Sync,