objc2_app_kit/generated/
NSTextContainer.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/appkit/nstextcontainer?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct NSTextContainer;
17);
18
19unsafe impl NSCoding for NSTextContainer {}
20
21unsafe impl NSObjectProtocol for NSTextContainer {}
22
23unsafe impl NSSecureCoding for NSTextContainer {}
24
25impl NSTextContainer {
26    extern_methods!(
27        #[cfg(feature = "objc2-core-foundation")]
28        /// ************************** Initialization ***************************
29        #[unsafe(method(initWithSize:))]
30        #[unsafe(method_family = init)]
31        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
32
33        #[unsafe(method(initWithCoder:))]
34        #[unsafe(method_family = init)]
35        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
36
37        #[cfg(feature = "NSTextLayoutManager")]
38        #[unsafe(method(textLayoutManager))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
41
42        #[cfg(feature = "objc2-core-foundation")]
43        /// *********************** Container shape properties ************************
44        #[unsafe(method(size))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn size(&self) -> CGSize;
47
48        #[cfg(feature = "objc2-core-foundation")]
49        /// Setter for [`size`][Self::size].
50        #[unsafe(method(setSize:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setSize(&self, size: CGSize);
53
54        #[cfg(feature = "NSParagraphStyle")]
55        #[unsafe(method(lineBreakMode))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
58
59        #[cfg(feature = "NSParagraphStyle")]
60        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
61        #[unsafe(method(setLineBreakMode:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
64
65        #[cfg(feature = "objc2-core-foundation")]
66        /// *********************** Layout constraint properties ************************
67        #[unsafe(method(lineFragmentPadding))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn lineFragmentPadding(&self) -> CGFloat;
70
71        #[cfg(feature = "objc2-core-foundation")]
72        /// Setter for [`lineFragmentPadding`][Self::lineFragmentPadding].
73        #[unsafe(method(setLineFragmentPadding:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
76
77        #[unsafe(method(maximumNumberOfLines))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn maximumNumberOfLines(&self) -> NSUInteger;
80
81        /// Setter for [`maximumNumberOfLines`][Self::maximumNumberOfLines].
82        #[unsafe(method(setMaximumNumberOfLines:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setMaximumNumberOfLines(&self, maximum_number_of_lines: NSUInteger);
85
86        #[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
87        /// ************************** Line fragments ***************************
88        #[unsafe(method(lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn lineFragmentRectForProposedRect_atIndex_writingDirection_remainingRect(
91            &self,
92            proposed_rect: CGRect,
93            character_index: NSUInteger,
94            base_writing_direction: NSWritingDirection,
95            remaining_rect: *mut CGRect,
96        ) -> CGRect;
97
98        #[unsafe(method(isSimpleRectangularTextContainer))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn isSimpleRectangularTextContainer(&self) -> bool;
101
102        /// ************************** View synchronization ***************************
103        #[unsafe(method(widthTracksTextView))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn widthTracksTextView(&self) -> bool;
106
107        /// Setter for [`widthTracksTextView`][Self::widthTracksTextView].
108        #[unsafe(method(setWidthTracksTextView:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setWidthTracksTextView(&self, width_tracks_text_view: bool);
111
112        #[unsafe(method(heightTracksTextView))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn heightTracksTextView(&self) -> bool;
115
116        /// Setter for [`heightTracksTextView`][Self::heightTracksTextView].
117        #[unsafe(method(setHeightTracksTextView:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setHeightTracksTextView(&self, height_tracks_text_view: bool);
120    );
121}
122
123/// Methods declared on superclass `NSObject`.
124impl NSTextContainer {
125    extern_methods!(
126        #[unsafe(method(init))]
127        #[unsafe(method_family = init)]
128        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
129
130        #[unsafe(method(new))]
131        #[unsafe(method_family = new)]
132        pub unsafe fn new() -> Retained<Self>;
133    );
134}
135
136impl NSTextContainer {
137    extern_methods!(
138        #[cfg(feature = "NSLayoutManager")]
139        #[unsafe(method(layoutManager))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
142
143        #[cfg(feature = "NSLayoutManager")]
144        /// Setter for [`layoutManager`][Self::layoutManager].
145        #[unsafe(method(setLayoutManager:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setLayoutManager(&self, layout_manager: Option<&NSLayoutManager>);
148
149        #[cfg(feature = "NSLayoutManager")]
150        #[unsafe(method(replaceLayoutManager:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn replaceLayoutManager(&self, new_layout_manager: &NSLayoutManager);
153
154        #[cfg(feature = "NSBezierPath")]
155        #[unsafe(method(exclusionPaths))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn exclusionPaths(&self) -> Retained<NSArray<NSBezierPath>>;
158
159        #[cfg(feature = "NSBezierPath")]
160        /// Setter for [`exclusionPaths`][Self::exclusionPaths].
161        #[unsafe(method(setExclusionPaths:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setExclusionPaths(&self, exclusion_paths: &NSArray<NSBezierPath>);
164
165        #[cfg(all(
166            feature = "NSResponder",
167            feature = "NSText",
168            feature = "NSTextView",
169            feature = "NSView"
170        ))]
171        #[unsafe(method(textView))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn textView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;
174
175        #[cfg(all(
176            feature = "NSResponder",
177            feature = "NSText",
178            feature = "NSTextView",
179            feature = "NSView"
180        ))]
181        /// This is a [weak property][objc2::topics::weak_property].
182        /// Setter for [`textView`][Self::textView].
183        #[unsafe(method(setTextView:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setTextView(&self, text_view: Option<&NSTextView>);
186    );
187}
188
189#[cfg(feature = "NSLayoutManager")]
190unsafe impl NSTextLayoutOrientationProvider for NSTextContainer {}
191
192/// ************************** Deprecated ***************************
193///
194/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nslinesweepdirection?language=objc)
195// NS_ENUM
196#[repr(transparent)]
197#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
198pub struct NSLineSweepDirection(pub NSUInteger);
199impl NSLineSweepDirection {
200    #[doc(alias = "NSLineSweepLeft")]
201    pub const Left: Self = Self(0);
202    #[doc(alias = "NSLineSweepRight")]
203    pub const Right: Self = Self(1);
204    #[doc(alias = "NSLineSweepDown")]
205    pub const Down: Self = Self(2);
206    #[doc(alias = "NSLineSweepUp")]
207    pub const Up: Self = Self(3);
208}
209
210unsafe impl Encode for NSLineSweepDirection {
211    const ENCODING: Encoding = NSUInteger::ENCODING;
212}
213
214unsafe impl RefEncode for NSLineSweepDirection {
215    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
216}
217
218/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslinemovementdirection?language=objc)
219// NS_ENUM
220#[repr(transparent)]
221#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
222pub struct NSLineMovementDirection(pub NSUInteger);
223impl NSLineMovementDirection {
224    #[doc(alias = "NSLineDoesntMove")]
225    pub const DoesntMove: Self = Self(0);
226    #[doc(alias = "NSLineMovesLeft")]
227    pub const MovesLeft: Self = Self(1);
228    #[doc(alias = "NSLineMovesRight")]
229    pub const MovesRight: Self = Self(2);
230    #[doc(alias = "NSLineMovesDown")]
231    pub const MovesDown: Self = Self(3);
232    #[doc(alias = "NSLineMovesUp")]
233    pub const MovesUp: Self = Self(4);
234}
235
236unsafe impl Encode for NSLineMovementDirection {
237    const ENCODING: Encoding = NSUInteger::ENCODING;
238}
239
240unsafe impl RefEncode for NSLineMovementDirection {
241    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
242}
243
244/// NSTextContainerDeprecated.
245impl NSTextContainer {
246    extern_methods!(
247        #[unsafe(method(initWithContainerSize:))]
248        #[unsafe(method_family = init)]
249        pub unsafe fn initWithContainerSize(
250            this: Allocated<Self>,
251            a_container_size: NSSize,
252        ) -> Retained<Self>;
253
254        #[unsafe(method(containerSize))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn containerSize(&self) -> NSSize;
257
258        /// Setter for [`containerSize`][Self::containerSize].
259        #[unsafe(method(setContainerSize:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setContainerSize(&self, container_size: NSSize);
262
263        #[unsafe(method(lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn lineFragmentRectForProposedRect_sweepDirection_movementDirection_remainingRect(
266            &self,
267            proposed_rect: NSRect,
268            sweep_direction: NSLineSweepDirection,
269            movement_direction: NSLineMovementDirection,
270            remaining_rect: NSRectPointer,
271        ) -> NSRect;
272
273        #[deprecated]
274        #[unsafe(method(containsPoint:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn containsPoint(&self, point: NSPoint) -> bool;
277    );
278}