Interface NSTextSelectionDataSource

  • All Known Implementing Classes:
    NSTextLayoutManager

    public interface NSTextSelectionDataSource
    API-Since: 15.0
    • Method Detail

      • baseWritingDirectionAtLocation

        long baseWritingDirectionAtLocation​(@NotNull
                                            @NotNull NSTextLocation location)
        Returns the base writing direction at location. It is recommended to return the resolved base direction either NSTextSelectionNavigationWritingDirectionLeftToRight or NSTextSelectionNavigationWritingDirectionRightToLeft.
      • documentRange

        @NotNull
        @NotNull NSTextRange documentRange()
        Declares the starting and ending locations for the document.
      • enumerateCaretOffsetsInLineFragmentAtLocationUsingBlock

        void enumerateCaretOffsetsInLineFragmentAtLocationUsingBlock​(@NotNull
                                                                     @NotNull NSTextLocation location,
                                                                     @NotNull
                                                                     @NotNull NSTextSelectionDataSource.Block_enumerateCaretOffsetsInLineFragmentAtLocationUsingBlock block)
        Layout Enumerates all the caret offset from left to right in visual order. caretOffset should be in the coordinate system for the text container. When leadingEdge=YES, it indicates caretOffset is at the edge logically preceding the character. For LTR characters, it is on the left, and on the right for RTL characters.
      • enumerateSubstringsFromLocationOptionsUsingBlock

        void enumerateSubstringsFromLocationOptionsUsingBlock​(@NotNull
                                                              @NotNull NSTextLocation location,
                                                              long options,
                                                              @NotNull
                                                              @NotNull NSTextSelectionDataSource.Block_enumerateSubstringsFromLocationOptionsUsingBlock block)
        Enumerating the textual segment boundaries starting at location. The segmentation logic should be based on the natural language semantics and rules such as Unicode Text Segmentation UAX 29. It is allowed to have custom text segmentation behavior for specialized document contents (i.e. text editors with structured document contents such as a programming language). NSStringEnumerationByLines should be aware of the visual line boundaries based on soft line wrapping.
      • lineFragmentRangeForPointInContainerAtLocation

        @Nullable
        @Nullable NSTextRange lineFragmentRangeForPointInContainerAtLocation​(CGPoint point,
                                                                             @NotNull
                                                                             @NotNull NSTextLocation location)
        Returns the range of the line fragment containing point inside the coordinate system containing location.
      • locationFromLocationWithOffset

        @Nullable
        @Nullable NSTextLocation locationFromLocationWithOffset​(@NotNull
                                                                @NotNull NSTextLocation location,
                                                                long offset)
        Returns a new location from location with offset. The offset value could be positive or negative indicating the logical direction. Could return nil when the inputs don't produce any legal location (i.e. out of bounds index).
      • offsetFromLocationToLocation

        long offsetFromLocationToLocation​(@NotNull
                                          @NotNull NSTextLocation from,
                                          @NotNull
                                          @NotNull NSTextLocation to)
        Returns the offset between from and to. The return value could be positive or negative. Could return NSNotFound when the offset cannot be represented in an integer value (i.e. locations are not in the same document).
      • textLayoutOrientationAtLocation

        default long textLayoutOrientationAtLocation​(@NotNull
                                                     @NotNull NSTextLocation location)
        Returns the text layout orientation at location. If not implemented, NSTextSelectionNavigation assumes it is NSTextSelectionNavigationLayoutOrientationHorizontal.
      • textRangeForSelectionGranularityEnclosingLocation

        @Nullable
        @Nullable NSTextRange textRangeForSelectionGranularityEnclosingLocation​(long selectionGranularity,
                                                                                @NotNull
                                                                                @NotNull NSTextLocation location)
        Returns a text range corresponding to selectionGranularity enclosing location. Returns nil when documentRange.isEmpty=YES.