FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    new

    fn new(document: &RichTextDocument, offset: usize, gravity: TextGravity) -> Result<Self, DocumentError>
    

    Source

    document

    fn document(self: &Self) -> Option<RichTextDocument>
    

    Source

    position

    fn position(self: &Self) -> TextPosition
    

    Source

    offset

    fn offset(self: &Self) -> usize
    

    Source

    gravity

    fn gravity(self: &Self) -> TextGravity
    

    Source

    logical_direction

    fn logical_direction(self: &Self) -> TextGravity
    

    The logical direction of the pointer (WinUI's TextPointer.LogicalDirection).

    Source

    is_valid

    fn is_valid(self: &Self) -> bool
    

    Source

    parent

    fn parent(self: &Self) -> Option<Ref<TextElement>>
    

    Source

    visual_parent

    fn visual_parent(self: &Self) -> Option<Ref<Control>>
    

    Source

    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.

    Source

    is_at_insertion_position

    fn is_at_insertion_position(self: &Self) -> bool
    

    Source

    get_position_at_offset

    fn get_position_at_offset(self: &Self, offset: i32, gravity: TextGravity) -> Result<Self, DocumentError>
    

    Source

    next_insertion_position

    fn next_insertion_position(self: &Self) -> Option<Self>
    

    Source

    previous_insertion_position

    fn previous_insertion_position(self: &Self) -> Option<Self>
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.