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.
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.
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 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).Source§impl LayoutModifierNode for TextFieldModifierNode
impl LayoutModifierNode for TextFieldModifierNode
Source§fn measure(
&self,
context: &mut dyn ModifierNodeContext,
_measurable: &dyn Measurable,
constraints: Constraints,
) -> LayoutModifierMeasureResult
fn measure( &self, context: &mut dyn ModifierNodeContext, _measurable: &dyn Measurable, constraints: Constraints, ) -> LayoutModifierMeasureResult
Source§fn min_intrinsic_width(
&self,
_measurable: &dyn Measurable,
_height: f32,
density: f32,
) -> f32
fn min_intrinsic_width( &self, _measurable: &dyn Measurable, _height: f32, density: f32, ) -> f32
Source§fn max_intrinsic_width(
&self,
_measurable: &dyn Measurable,
_height: f32,
density: f32,
) -> f32
fn max_intrinsic_width( &self, _measurable: &dyn Measurable, _height: f32, density: f32, ) -> f32
Source§fn min_intrinsic_height(
&self,
_measurable: &dyn Measurable,
width: f32,
density: f32,
) -> f32
fn min_intrinsic_height( &self, _measurable: &dyn Measurable, width: f32, density: f32, ) -> f32
Source§fn max_intrinsic_height(
&self,
_measurable: &dyn Measurable,
width: f32,
density: f32,
) -> f32
fn max_intrinsic_height( &self, _measurable: &dyn Measurable, width: f32, density: f32, ) -> f32
Source§impl ModifierNode for TextFieldModifierNode
impl ModifierNode for TextFieldModifierNode
fn on_attach(&mut self, context: &mut dyn ModifierNodeContext)
fn on_detach(&mut self)
Source§fn as_draw_node(&self) -> Option<&dyn DrawModifierNode>
fn as_draw_node(&self) -> Option<&dyn DrawModifierNode>
Source§fn as_draw_node_mut(&mut self) -> Option<&mut dyn DrawModifierNode>
fn as_draw_node_mut(&mut self) -> Option<&mut dyn DrawModifierNode>
Source§fn as_layout_node(&self) -> Option<&dyn LayoutModifierNode>
fn as_layout_node(&self) -> Option<&dyn LayoutModifierNode>
Source§fn as_layout_node_mut(&mut self) -> Option<&mut dyn LayoutModifierNode>
fn as_layout_node_mut(&mut self) -> Option<&mut dyn LayoutModifierNode>
Source§fn as_semantics_node(&self) -> Option<&dyn SemanticsNode>
fn as_semantics_node(&self) -> Option<&dyn SemanticsNode>
Source§fn as_semantics_node_mut(&mut self) -> Option<&mut dyn SemanticsNode>
fn as_semantics_node_mut(&mut self) -> Option<&mut dyn SemanticsNode>
Source§fn as_pointer_input_node(&self) -> Option<&dyn PointerInputNode>
fn as_pointer_input_node(&self) -> Option<&dyn PointerInputNode>
Source§fn as_pointer_input_node_mut(&mut self) -> Option<&mut dyn PointerInputNode>
fn as_pointer_input_node_mut(&mut self) -> Option<&mut dyn PointerInputNode>
fn on_reset(&mut self)
Source§fn as_focus_node(&self) -> Option<&(dyn FocusNode + 'static)>
fn as_focus_node(&self) -> Option<&(dyn FocusNode + 'static)>
Source§fn as_focus_node_mut(&mut self) -> Option<&mut (dyn FocusNode + 'static)>
fn as_focus_node_mut(&mut self) -> Option<&mut (dyn FocusNode + 'static)>
Source§fn for_each_delegate<'b>(
&'b self,
_visitor: &mut dyn FnMut(&'b (dyn ModifierNode + 'static)),
)
fn for_each_delegate<'b>( &'b self, _visitor: &mut dyn FnMut(&'b (dyn ModifierNode + 'static)), )
Source§fn for_each_delegate_mut<'b>(
&'b mut self,
_visitor: &mut dyn FnMut(&'b mut (dyn ModifierNode + 'static)),
)
fn for_each_delegate_mut<'b>( &'b mut self, _visitor: &mut dyn FnMut(&'b mut (dyn ModifierNode + 'static)), )
Source§impl PointerInputNode for TextFieldModifierNode
impl PointerInputNode for TextFieldModifierNode
Source§fn on_pointer_event(
&mut self,
_context: &mut dyn ModifierNodeContext,
_event: &PointerEvent,
) -> bool
fn on_pointer_event( &mut self, _context: &mut dyn ModifierNodeContext, _event: &PointerEvent, ) -> bool
Source§fn hit_test(&self, x: f32, y: f32) -> bool
fn hit_test(&self, x: f32, y: f32) -> bool
Source§fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>
fn pointer_input_handler(&self) -> Option<Rc<dyn Fn(PointerEvent)>>
Source§impl SemanticsNode for TextFieldModifierNode
impl SemanticsNode for TextFieldModifierNode
Source§fn reach(&self) -> SemanticsReach
fn reach(&self) -> SemanticsReach
Neither modal nor hidden, but the field’s text and selection are read live from its state, which an app may set without touching the node.