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