objc2_ui_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/uikit/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 fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
38
39        /// # Safety
40        ///
41        /// `coder` possibly has further requirements.
42        #[unsafe(method(initWithCoder:))]
43        #[unsafe(method_family = init)]
44        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
45
46        #[cfg(feature = "NSTextLayoutManager")]
47        #[unsafe(method(textLayoutManager))]
48        #[unsafe(method_family = none)]
49        pub fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
50
51        #[cfg(feature = "objc2-core-foundation")]
52        /// *********************** Container shape properties ************************
53        #[unsafe(method(size))]
54        #[unsafe(method_family = none)]
55        pub fn size(&self) -> CGSize;
56
57        #[cfg(feature = "objc2-core-foundation")]
58        /// Setter for [`size`][Self::size].
59        #[unsafe(method(setSize:))]
60        #[unsafe(method_family = none)]
61        pub fn setSize(&self, size: CGSize);
62
63        #[cfg(feature = "NSParagraphStyle")]
64        #[unsafe(method(lineBreakMode))]
65        #[unsafe(method_family = none)]
66        pub fn lineBreakMode(&self) -> NSLineBreakMode;
67
68        #[cfg(feature = "NSParagraphStyle")]
69        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
70        #[unsafe(method(setLineBreakMode:))]
71        #[unsafe(method_family = none)]
72        pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
73
74        #[cfg(feature = "objc2-core-foundation")]
75        /// *********************** Layout constraint properties ************************
76        #[unsafe(method(lineFragmentPadding))]
77        #[unsafe(method_family = none)]
78        pub fn lineFragmentPadding(&self) -> CGFloat;
79
80        #[cfg(feature = "objc2-core-foundation")]
81        /// Setter for [`lineFragmentPadding`][Self::lineFragmentPadding].
82        #[unsafe(method(setLineFragmentPadding:))]
83        #[unsafe(method_family = none)]
84        pub fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
85
86        #[unsafe(method(maximumNumberOfLines))]
87        #[unsafe(method_family = none)]
88        pub fn maximumNumberOfLines(&self) -> NSUInteger;
89
90        /// Setter for [`maximumNumberOfLines`][Self::maximumNumberOfLines].
91        #[unsafe(method(setMaximumNumberOfLines:))]
92        #[unsafe(method_family = none)]
93        pub fn setMaximumNumberOfLines(&self, maximum_number_of_lines: NSUInteger);
94
95        #[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
96        /// ************************** Line fragments ***************************
97        ///
98        /// # Safety
99        ///
100        /// `remaining_rect` must be a valid pointer or null.
101        #[unsafe(method(lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn lineFragmentRectForProposedRect_atIndex_writingDirection_remainingRect(
104            &self,
105            proposed_rect: CGRect,
106            character_index: NSUInteger,
107            base_writing_direction: NSWritingDirection,
108            remaining_rect: *mut CGRect,
109        ) -> CGRect;
110
111        #[unsafe(method(isSimpleRectangularTextContainer))]
112        #[unsafe(method_family = none)]
113        pub fn isSimpleRectangularTextContainer(&self) -> bool;
114
115        /// ************************** View synchronization ***************************
116        #[unsafe(method(widthTracksTextView))]
117        #[unsafe(method_family = none)]
118        pub fn widthTracksTextView(&self) -> bool;
119
120        /// Setter for [`widthTracksTextView`][Self::widthTracksTextView].
121        #[unsafe(method(setWidthTracksTextView:))]
122        #[unsafe(method_family = none)]
123        pub fn setWidthTracksTextView(&self, width_tracks_text_view: bool);
124
125        #[unsafe(method(heightTracksTextView))]
126        #[unsafe(method_family = none)]
127        pub fn heightTracksTextView(&self) -> bool;
128
129        /// Setter for [`heightTracksTextView`][Self::heightTracksTextView].
130        #[unsafe(method(setHeightTracksTextView:))]
131        #[unsafe(method_family = none)]
132        pub fn setHeightTracksTextView(&self, height_tracks_text_view: bool);
133    );
134}
135
136/// Methods declared on superclass `NSObject`.
137impl NSTextContainer {
138    extern_methods!(
139        #[unsafe(method(init))]
140        #[unsafe(method_family = init)]
141        pub fn init(this: Allocated<Self>) -> Retained<Self>;
142
143        #[unsafe(method(new))]
144        #[unsafe(method_family = new)]
145        pub fn new() -> Retained<Self>;
146    );
147}
148
149impl DefaultRetained for NSTextContainer {
150    #[inline]
151    fn default_retained() -> Retained<Self> {
152        Self::new()
153    }
154}
155
156impl NSTextContainer {
157    extern_methods!(
158        #[cfg(feature = "NSLayoutManager")]
159        /// # Safety
160        ///
161        /// This is not retained internally, you must ensure the object is still alive.
162        #[unsafe(method(layoutManager))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
165
166        #[cfg(feature = "NSLayoutManager")]
167        /// Setter for [`layoutManager`][Self::layoutManager].
168        ///
169        /// # Safety
170        ///
171        /// This is unretained, you must ensure the object is kept alive while in use.
172        #[unsafe(method(setLayoutManager:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setLayoutManager(&self, layout_manager: Option<&NSLayoutManager>);
175
176        #[cfg(feature = "NSLayoutManager")]
177        #[unsafe(method(replaceLayoutManager:))]
178        #[unsafe(method_family = none)]
179        pub fn replaceLayoutManager(&self, new_layout_manager: &NSLayoutManager);
180
181        #[cfg(feature = "UIBezierPath")]
182        #[unsafe(method(exclusionPaths))]
183        #[unsafe(method_family = none)]
184        pub fn exclusionPaths(&self) -> Retained<NSArray<UIBezierPath>>;
185
186        #[cfg(feature = "UIBezierPath")]
187        /// Setter for [`exclusionPaths`][Self::exclusionPaths].
188        ///
189        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
190        #[unsafe(method(setExclusionPaths:))]
191        #[unsafe(method_family = none)]
192        pub fn setExclusionPaths(&self, exclusion_paths: &NSArray<UIBezierPath>);
193    );
194}
195
196#[cfg(feature = "NSLayoutManager")]
197extern_conformance!(
198    unsafe impl NSTextLayoutOrientationProvider for NSTextContainer {}
199);