objc2_app_kit/generated/
NSTextElement.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextelement?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSTextElement;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for NSTextElement {}
19);
20
21impl NSTextElement {
22    extern_methods!(
23        #[cfg(feature = "NSTextContentManager")]
24        #[unsafe(method(initWithTextContentManager:))]
25        #[unsafe(method_family = init)]
26        pub fn initWithTextContentManager(
27            this: Allocated<Self>,
28            text_content_manager: Option<&NSTextContentManager>,
29        ) -> Retained<Self>;
30
31        #[cfg(feature = "NSTextContentManager")]
32        #[unsafe(method(textContentManager))]
33        #[unsafe(method_family = none)]
34        pub fn textContentManager(&self) -> Option<Retained<NSTextContentManager>>;
35
36        #[cfg(feature = "NSTextContentManager")]
37        /// Setter for [`textContentManager`][Self::textContentManager].
38        ///
39        /// This is a [weak property][objc2::topics::weak_property].
40        #[unsafe(method(setTextContentManager:))]
41        #[unsafe(method_family = none)]
42        pub fn setTextContentManager(&self, text_content_manager: Option<&NSTextContentManager>);
43
44        #[cfg(feature = "NSTextRange")]
45        #[unsafe(method(elementRange))]
46        #[unsafe(method_family = none)]
47        pub fn elementRange(&self) -> Option<Retained<NSTextRange>>;
48
49        #[cfg(feature = "NSTextRange")]
50        /// Setter for [`elementRange`][Self::elementRange].
51        #[unsafe(method(setElementRange:))]
52        #[unsafe(method_family = none)]
53        pub fn setElementRange(&self, element_range: Option<&NSTextRange>);
54
55        #[unsafe(method(childElements))]
56        #[unsafe(method_family = none)]
57        pub fn childElements(&self) -> Retained<NSArray<NSTextElement>>;
58
59        #[unsafe(method(parentElement))]
60        #[unsafe(method_family = none)]
61        pub fn parentElement(&self) -> Option<Retained<NSTextElement>>;
62
63        #[unsafe(method(isRepresentedElement))]
64        #[unsafe(method_family = none)]
65        pub fn isRepresentedElement(&self) -> bool;
66    );
67}
68
69/// Methods declared on superclass `NSObject`.
70impl NSTextElement {
71    extern_methods!(
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub fn init(this: Allocated<Self>) -> Retained<Self>;
75
76        #[unsafe(method(new))]
77        #[unsafe(method_family = new)]
78        pub fn new() -> Retained<Self>;
79    );
80}
81
82impl DefaultRetained for NSTextElement {
83    #[inline]
84    fn default_retained() -> Retained<Self> {
85        Self::new()
86    }
87}
88
89extern_class!(
90    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextparagraph?language=objc)
91    #[unsafe(super(NSTextElement, NSObject))]
92    #[derive(Debug, PartialEq, Eq, Hash)]
93    pub struct NSTextParagraph;
94);
95
96extern_conformance!(
97    unsafe impl NSObjectProtocol for NSTextParagraph {}
98);
99
100impl NSTextParagraph {
101    extern_methods!(
102        #[unsafe(method(initWithAttributedString:))]
103        #[unsafe(method_family = init)]
104        pub fn initWithAttributedString(
105            this: Allocated<Self>,
106            attributed_string: Option<&NSAttributedString>,
107        ) -> Retained<Self>;
108
109        #[unsafe(method(attributedString))]
110        #[unsafe(method_family = none)]
111        pub fn attributedString(&self) -> Retained<NSAttributedString>;
112
113        #[cfg(feature = "NSTextRange")]
114        #[unsafe(method(paragraphContentRange))]
115        #[unsafe(method_family = none)]
116        pub fn paragraphContentRange(&self) -> Option<Retained<NSTextRange>>;
117
118        #[cfg(feature = "NSTextRange")]
119        #[unsafe(method(paragraphSeparatorRange))]
120        #[unsafe(method_family = none)]
121        pub fn paragraphSeparatorRange(&self) -> Option<Retained<NSTextRange>>;
122    );
123}
124
125/// Methods declared on superclass `NSTextElement`.
126impl NSTextParagraph {
127    extern_methods!(
128        #[cfg(feature = "NSTextContentManager")]
129        #[unsafe(method(initWithTextContentManager:))]
130        #[unsafe(method_family = init)]
131        pub fn initWithTextContentManager(
132            this: Allocated<Self>,
133            text_content_manager: Option<&NSTextContentManager>,
134        ) -> Retained<Self>;
135    );
136}
137
138/// Methods declared on superclass `NSObject`.
139impl NSTextParagraph {
140    extern_methods!(
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub fn init(this: Allocated<Self>) -> Retained<Self>;
144
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub fn new() -> Retained<Self>;
148    );
149}
150
151impl DefaultRetained for NSTextParagraph {
152    #[inline]
153    fn default_retained() -> Retained<Self> {
154        Self::new()
155    }
156}