pub struct TextFieldModifierNode { /* private fields */ }Implementations§
Source§impl TextFieldModifierNode
impl TextFieldModifierNode
Sourcepub fn new(state: TextFieldState, style: TextStyle) -> Self
pub fn new(state: TextFieldState, style: TextStyle) -> Self
Creates a new text field modifier node.
Sourcepub fn with_line_limits(self, line_limits: TextFieldLineLimits) -> Self
pub fn with_line_limits(self, line_limits: TextFieldLineLimits) -> Self
Creates a node with custom line limits.
Sourcepub fn with_handle_controller(
self,
controller: TextFieldHandleController,
) -> Self
pub fn with_handle_controller( self, controller: TextFieldHandleController, ) -> Self
Installs the controller the field publishes live handle metrics to.
Sourcepub fn text_pan_resolver(&self) -> Option<TextPanResolver>
pub fn text_pan_resolver(&self) -> Option<TextPanResolver>
Returns the pan resolver for single-line fields, None for multi-line.
Exposed to the modifier slices so the render scene builder can pan the text glyphs by the same offset used for the cursor and selection.
Sourcepub fn scroll_offset(&self) -> f32
pub fn scroll_offset(&self) -> f32
Returns the current horizontal scroll (pan) offset in px.
Sourcepub fn line_limits(&self) -> TextFieldLineLimits
pub fn line_limits(&self) -> TextFieldLineLimits
Returns the current line limits configuration.
Sourcepub fn with_cursor_color(self, color: Color) -> Self
pub fn with_cursor_color(self, color: Color) -> Self
Creates a node with a custom accent: the caret is drawn solid in
color and the selection highlight is derived from it at
crate::widgets::SELECTION_HIGHLIGHT_ALPHA — the reference field
tints caret, handles and highlight from the one accent.
Sourcepub fn set_focused(&mut self, focused: bool)
pub fn set_focused(&mut self, focused: bool)
Sets the focus state.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Returns whether the field is focused.
Sourcepub fn is_focused_rc(&self) -> Rc<RefCell<bool>>
pub fn is_focused_rc(&self) -> Rc<RefCell<bool>>
Returns the is_focused Rc for closure capture.
Sourcepub fn content_offset_rc(&self) -> Rc<Cell<f32>>
pub fn content_offset_rc(&self) -> Rc<Cell<f32>>
Returns the content_offset Rc for closure capture.
Sourcepub fn content_y_offset_rc(&self) -> Rc<Cell<f32>>
pub fn content_y_offset_rc(&self) -> Rc<Cell<f32>>
Returns the content_y_offset Rc for closure capture.
pub fn style(&self) -> &TextStyle
Sourcepub fn cursor_brush(&self) -> Brush
pub fn cursor_brush(&self) -> Brush
Returns the cursor brush for rendering.
Sourcepub fn selection_brush(&self) -> Brush
pub fn selection_brush(&self) -> Brush
Returns the selection brush for rendering selection highlight.
Sourcepub fn insert_text(&mut self, text: &str)
pub fn insert_text(&mut self, text: &str)
Inserts text at the current cursor position (for paste operations).
Sourcepub fn copy_selection(&self) -> Option<String>
pub fn copy_selection(&self) -> Option<String>
Copies the selected text and returns it (for web copy operation). Returns None if no selection.
Sourcepub fn cut_selection(&mut self) -> Option<String>
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.
Sourcepub fn get_state(&self) -> TextFieldState
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.
Sourcepub fn set_content_offset(&self, offset: f32)
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.
Sourcepub fn set_content_y_offset(&self, offset: f32)
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.
Sourcepub fn position_cursor_at_offset(&self, x_offset: f32)
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
impl Debug for TextFieldModifierNode
Source§impl DelegatableNode for TextFieldModifierNode
impl DelegatableNode for TextFieldModifierNode
fn node_state(&self) -> &NodeState
fn aggregate_child_capabilities(&self) -> NodeCapabilities
Source§impl DrawModifierNode for TextFieldModifierNode
impl DrawModifierNode for TextFieldModifierNode
Source§fn draw(&self, _draw_scope: &mut dyn DrawScope)
fn draw(&self, _draw_scope: &mut dyn DrawScope)
Source§fn create_draw_closure(&self) -> Option<Rc<dyn Fn(&mut DrawScopeDefault)>>
fn create_draw_closure(&self) -> Option<Rc<dyn Fn(&mut DrawScopeDefault)>>
Source§fn create_behind_draw_closure(
&self,
) -> Option<Rc<dyn Fn(&mut DrawScopeDefault)>>
fn create_behind_draw_closure( &self, ) -> Option<Rc<dyn Fn(&mut DrawScopeDefault)>>
create_draw_closure, but the
primitives render BEHIND the node’s content — e.g. a text field’s
selection highlight, which must sit under the glyphs (a highlight
drawn over them tints the text with its translucent fill).