objc2_app_kit/generated/
NSTextContainer.rs1use 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 #[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 #[unsafe(method(initWithSize:))]
36 #[unsafe(method_family = init)]
37 pub fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;
38
39 #[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 #[unsafe(method(size))]
54 #[unsafe(method_family = none)]
55 pub fn size(&self) -> CGSize;
56
57 #[cfg(feature = "objc2-core-foundation")]
58 #[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 #[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 #[unsafe(method(lineFragmentPadding))]
77 #[unsafe(method_family = none)]
78 pub fn lineFragmentPadding(&self) -> CGFloat;
79
80 #[cfg(feature = "objc2-core-foundation")]
81 #[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 #[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 #[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 #[unsafe(method(widthTracksTextView))]
117 #[unsafe(method_family = none)]
118 pub fn widthTracksTextView(&self) -> bool;
119
120 #[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 #[unsafe(method(setHeightTracksTextView:))]
131 #[unsafe(method_family = none)]
132 pub fn setHeightTracksTextView(&self, height_tracks_text_view: bool);
133 );
134}
135
136impl 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 #[unsafe(method(layoutManager))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
165
166 #[cfg(feature = "NSLayoutManager")]
167 #[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 = "NSBezierPath")]
182 #[unsafe(method(exclusionPaths))]
183 #[unsafe(method_family = none)]
184 pub fn exclusionPaths(&self) -> Retained<NSArray<NSBezierPath>>;
185
186 #[cfg(feature = "NSBezierPath")]
187 #[unsafe(method(setExclusionPaths:))]
191 #[unsafe(method_family = none)]
192 pub fn setExclusionPaths(&self, exclusion_paths: &NSArray<NSBezierPath>);
193
194 #[cfg(all(
195 feature = "NSResponder",
196 feature = "NSText",
197 feature = "NSTextView",
198 feature = "NSView"
199 ))]
200 #[unsafe(method(textView))]
201 #[unsafe(method_family = none)]
202 pub fn textView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;
203
204 #[cfg(all(
205 feature = "NSResponder",
206 feature = "NSText",
207 feature = "NSTextView",
208 feature = "NSView"
209 ))]
210 #[unsafe(method(setTextView:))]
214 #[unsafe(method_family = none)]
215 pub fn setTextView(&self, text_view: Option<&NSTextView>);
216 );
217}
218
219#[cfg(feature = "NSLayoutManager")]
220extern_conformance!(
221 unsafe impl NSTextLayoutOrientationProvider for NSTextContainer {}
222);
223
224#[repr(transparent)]
229#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
230pub struct NSLineSweepDirection(pub NSUInteger);
231impl NSLineSweepDirection {
232 #[doc(alias = "NSLineSweepLeft")]
233 pub const Left: Self = Self(0);
234 #[doc(alias = "NSLineSweepRight")]
235 pub const Right: Self = Self(1);
236 #[doc(alias = "NSLineSweepDown")]
237 pub const Down: Self = Self(2);
238 #[doc(alias = "NSLineSweepUp")]
239 pub const Up: Self = Self(3);
240}
241
242unsafe impl Encode for NSLineSweepDirection {
243 const ENCODING: Encoding = NSUInteger::ENCODING;
244}
245
246unsafe impl RefEncode for NSLineSweepDirection {
247 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
248}
249
250#[repr(transparent)]
253#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
254pub struct NSLineMovementDirection(pub NSUInteger);
255impl NSLineMovementDirection {
256 #[doc(alias = "NSLineDoesntMove")]
257 pub const DoesntMove: Self = Self(0);
258 #[doc(alias = "NSLineMovesLeft")]
259 pub const MovesLeft: Self = Self(1);
260 #[doc(alias = "NSLineMovesRight")]
261 pub const MovesRight: Self = Self(2);
262 #[doc(alias = "NSLineMovesDown")]
263 pub const MovesDown: Self = Self(3);
264 #[doc(alias = "NSLineMovesUp")]
265 pub const MovesUp: Self = Self(4);
266}
267
268unsafe impl Encode for NSLineMovementDirection {
269 const ENCODING: Encoding = NSUInteger::ENCODING;
270}
271
272unsafe impl RefEncode for NSLineMovementDirection {
273 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
274}
275
276impl NSTextContainer {
278 extern_methods!(
279 #[unsafe(method(initWithContainerSize:))]
280 #[unsafe(method_family = init)]
281 pub fn initWithContainerSize(
282 this: Allocated<Self>,
283 a_container_size: NSSize,
284 ) -> Retained<Self>;
285
286 #[unsafe(method(containerSize))]
287 #[unsafe(method_family = none)]
288 pub fn containerSize(&self) -> NSSize;
289
290 #[unsafe(method(setContainerSize:))]
292 #[unsafe(method_family = none)]
293 pub fn setContainerSize(&self, container_size: NSSize);
294
295 #[unsafe(method(lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn lineFragmentRectForProposedRect_sweepDirection_movementDirection_remainingRect(
301 &self,
302 proposed_rect: NSRect,
303 sweep_direction: NSLineSweepDirection,
304 movement_direction: NSLineMovementDirection,
305 remaining_rect: NSRectPointer,
306 ) -> NSRect;
307
308 #[deprecated]
309 #[unsafe(method(containsPoint:))]
310 #[unsafe(method_family = none)]
311 pub fn containsPoint(&self, point: NSPoint) -> bool;
312 );
313}