Skip to main content

TextFieldModifierNode

Struct TextFieldModifierNode 

Source
pub struct TextFieldModifierNode { /* private fields */ }
Expand description

Re-export the UI crate so applications can depend on a single crate.

Implementations§

Source§

impl TextFieldModifierNode

Source

pub fn new(state: TextFieldState, style: TextStyle) -> TextFieldModifierNode

Creates a new text field modifier node.

Source

pub fn with_line_limits( self, line_limits: TextFieldLineLimits, ) -> TextFieldModifierNode

Creates a node with custom line limits.

Source

pub fn line_limits(&self) -> TextFieldLineLimits

Returns the current line limits configuration.

Source

pub fn with_cursor_color(self, color: Color) -> TextFieldModifierNode

Creates a node with custom cursor color.

Source

pub fn set_focused(&mut self, focused: bool)

Sets the focus state.

Source

pub fn is_focused(&self) -> bool

Returns whether the field is focused.

Source

pub fn is_focused_rc(&self) -> Rc<RefCell<bool>>

Returns the is_focused Rc for closure capture.

Source

pub fn content_offset_rc(&self) -> Rc<Cell<f32>>

Returns the content_offset Rc for closure capture.

Source

pub fn content_y_offset_rc(&self) -> Rc<Cell<f32>>

Returns the content_y_offset Rc for closure capture.

Source

pub fn text(&self) -> String

Returns the current text.

Source

pub fn selection(&self) -> TextRange

Returns the current selection.

Source

pub fn cursor_brush(&self) -> Brush

Returns the cursor brush for rendering.

Source

pub fn selection_brush(&self) -> Brush

Returns the selection brush for rendering selection highlight.

Source

pub fn insert_text(&mut self, text: &str)

Inserts text at the current cursor position (for paste operations).

Source

pub fn copy_selection(&self) -> Option<String>

Copies the selected text and returns it (for web copy operation). Returns None if no selection.

Source

pub fn cut_selection(&mut self) -> Option<String>

Cuts the selected text: copies and deletes it. Returns the cut text, or None if no selection.

Source

pub fn get_state(&self) -> TextFieldState

Returns a clone of the text field state for use in draw closures. This allows reading selection at DRAW time rather than LAYOUT time.

Source

pub fn set_content_offset(&self, offset: f32)

Updates the content offset (padding.left) for accurate click-to-position cursor placement. Called from slices collection where padding is known.

Source

pub fn set_content_y_offset(&self, offset: f32)

Updates the content Y offset (padding.top) for cursor Y positioning. Called from slices collection where padding is known.

Source

pub fn position_cursor_at_offset(&self, x_offset: f32)

Positions cursor at a given x offset within the text. Uses proper text layout hit testing for accurate proportional font support.

Trait Implementations§

Source§

impl Debug for TextFieldModifierNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl DelegatableNode for TextFieldModifierNode

Source§

impl DrawModifierNode for TextFieldModifierNode

Source§

fn draw(&self, _draw_scope: &mut dyn DrawScope)

Draws this modifier node into the provided DrawScope. Read more
Source§

fn create_draw_closure(&self) -> Option<Rc<dyn Fn(Size) -> Vec<DrawPrimitive>>>

Creates a closure for deferred drawing that will be evaluated at render time. Read more
Source§

impl LayoutModifierNode for TextFieldModifierNode

Source§

fn measure( &self, _context: &mut dyn ModifierNodeContext, _measurable: &dyn Measurable, constraints: Constraints, ) -> LayoutModifierMeasureResult

Measures the wrapped content and returns both the size this modifier occupies and where the wrapped content should be placed. Read more
Source§

fn min_intrinsic_width(&self, _measurable: &dyn Measurable, _height: f32) -> f32

Returns the minimum intrinsic width of this modifier node.
Source§

fn max_intrinsic_width(&self, _measurable: &dyn Measurable, _height: f32) -> f32

Returns the maximum intrinsic width of this modifier node.
Source§

fn min_intrinsic_height(&self, _measurable: &dyn Measurable, _width: f32) -> f32

Returns the minimum intrinsic height of this modifier node.
Source§

fn max_intrinsic_height(&self, _measurable: &dyn Measurable, _width: f32) -> f32

Returns the maximum intrinsic height of this modifier node.
Source§

fn create_measurement_proxy(&self) -> Option<Box<dyn MeasurementProxy>>

Creates a measurement proxy for this node that can perform measurement without holding a borrow to the modifier chain. Read more
Source§

impl ModifierNode for TextFieldModifierNode

Source§

fn on_attach(&mut self, context: &mut dyn ModifierNodeContext)

Source§

fn as_draw_node(&self) -> Option<&(dyn DrawModifierNode + 'static)>

Returns this node as a draw modifier if it implements the trait.
Source§

fn as_draw_node_mut(&mut self) -> Option<&mut (dyn DrawModifierNode + 'static)>

Returns this node as a mutable draw modifier if it implements the trait.
Source§

fn as_layout_node(&self) -> Option<&(dyn LayoutModifierNode + 'static)>

Returns this node as a layout modifier if it implements the trait.
Source§

fn as_layout_node_mut( &mut self, ) -> Option<&mut (dyn LayoutModifierNode + 'static)>

Returns this node as a mutable layout modifier if it implements the trait.
Source§

fn as_semantics_node(&self) -> Option<&(dyn SemanticsNode + 'static)>

Returns this node as a semantics modifier if it implements the trait.
Source§

fn as_semantics_node_mut( &mut self, ) -> Option<&mut (dyn SemanticsNode + 'static)>

Returns this node as a mutable semantics modifier if it implements the trait.
Source§

fn as_pointer_input_node(&self) -> Option<&(dyn PointerInputNode + 'static)>

Returns this node as a pointer-input modifier if it implements the trait.
Source§

fn as_pointer_input_node_mut( &mut self, ) -> Option<&mut (dyn PointerInputNode + 'static)>

Returns this node as a mutable pointer-input modifier if it implements the trait.
Source§

fn on_detach(&mut self)

Source§

fn on_reset(&mut self)

Source§

fn as_focus_node(&self) -> Option<&(dyn FocusNode + 'static)>

Returns this node as a focus modifier if it implements the trait.
Source§

fn as_focus_node_mut(&mut self) -> Option<&mut (dyn FocusNode + 'static)>

Returns this node as a mutable focus modifier if it implements the trait.
Source§

fn for_each_delegate<'b>( &'b self, _visitor: &mut dyn FnMut(&'b (dyn ModifierNode + 'static)), )

Visits every delegate node owned by this modifier.
Source§

fn for_each_delegate_mut<'b>( &'b mut self, _visitor: &mut dyn FnMut(&'b mut (dyn ModifierNode + 'static)), )

Visits every delegate node mutably.
Source§

impl PointerInputNode for TextFieldModifierNode

Source§

fn on_pointer_event( &mut self, _context: &mut dyn ModifierNodeContext, _event: &PointerEvent, ) -> bool

Called when a pointer event occurs within the bounds of this node. Returns true if the event was consumed and should not propagate further.
Source§

fn hit_test(&self, x: f32, y: f32) -> bool

Returns true if this node should participate in hit-testing for the given pointer position.
Source§

fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>

Returns an event handler closure if the node wants to participate in pointer dispatch.
Source§

impl SemanticsNode for TextFieldModifierNode

Source§

fn merge_semantics(&self, config: &mut SemanticsConfiguration)

Merges semantic properties into the provided configuration.

Auto Trait Implementations§

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

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

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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