objc2_browser_engine_kit/generated/
BETextDocumentContext.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/betextdocumentcontext?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct BETextDocumentContext;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for BETextDocumentContext {}
21);
22
23impl BETextDocumentContext {
24    extern_methods!(
25        /// Initializes a new document context with plain text.
26        ///
27        /// Parameter `selectedText`: The currently selected text, or nil in the case of a caret selection.
28        /// This string may be empty but non-nil if non-textual content is selected, in which case a single call to -deleteBackward will not delete from contextBeforeSelection.
29        /// May be empty if its outside of the context's area, even if it exists elsewhere in the document.
30        ///
31        /// Parameter `contextBefore`: A suffix of the text preceding the selection, or nil if the selection is at the beginning of the document.
32        /// This text must correspond to a range that does not include any non-text content.
33        /// In particular, if a context comprises k backward-deletion clusters, then k calls to -deleteBackward must delete the corresponding text from the document.
34        /// The beginning of this string must lie on a word boundary (or not be inside a word at all).
35        ///
36        /// Parameter `contextAfter`: A prefix of the text following the selection, or nil if the selection is at the end of the document.
37        /// This text must correspond to a range that does not include any non-text content.
38        /// The end of this string must lie on a word boundary (or not be inside a word at all).
39        ///
40        /// Parameter `markedText`: May be empty if it's outside of the context's area, even if it exists elsewhere in the document.
41        ///
42        /// Parameter `selectedRangeInMarkedText`: The range of the current text selection, relative to the marked text range. Specify (NSNotFound, 0) if there is no marked text.
43        #[unsafe(method(initWithSelectedText:contextBefore:contextAfter:markedText:selectedRangeInMarkedText:))]
44        #[unsafe(method_family = init)]
45        pub unsafe fn initWithSelectedText_contextBefore_contextAfter_markedText_selectedRangeInMarkedText(
46            this: Allocated<Self>,
47            selected_text: Option<&NSString>,
48            context_before: Option<&NSString>,
49            context_after: Option<&NSString>,
50            marked_text: Option<&NSString>,
51            selected_range_in_marked_text: NSRange,
52        ) -> Retained<Self>;
53
54        /// Initializes a new document context with attributed strings. The `selectedText`, `contextBefore`, and `contextAfter`
55        /// represent the same ranges as they do in the `-initWithSelectedText:contextBefore:contextAfter:` initializer.
56        #[unsafe(method(initWithAttributedSelectedText:contextBefore:contextAfter:markedText:selectedRangeInMarkedText:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithAttributedSelectedText_contextBefore_contextAfter_markedText_selectedRangeInMarkedText(
59            this: Allocated<Self>,
60            selected_text: Option<&NSAttributedString>,
61            context_before: Option<&NSAttributedString>,
62            context_after: Option<&NSAttributedString>,
63            marked_text: Option<&NSAttributedString>,
64            selected_range_in_marked_text: NSRange,
65        ) -> Retained<Self>;
66
67        #[cfg(feature = "objc2-core-foundation")]
68        /// Adds a text `rect` for the given character `range`
69        /// The CGRects representing each character range are specified in -textInputView coordinates.
70        #[unsafe(method(addTextRect:forCharacterRange:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn addTextRect_forCharacterRange(&self, rect: CGRect, range: NSRange);
73
74        /// Array of `NSRange` values, relative to the full context string made by combining the
75        /// `contextBefore`, `markedText` (or `selectedText` if the marked text is empty), and the
76        /// `contextAfter`.
77        #[unsafe(method(autocorrectedRanges))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn autocorrectedRanges(&self) -> Retained<NSArray<NSValue>>;
80
81        /// Setter for [`autocorrectedRanges`][Self::autocorrectedRanges].
82        ///
83        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
84        #[unsafe(method(setAutocorrectedRanges:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setAutocorrectedRanges(&self, autocorrected_ranges: &NSArray<NSValue>);
87
88        #[unsafe(method(new))]
89        #[unsafe(method_family = new)]
90        pub unsafe fn new(&self) -> Retained<Self>;
91
92        #[unsafe(method(init))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95    );
96}
97
98/// Methods declared on superclass `NSObject`.
99impl BETextDocumentContext {
100    extern_methods!(
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new_class() -> Retained<Self>;
104    );
105}