Package apple.uikit.protocol
Interface NSTextSelectionDataSource
-
- All Known Implementing Classes:
NSTextLayoutManager
public interface NSTextSelectionDataSourceAPI-Since: 15.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceNSTextSelectionDataSource.Block_enumerateCaretOffsetsInLineFragmentAtLocationUsingBlockstatic interfaceNSTextSelectionDataSource.Block_enumerateContainerBoundariesFromLocationReverseUsingBlockstatic interfaceNSTextSelectionDataSource.Block_enumerateSubstringsFromLocationOptionsUsingBlock
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longbaseWritingDirectionAtLocation(@NotNull NSTextLocation location)Returns the base writing direction at location.@NotNull NSTextRangedocumentRange()Declares the starting and ending locations for the document.voidenumerateCaretOffsetsInLineFragmentAtLocationUsingBlock(@NotNull NSTextLocation location, @NotNull NSTextSelectionDataSource.Block_enumerateCaretOffsetsInLineFragmentAtLocationUsingBlock block)Layout Enumerates all the caret offset from left to right in visual order.default voidenumerateContainerBoundariesFromLocationReverseUsingBlock(@NotNull NSTextLocation location, boolean reverse, @NotNull NSTextSelectionDataSource.Block_enumerateContainerBoundariesFromLocationReverseUsingBlock block)This optional method should be implemented enumerating the text container/page boundary when the text selection data provider supports such a layout functionality.voidenumerateSubstringsFromLocationOptionsUsingBlock(@NotNull NSTextLocation location, long options, @NotNull NSTextSelectionDataSource.Block_enumerateSubstringsFromLocationOptionsUsingBlock block)Enumerating the textual segment boundaries starting at location.@Nullable NSTextRangelineFragmentRangeForPointInContainerAtLocation(CGPoint point, @NotNull NSTextLocation location)Returns the range of the line fragment containing point inside the coordinate system containing location.@Nullable NSTextLocationlocationFromLocationWithOffset(@NotNull NSTextLocation location, long offset)Returns a new location from location with offset.longoffsetFromLocationToLocation(@NotNull NSTextLocation from, @NotNull NSTextLocation to)Returns the offset between from and to.default longtextLayoutOrientationAtLocation(@NotNull NSTextLocation location)Returns the text layout orientation at location.@Nullable NSTextRangetextRangeForSelectionGranularityEnclosingLocation(long selectionGranularity, @NotNull NSTextLocation location)Returns a text range corresponding to selectionGranularity enclosing location.
-
-
-
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.
-
enumerateContainerBoundariesFromLocationReverseUsingBlock
default void enumerateContainerBoundariesFromLocationReverseUsingBlock(@NotNull @NotNull NSTextLocation location, boolean reverse, @NotNull @NotNull NSTextSelectionDataSource.Block_enumerateContainerBoundariesFromLocationReverseUsingBlock block)This optional method should be implemented enumerating the text container/page boundary when the text selection data provider supports such a layout functionality.
-
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.
-
-