pub struct EventCx<'a> { /* private fields */ }Expand description
事件上下文——组件通过它标记 dirty、退出应用等
每个 Node 拥有独立的 EventCx,dirty 标记精确到当前节点, 同时通过 global_dirty 确保 Runtime 感知到变更。
Implementations§
Source§impl<'a> EventCx<'a>
impl<'a> EventCx<'a>
Sourcepub fn phase(&self) -> EventPhase
pub fn phase(&self) -> EventPhase
当前事件传播阶段
Sourcepub fn stop_propagation(&mut self)
pub fn stop_propagation(&mut self)
停止事件传播(后续阶段和祖先不再收到该事件)
Sourcepub fn invalidate_paint(&mut self)
pub fn invalidate_paint(&mut self)
标记当前节点需要重绘
Sourcepub fn invalidate_layout(&mut self)
pub fn invalidate_layout(&mut self)
标记当前节点需要重新布局并重绘
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
标记需要重新布局(等同于 invalidate_layout)
Sourcepub fn invalidate_tree(&mut self)
pub fn invalidate_tree(&mut self)
标记组件树结构变化,触发完整 rebuild + relayout + repaint
Sourcepub fn copy_to_clipboard(&self, text: &str)
pub fn copy_to_clipboard(&self, text: &str)
Copy text to the system clipboard via OSC 52.
Most modern terminals support this. The escape sequence is written directly to stdout.
Sourcepub fn toggle_debug()
pub fn toggle_debug()
切换 debug 视图
Auto Trait Implementations§
impl<'a> Freeze for EventCx<'a>
impl<'a> RefUnwindSafe for EventCx<'a>
impl<'a> Send for EventCx<'a>
impl<'a> Sync for EventCx<'a>
impl<'a> Unpin for EventCx<'a>
impl<'a> UnsafeUnpin for EventCx<'a>
impl<'a> !UnwindSafe for EventCx<'a>
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