TextPointer
struct · ferroui-controls · v0.5.0
struct TextPointer
A shared, live position whose document back pointer is weak. Holding a pointer cannot keep a document, control or visual tree alive.
Members
newdocumentpositionoffsetgravitylogical_directionis_validparentvisual_parentget_character_rectis_at_insertion_positionget_position_at_offsetnext_insertion_positionprevious_insertion_position
new
fn new(document: &RichTextDocument, offset: usize, gravity: TextGravity) -> Result<Self, DocumentError>
document
fn document(self: &Self) -> Option<RichTextDocument>
position
fn position(self: &Self) -> TextPosition
offset
fn offset(self: &Self) -> usize
gravity
fn gravity(self: &Self) -> TextGravity
logical_direction
fn logical_direction(self: &Self) -> TextGravity
The logical direction of the pointer (WinUI's TextPointer.LogicalDirection).
is_valid
fn is_valid(self: &Self) -> bool
parent
fn parent(self: &Self) -> Option<Ref<TextElement>>
visual_parent
fn visual_parent(self: &Self) -> Option<Ref<Control>>
get_character_rect
fn get_character_rect(self: &Self, direction: TextGravity) -> Option<Rect>
A caret rectangle in the owning text view. A detached document has no geometry. Direction chooses the character affinity at this same insertion position. Like the source TextPointer contract, the rectangle has zero width.
is_at_insertion_position
fn is_at_insertion_position(self: &Self) -> bool
get_position_at_offset
fn get_position_at_offset(self: &Self, offset: i32, gravity: TextGravity) -> Result<Self, DocumentError>
next_insertion_position
fn next_insertion_position(self: &Self) -> Option<Self>
previous_insertion_position
fn previous_insertion_position(self: &Self) -> Option<Self>
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedClassDefaultsErasedDestructorIntoEitherCloneDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.