pub struct TextFieldRenderObject {Show 22 fields
pub width: f32,
pub height: f32,
pub font_size: f32,
pub placeholder: String,
pub value: String,
pub cursor: usize,
pub preedit: Option<String>,
pub preedit_cursor: Option<(usize, usize)>,
pub focused: bool,
pub cursor_visible: bool,
pub bg_color: Color,
pub bg_focused_color: Color,
pub border_color: Color,
pub radius: f32,
pub focus_ring_color: Color,
pub text_color: Color,
pub placeholder_color: Color,
pub cursor_color: Color,
pub selection: Option<(usize, usize)>,
pub soft_wrap: bool,
pub scroll_y: f32,
pub element_id: Option<ElementId>,
}Fields§
§width: f32§height: f32§font_size: f32§placeholder: String§value: String§cursor: usize§preedit: Option<String>§preedit_cursor: Option<(usize, usize)>C1:preedit 内光标字节偏移区间
focused: bool§cursor_visible: boolC1:光标是否可见(闪烁)
bg_color: Color§bg_focused_color: Color§border_color: Color未聚焦时的 1px 描边色(主题 input.border;TRANSPARENT = 不画)
radius: f32输入框圆角(主题 input.radius)
focus_ring_color: Color§text_color: Color§placeholder_color: Color§cursor_color: Color§selection: Option<(usize, usize)>T2:文本选区 (start, end),start ≤ end,None = 无选区
soft_wrap: boolP1-3.3:按宽度软换行
scroll_y: f32P1-3.3:内部垂直滚动偏移
element_id: Option<ElementId>Trait Implementations§
Source§impl From<TextFieldApply> for TextFieldRenderObject
impl From<TextFieldApply> for TextFieldRenderObject
Source§fn from(a: TextFieldApply) -> TextFieldRenderObject
fn from(a: TextFieldApply) -> TextFieldRenderObject
Converts to this type from the input type.
Source§impl RenderObject for TextFieldRenderObject
impl RenderObject for TextFieldRenderObject
Source§fn apply_state(&mut self, state: &mut (dyn Any + 'static)) -> StateApply
fn apply_state(&mut self, state: &mut (dyn Any + 'static)) -> StateApply
P0-1:就地写回 State 构造的视觉 payload,避免每次输入/闪烁重建 RO。
Source§fn layout(
&mut self,
constraints: BoxConstraints,
_ctx: &mut LayoutContext,
) -> Size
fn layout( &mut self, constraints: BoxConstraints, _ctx: &mut LayoutContext, ) -> Size
在给定约束下计算并缓存自身尺寸,返回最终 content size。 Read more
Source§fn paint(&self, offset: Point, list: &mut PaintList)
fn paint(&self, offset: Point, list: &mut PaintList)
把自身内容追加到
painter;offset 是本 RO 原点在目标坐标系中的位置。Source§fn hit_test(&self, position: Point, offset: Point) -> Option<ElementId>
fn hit_test(&self, position: Point, offset: Point) -> Option<ElementId>
命中测试:
position 为目标坐标系,offset 为本 RO 原点;返回命中的 element id。Source§fn set_element_id(&mut self, id: ElementId)
fn set_element_id(&mut self, id: ElementId)
Element 树 mount 时调用,让 RO 记录自己归属哪个 Element。
阶段 2 仅
RRectRenderObject 有 element_id 字段,其他 RO 默认 noop。Source§fn content_size(&self) -> Size
fn content_size(&self) -> Size
阶段 4-D(候选 2):返回 RO 的内容 size(已 layout 后)。 Read more
Source§fn scrollbar_lane_hit(&self, _local: Point) -> bool
fn scrollbar_lane_hit(&self, _local: Point) -> bool
本 RO 的滚动条车道是否覆盖这个本地坐标点(
local = 相对本 RO 原点)。 Read moreSource§fn propagate_element_ids(
&mut self,
_child_ids: &[ElementId],
_stateful_ros: &mut [SharedRO],
)
fn propagate_element_ids( &mut self, _child_ids: &[ElementId], _stateful_ros: &mut [SharedRO], )
把子 element_id 注入到 RO 内部的子 RO。 Read more
Source§fn layer_size_hint(&self) -> Option<Size>
fn layer_size_hint(&self) -> Option<Size>
P1-7:layer texture 的尺寸提示:优先真实内容尺寸,其次边界盒子尺寸。 Read more
Source§fn layer_relayout_constraints(&self, layout_size: Size) -> BoxConstraints
fn layer_relayout_constraints(&self, layout_size: Size) -> BoxConstraints
嵌套 layer 局部重排时对该边界根使用的约束(默认 loose:允许内容收缩)。 Read more
Source§fn paint_as_layer_root(&self, offset: Point, painter: &mut PaintList)
fn paint_as_layer_root(&self, offset: Point, painter: &mut PaintList)
bugfix(showcase effect 色块不显示):作为 layer root 收集本层内容时调用
(paint_layer_recursive 专用)。 Read more
Source§fn push_child(&mut self, _offset: Point, _child: SharedRO)
fn push_child(&mut self, _offset: Point, _child: SharedRO)
阶段 4-D:容器 RO 暴露 push_child 让 Element 层在 mount 时填 children RO。
默认 noop(叶子 RO)。容器 RO(Stack/Column/ListView)override 实现 push 语义。 Read more
Source§fn children_count(&self) -> usize
fn children_count(&self) -> usize
阶段 4-D:容器 RO 的 children 数量(让 Element 层知道 RO 是否还有空 slot)
默认 0(叶子 RO 没有 children)
Source§fn layer_effect(&self) -> LayerEffect
fn layer_effect(&self) -> LayerEffect
阶段 5:返回此 RO 携带的 layer 视觉效果(Transform / Opacity / ClipRRect…) Read more
Source§fn set_subscriber_id(&mut self, _id: SubscriberId)
fn set_subscriber_id(&mut self, _id: SubscriberId)
阶段 5-G:由 ElementTree 在 mount/update 时调用,把 element 的
SubscriberId 注入 RO。只在 paint/hit_test 期间作为 signal 的
subscriber 用——PositionedRenderObject 之类持 Signal 的 RO override 此钩子;
其他 RO 默认 noop。Auto Trait Implementations§
impl Freeze for TextFieldRenderObject
impl RefUnwindSafe for TextFieldRenderObject
impl Send for TextFieldRenderObject
impl Sync for TextFieldRenderObject
impl Unpin for TextFieldRenderObject
impl UnsafeUnpin for TextFieldRenderObject
impl UnwindSafe for TextFieldRenderObject
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
Mutably borrows from an owned value. Read more