pub struct TextSurfaces { /* private fields */ }Expand description
A cloneable view of one tree’s registered text surfaces.
Taken once, with BuildContext::text_surfaces, and held by whatever needs
to ask the question later — a view-model refreshed from a frame tick has no
&WidgetTree to consult, which is precisely when it needs the answer.
Implementations§
Source§impl TextSurfaces
impl TextSurfaces
Sourcepub fn focused(&self) -> Option<Rc<dyn TextSurface>>
pub fn focused(&self) -> Option<Rc<dyn TextSurface>>
The text-editing widget that currently holds the keyboard focus.
None when focus is elsewhere — or nowhere — which is exactly what a
host needs in order to know that a text chord is safe to route itself.
Sourcepub fn focused_is_text_surface(&self) -> bool
pub fn focused_is_text_surface(&self) -> bool
Is the keyboard focus inside a widget that edits text? The cheap half of
focused, for a host that only needs to decide whether
to step aside.
Sourcepub fn is_read_only(&self, owner: WidgetId) -> bool
pub fn is_read_only(&self, owner: WidgetId) -> bool
Does the widget registered under owner refuse edits?
false for a widget that edits nothing — the question is only asked of
text surfaces, and a node that is not one is not read-only, it is simply
not text. Read by the hit-test slop pass, which must never re-attribute
a press to a surface that would ignore it.
Sourcepub fn focus_signal(&self) -> Signal<Option<WidgetId>>
pub fn focus_signal(&self) -> Signal<Option<WidgetId>>
The signal to react to. A host mirroring “can undo” into a menu row re-reads when focus moves.
Trait Implementations§
Source§impl Clone for TextSurfaces
impl Clone for TextSurfaces
Source§fn clone(&self) -> TextSurfaces
fn clone(&self) -> TextSurfaces
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more