1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct NSTextLayoutOrientation(pub NSInteger);
20impl NSTextLayoutOrientation {
21 #[doc(alias = "NSTextLayoutOrientationHorizontal")]
22 pub const Horizontal: Self = Self(0);
23 #[doc(alias = "NSTextLayoutOrientationVertical")]
24 pub const Vertical: Self = Self(1);
25}
26
27unsafe impl Encode for NSTextLayoutOrientation {
28 const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSTextLayoutOrientation {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NSGlyphProperty(pub NSInteger);
40bitflags::bitflags! {
41 impl NSGlyphProperty: NSInteger {
42 #[doc(alias = "NSGlyphPropertyNull")]
43 const Null = 1<<0;
44 #[doc(alias = "NSGlyphPropertyControlCharacter")]
45 const ControlCharacter = 1<<1;
46 #[doc(alias = "NSGlyphPropertyElastic")]
47 const Elastic = 1<<2;
48 #[doc(alias = "NSGlyphPropertyNonBaseCharacter")]
49 const NonBaseCharacter = 1<<3;
50 }
51}
52
53unsafe impl Encode for NSGlyphProperty {
54 const ENCODING: Encoding = NSInteger::ENCODING;
55}
56
57unsafe impl RefEncode for NSGlyphProperty {
58 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61#[repr(transparent)]
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
65pub struct NSControlCharacterAction(pub NSInteger);
66bitflags::bitflags! {
67 impl NSControlCharacterAction: NSInteger {
68 #[doc(alias = "NSControlCharacterActionZeroAdvancement")]
69 const ZeroAdvancement = 1<<0;
70 #[doc(alias = "NSControlCharacterActionWhitespace")]
71 const Whitespace = 1<<1;
72 #[doc(alias = "NSControlCharacterActionHorizontalTab")]
73 const HorizontalTab = 1<<2;
74 #[doc(alias = "NSControlCharacterActionLineBreak")]
75 const LineBreak = 1<<3;
76 #[doc(alias = "NSControlCharacterActionParagraphBreak")]
77 const ParagraphBreak = 1<<4;
78 #[doc(alias = "NSControlCharacterActionContainerBreak")]
79 const ContainerBreak = 1<<5;
80 }
81}
82
83unsafe impl Encode for NSControlCharacterAction {
84 const ENCODING: Encoding = NSInteger::ENCODING;
85}
86
87unsafe impl RefEncode for NSControlCharacterAction {
88 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
89}
90
91extern_protocol!(
92 pub unsafe trait NSTextLayoutOrientationProvider {
94 #[unsafe(method(layoutOrientation))]
95 #[unsafe(method_family = none)]
96 unsafe fn layoutOrientation(&self) -> NSTextLayoutOrientation;
97 }
98);
99
100#[repr(transparent)]
103#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
104pub struct NSTypesetterBehavior(pub NSInteger);
105impl NSTypesetterBehavior {
106 #[doc(alias = "NSTypesetterLatestBehavior")]
107 pub const LatestBehavior: Self = Self(-1);
108 #[doc(alias = "NSTypesetterOriginalBehavior")]
109 pub const OriginalBehavior: Self = Self(0);
110 #[doc(alias = "NSTypesetterBehavior_10_2_WithCompatibility")]
111 pub const Behavior_10_2_WithCompatibility: Self = Self(1);
112 #[doc(alias = "NSTypesetterBehavior_10_2")]
113 pub const Behavior_10_2: Self = Self(2);
114 #[doc(alias = "NSTypesetterBehavior_10_3")]
115 pub const Behavior_10_3: Self = Self(3);
116 #[doc(alias = "NSTypesetterBehavior_10_4")]
117 pub const Behavior_10_4: Self = Self(4);
118}
119
120unsafe impl Encode for NSTypesetterBehavior {
121 const ENCODING: Encoding = NSInteger::ENCODING;
122}
123
124unsafe impl RefEncode for NSTypesetterBehavior {
125 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
126}
127
128extern_class!(
129 #[unsafe(super(NSObject))]
131 #[derive(Debug, PartialEq, Eq, Hash)]
132 pub struct NSLayoutManager;
133);
134
135extern_conformance!(
136 unsafe impl NSCoding for NSLayoutManager {}
137);
138
139extern_conformance!(
140 unsafe impl NSObjectProtocol for NSLayoutManager {}
141);
142
143extern_conformance!(
144 unsafe impl NSSecureCoding for NSLayoutManager {}
145);
146
147impl NSLayoutManager {
148 extern_methods!(
149 #[unsafe(method(init))]
151 #[unsafe(method_family = init)]
152 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154 #[unsafe(method(initWithCoder:))]
155 #[unsafe(method_family = init)]
156 pub unsafe fn initWithCoder(
157 this: Allocated<Self>,
158 coder: &NSCoder,
159 ) -> Option<Retained<Self>>;
160
161 #[cfg(feature = "NSTextStorage")]
162 #[unsafe(method(textStorage))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn textStorage(&self) -> Option<Retained<NSTextStorage>>;
166
167 #[cfg(feature = "NSTextStorage")]
168 #[unsafe(method(setTextStorage:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn setTextStorage(&self, text_storage: Option<&NSTextStorage>);
172
173 #[cfg(feature = "NSTextStorage")]
174 #[unsafe(method(replaceTextStorage:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn replaceTextStorage(&self, new_text_storage: &NSTextStorage);
177
178 #[cfg(feature = "NSTextContainer")]
179 #[unsafe(method(textContainers))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn textContainers(&self) -> Retained<NSArray<NSTextContainer>>;
183
184 #[cfg(feature = "NSTextContainer")]
185 #[unsafe(method(addTextContainer:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn addTextContainer(&self, container: &NSTextContainer);
188
189 #[cfg(feature = "NSTextContainer")]
190 #[unsafe(method(insertTextContainer:atIndex:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn insertTextContainer_atIndex(
193 &self,
194 container: &NSTextContainer,
195 index: NSUInteger,
196 );
197
198 #[unsafe(method(removeTextContainerAtIndex:))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn removeTextContainerAtIndex(&self, index: NSUInteger);
201
202 #[cfg(feature = "NSTextContainer")]
203 #[unsafe(method(textContainerChangedGeometry:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn textContainerChangedGeometry(&self, container: &NSTextContainer);
206
207 #[cfg(feature = "NSTextContainer")]
208 #[unsafe(method(textContainerChangedTextView:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn textContainerChangedTextView(&self, container: &NSTextContainer);
211
212 #[unsafe(method(delegate))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn delegate(
216 &self,
217 ) -> Option<Retained<ProtocolObject<dyn NSLayoutManagerDelegate>>>;
218
219 #[unsafe(method(setDelegate:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setDelegate(
224 &self,
225 delegate: Option<&ProtocolObject<dyn NSLayoutManagerDelegate>>,
226 );
227
228 #[unsafe(method(showsInvisibleCharacters))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn showsInvisibleCharacters(&self) -> bool;
232
233 #[unsafe(method(setShowsInvisibleCharacters:))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn setShowsInvisibleCharacters(&self, shows_invisible_characters: bool);
237
238 #[unsafe(method(showsControlCharacters))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn showsControlCharacters(&self) -> bool;
241
242 #[unsafe(method(setShowsControlCharacters:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn setShowsControlCharacters(&self, shows_control_characters: bool);
246
247 #[unsafe(method(usesDefaultHyphenation))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn usesDefaultHyphenation(&self) -> bool;
250
251 #[unsafe(method(setUsesDefaultHyphenation:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn setUsesDefaultHyphenation(&self, uses_default_hyphenation: bool);
255
256 #[unsafe(method(usesFontLeading))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn usesFontLeading(&self) -> bool;
259
260 #[unsafe(method(setUsesFontLeading:))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool);
264
265 #[unsafe(method(allowsNonContiguousLayout))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn allowsNonContiguousLayout(&self) -> bool;
268
269 #[unsafe(method(setAllowsNonContiguousLayout:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setAllowsNonContiguousLayout(&self, allows_non_contiguous_layout: bool);
273
274 #[unsafe(method(hasNonContiguousLayout))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn hasNonContiguousLayout(&self) -> bool;
277
278 #[unsafe(method(limitsLayoutForSuspiciousContents))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn limitsLayoutForSuspiciousContents(&self) -> bool;
281
282 #[unsafe(method(setLimitsLayoutForSuspiciousContents:))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn setLimitsLayoutForSuspiciousContents(
286 &self,
287 limits_layout_for_suspicious_contents: bool,
288 );
289
290 #[unsafe(method(backgroundLayoutEnabled))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn backgroundLayoutEnabled(&self) -> bool;
293
294 #[unsafe(method(setBackgroundLayoutEnabled:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setBackgroundLayoutEnabled(&self, background_layout_enabled: bool);
298
299 #[cfg(feature = "NSCell")]
300 #[unsafe(method(defaultAttachmentScaling))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn defaultAttachmentScaling(&self) -> NSImageScaling;
303
304 #[cfg(feature = "NSCell")]
305 #[unsafe(method(setDefaultAttachmentScaling:))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn setDefaultAttachmentScaling(
309 &self,
310 default_attachment_scaling: NSImageScaling,
311 );
312
313 #[cfg(feature = "NSTypesetter")]
314 #[unsafe(method(typesetter))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn typesetter(&self) -> Retained<NSTypesetter>;
318
319 #[cfg(feature = "NSTypesetter")]
320 #[unsafe(method(setTypesetter:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn setTypesetter(&self, typesetter: &NSTypesetter);
324
325 #[unsafe(method(typesetterBehavior))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior;
328
329 #[unsafe(method(setTypesetterBehavior:))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
333
334 #[unsafe(method(invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:))]
336 #[unsafe(method_family = none)]
337 pub unsafe fn invalidateGlyphsForCharacterRange_changeInLength_actualCharacterRange(
338 &self,
339 char_range: NSRange,
340 delta: NSInteger,
341 actual_char_range: NSRangePointer,
342 );
343
344 #[unsafe(method(invalidateLayoutForCharacterRange:actualCharacterRange:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn invalidateLayoutForCharacterRange_actualCharacterRange(
347 &self,
348 char_range: NSRange,
349 actual_char_range: NSRangePointer,
350 );
351
352 #[unsafe(method(invalidateDisplayForCharacterRange:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn invalidateDisplayForCharacterRange(&self, char_range: NSRange);
355
356 #[unsafe(method(invalidateDisplayForGlyphRange:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn invalidateDisplayForGlyphRange(&self, glyph_range: NSRange);
359
360 #[cfg(feature = "NSTextStorage")]
361 #[unsafe(method(processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn processEditingForTextStorage_edited_range_changeInLength_invalidatedRange(
364 &self,
365 text_storage: &NSTextStorage,
366 edit_mask: NSTextStorageEditActions,
367 new_char_range: NSRange,
368 delta: NSInteger,
369 invalidated_char_range: NSRange,
370 );
371
372 #[unsafe(method(ensureGlyphsForCharacterRange:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn ensureGlyphsForCharacterRange(&self, char_range: NSRange);
376
377 #[unsafe(method(ensureGlyphsForGlyphRange:))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn ensureGlyphsForGlyphRange(&self, glyph_range: NSRange);
380
381 #[unsafe(method(ensureLayoutForCharacterRange:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn ensureLayoutForCharacterRange(&self, char_range: NSRange);
384
385 #[unsafe(method(ensureLayoutForGlyphRange:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn ensureLayoutForGlyphRange(&self, glyph_range: NSRange);
388
389 #[cfg(feature = "NSTextContainer")]
390 #[unsafe(method(ensureLayoutForTextContainer:))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn ensureLayoutForTextContainer(&self, container: &NSTextContainer);
393
394 #[cfg(feature = "NSTextContainer")]
395 #[unsafe(method(ensureLayoutForBoundingRect:inTextContainer:))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn ensureLayoutForBoundingRect_inTextContainer(
398 &self,
399 bounds: NSRect,
400 container: &NSTextContainer,
401 );
402
403 #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
404 #[cfg(target_vendor = "apple")]
405 #[unsafe(method(setGlyphs:properties:characterIndexes:font:forGlyphRange:))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn setGlyphs_properties_characterIndexes_font_forGlyphRange(
409 &self,
410 glyphs: NonNull<CGGlyph>,
411 props: NonNull<NSGlyphProperty>,
412 char_indexes: NonNull<NSUInteger>,
413 a_font: &NSFont,
414 glyph_range: NSRange,
415 );
416
417 #[unsafe(method(numberOfGlyphs))]
419 #[unsafe(method_family = none)]
420 pub unsafe fn numberOfGlyphs(&self) -> NSUInteger;
421
422 #[cfg(feature = "objc2-core-graphics")]
423 #[cfg(target_vendor = "apple")]
424 #[unsafe(method(CGGlyphAtIndex:isValidIndex:))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn CGGlyphAtIndex_isValidIndex(
427 &self,
428 glyph_index: NSUInteger,
429 is_valid_index: *mut Bool,
430 ) -> CGGlyph;
431
432 #[cfg(feature = "objc2-core-graphics")]
433 #[cfg(target_vendor = "apple")]
434 #[unsafe(method(CGGlyphAtIndex:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn CGGlyphAtIndex(&self, glyph_index: NSUInteger) -> CGGlyph;
437
438 #[unsafe(method(isValidGlyphIndex:))]
439 #[unsafe(method_family = none)]
440 pub unsafe fn isValidGlyphIndex(&self, glyph_index: NSUInteger) -> bool;
441
442 #[unsafe(method(propertyForGlyphAtIndex:))]
443 #[unsafe(method_family = none)]
444 pub unsafe fn propertyForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyphProperty;
445
446 #[unsafe(method(characterIndexForGlyphAtIndex:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn characterIndexForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSUInteger;
449
450 #[unsafe(method(glyphIndexForCharacterAtIndex:))]
451 #[unsafe(method_family = none)]
452 pub unsafe fn glyphIndexForCharacterAtIndex(&self, char_index: NSUInteger) -> NSUInteger;
453
454 #[cfg(feature = "objc2-core-graphics")]
455 #[cfg(target_vendor = "apple")]
456 #[unsafe(method(getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn getGlyphsInRange_glyphs_properties_characterIndexes_bidiLevels(
459 &self,
460 glyph_range: NSRange,
461 glyph_buffer: *mut CGGlyph,
462 props: *mut NSGlyphProperty,
463 char_index_buffer: *mut NSUInteger,
464 bidi_level_buffer: *mut c_uchar,
465 ) -> NSUInteger;
466
467 #[cfg(feature = "NSTextContainer")]
468 #[unsafe(method(setTextContainer:forGlyphRange:))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn setTextContainer_forGlyphRange(
471 &self,
472 container: &NSTextContainer,
473 glyph_range: NSRange,
474 );
475
476 #[unsafe(method(setLineFragmentRect:forGlyphRange:usedRect:))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn setLineFragmentRect_forGlyphRange_usedRect(
479 &self,
480 fragment_rect: NSRect,
481 glyph_range: NSRange,
482 used_rect: NSRect,
483 );
484
485 #[cfg(feature = "NSTextContainer")]
486 #[unsafe(method(setExtraLineFragmentRect:usedRect:textContainer:))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn setExtraLineFragmentRect_usedRect_textContainer(
489 &self,
490 fragment_rect: NSRect,
491 used_rect: NSRect,
492 container: &NSTextContainer,
493 );
494
495 #[unsafe(method(setLocation:forStartOfGlyphRange:))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn setLocation_forStartOfGlyphRange(
498 &self,
499 location: NSPoint,
500 glyph_range: NSRange,
501 );
502
503 #[unsafe(method(setNotShownAttribute:forGlyphAtIndex:))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn setNotShownAttribute_forGlyphAtIndex(
506 &self,
507 flag: bool,
508 glyph_index: NSUInteger,
509 );
510
511 #[unsafe(method(setDrawsOutsideLineFragment:forGlyphAtIndex:))]
512 #[unsafe(method_family = none)]
513 pub unsafe fn setDrawsOutsideLineFragment_forGlyphAtIndex(
514 &self,
515 flag: bool,
516 glyph_index: NSUInteger,
517 );
518
519 #[unsafe(method(setAttachmentSize:forGlyphRange:))]
520 #[unsafe(method_family = none)]
521 pub unsafe fn setAttachmentSize_forGlyphRange(
522 &self,
523 attachment_size: NSSize,
524 glyph_range: NSRange,
525 );
526
527 #[unsafe(method(getFirstUnlaidCharacterIndex:glyphIndex:))]
529 #[unsafe(method_family = none)]
530 pub unsafe fn getFirstUnlaidCharacterIndex_glyphIndex(
531 &self,
532 char_index: *mut NSUInteger,
533 glyph_index: *mut NSUInteger,
534 );
535
536 #[unsafe(method(firstUnlaidCharacterIndex))]
537 #[unsafe(method_family = none)]
538 pub unsafe fn firstUnlaidCharacterIndex(&self) -> NSUInteger;
539
540 #[unsafe(method(firstUnlaidGlyphIndex))]
541 #[unsafe(method_family = none)]
542 pub unsafe fn firstUnlaidGlyphIndex(&self) -> NSUInteger;
543
544 #[cfg(feature = "NSTextContainer")]
545 #[unsafe(method(textContainerForGlyphAtIndex:effectiveRange:))]
546 #[unsafe(method_family = none)]
547 pub unsafe fn textContainerForGlyphAtIndex_effectiveRange(
548 &self,
549 glyph_index: NSUInteger,
550 effective_glyph_range: NSRangePointer,
551 ) -> Option<Retained<NSTextContainer>>;
552
553 #[cfg(feature = "NSTextContainer")]
554 #[unsafe(method(textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
555 #[unsafe(method_family = none)]
556 pub unsafe fn textContainerForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
557 &self,
558 glyph_index: NSUInteger,
559 effective_glyph_range: NSRangePointer,
560 flag: bool,
561 ) -> Option<Retained<NSTextContainer>>;
562
563 #[cfg(feature = "NSTextContainer")]
564 #[unsafe(method(usedRectForTextContainer:))]
565 #[unsafe(method_family = none)]
566 pub unsafe fn usedRectForTextContainer(&self, container: &NSTextContainer) -> NSRect;
567
568 #[unsafe(method(lineFragmentRectForGlyphAtIndex:effectiveRange:))]
569 #[unsafe(method_family = none)]
570 pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange(
571 &self,
572 glyph_index: NSUInteger,
573 effective_glyph_range: NSRangePointer,
574 ) -> NSRect;
575
576 #[unsafe(method(lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
577 #[unsafe(method_family = none)]
578 pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
579 &self,
580 glyph_index: NSUInteger,
581 effective_glyph_range: NSRangePointer,
582 flag: bool,
583 ) -> NSRect;
584
585 #[unsafe(method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:))]
586 #[unsafe(method_family = none)]
587 pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange(
588 &self,
589 glyph_index: NSUInteger,
590 effective_glyph_range: NSRangePointer,
591 ) -> NSRect;
592
593 #[unsafe(method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
594 #[unsafe(method_family = none)]
595 pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
596 &self,
597 glyph_index: NSUInteger,
598 effective_glyph_range: NSRangePointer,
599 flag: bool,
600 ) -> NSRect;
601
602 #[unsafe(method(extraLineFragmentRect))]
603 #[unsafe(method_family = none)]
604 pub unsafe fn extraLineFragmentRect(&self) -> NSRect;
605
606 #[unsafe(method(extraLineFragmentUsedRect))]
607 #[unsafe(method_family = none)]
608 pub unsafe fn extraLineFragmentUsedRect(&self) -> NSRect;
609
610 #[cfg(feature = "NSTextContainer")]
611 #[unsafe(method(extraLineFragmentTextContainer))]
612 #[unsafe(method_family = none)]
613 pub unsafe fn extraLineFragmentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
614
615 #[unsafe(method(locationForGlyphAtIndex:))]
616 #[unsafe(method_family = none)]
617 pub unsafe fn locationForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSPoint;
618
619 #[unsafe(method(notShownAttributeForGlyphAtIndex:))]
620 #[unsafe(method_family = none)]
621 pub unsafe fn notShownAttributeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> bool;
622
623 #[unsafe(method(drawsOutsideLineFragmentForGlyphAtIndex:))]
624 #[unsafe(method_family = none)]
625 pub unsafe fn drawsOutsideLineFragmentForGlyphAtIndex(
626 &self,
627 glyph_index: NSUInteger,
628 ) -> bool;
629
630 #[unsafe(method(attachmentSizeForGlyphAtIndex:))]
631 #[unsafe(method_family = none)]
632 pub unsafe fn attachmentSizeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSSize;
633
634 #[unsafe(method(truncatedGlyphRangeInLineFragmentForGlyphAtIndex:))]
635 #[unsafe(method_family = none)]
636 pub unsafe fn truncatedGlyphRangeInLineFragmentForGlyphAtIndex(
637 &self,
638 glyph_index: NSUInteger,
639 ) -> NSRange;
640
641 #[unsafe(method(glyphRangeForCharacterRange:actualCharacterRange:))]
643 #[unsafe(method_family = none)]
644 pub unsafe fn glyphRangeForCharacterRange_actualCharacterRange(
645 &self,
646 char_range: NSRange,
647 actual_char_range: NSRangePointer,
648 ) -> NSRange;
649
650 #[unsafe(method(characterRangeForGlyphRange:actualGlyphRange:))]
651 #[unsafe(method_family = none)]
652 pub unsafe fn characterRangeForGlyphRange_actualGlyphRange(
653 &self,
654 glyph_range: NSRange,
655 actual_glyph_range: NSRangePointer,
656 ) -> NSRange;
657
658 #[cfg(feature = "NSTextContainer")]
659 #[unsafe(method(glyphRangeForTextContainer:))]
660 #[unsafe(method_family = none)]
661 pub unsafe fn glyphRangeForTextContainer(&self, container: &NSTextContainer) -> NSRange;
662
663 #[unsafe(method(rangeOfNominallySpacedGlyphsContainingIndex:))]
664 #[unsafe(method_family = none)]
665 pub unsafe fn rangeOfNominallySpacedGlyphsContainingIndex(
666 &self,
667 glyph_index: NSUInteger,
668 ) -> NSRange;
669
670 #[cfg(feature = "NSTextContainer")]
671 #[unsafe(method(boundingRectForGlyphRange:inTextContainer:))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn boundingRectForGlyphRange_inTextContainer(
674 &self,
675 glyph_range: NSRange,
676 container: &NSTextContainer,
677 ) -> NSRect;
678
679 #[cfg(feature = "NSTextContainer")]
680 #[unsafe(method(glyphRangeForBoundingRect:inTextContainer:))]
681 #[unsafe(method_family = none)]
682 pub unsafe fn glyphRangeForBoundingRect_inTextContainer(
683 &self,
684 bounds: NSRect,
685 container: &NSTextContainer,
686 ) -> NSRange;
687
688 #[cfg(feature = "NSTextContainer")]
689 #[unsafe(method(glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:))]
690 #[unsafe(method_family = none)]
691 pub unsafe fn glyphRangeForBoundingRectWithoutAdditionalLayout_inTextContainer(
692 &self,
693 bounds: NSRect,
694 container: &NSTextContainer,
695 ) -> NSRange;
696
697 #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
698 #[unsafe(method(glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:))]
699 #[unsafe(method_family = none)]
700 pub unsafe fn glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph(
701 &self,
702 point: NSPoint,
703 container: &NSTextContainer,
704 partial_fraction: *mut CGFloat,
705 ) -> NSUInteger;
706
707 #[cfg(feature = "NSTextContainer")]
708 #[unsafe(method(glyphIndexForPoint:inTextContainer:))]
709 #[unsafe(method_family = none)]
710 pub unsafe fn glyphIndexForPoint_inTextContainer(
711 &self,
712 point: NSPoint,
713 container: &NSTextContainer,
714 ) -> NSUInteger;
715
716 #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
717 #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:inTextContainer:))]
718 #[unsafe(method_family = none)]
719 pub unsafe fn fractionOfDistanceThroughGlyphForPoint_inTextContainer(
720 &self,
721 point: NSPoint,
722 container: &NSTextContainer,
723 ) -> CGFloat;
724
725 #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
726 #[unsafe(method(characterIndexForPoint:inTextContainer:fractionOfDistanceBetweenInsertionPoints:))]
727 #[unsafe(method_family = none)]
728 pub unsafe fn characterIndexForPoint_inTextContainer_fractionOfDistanceBetweenInsertionPoints(
729 &self,
730 point: NSPoint,
731 container: &NSTextContainer,
732 partial_fraction: *mut CGFloat,
733 ) -> NSUInteger;
734
735 #[cfg(feature = "objc2-core-foundation")]
736 #[unsafe(method(getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:))]
737 #[unsafe(method_family = none)]
738 pub unsafe fn getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes(
739 &self,
740 char_index: NSUInteger,
741 a_flag: bool,
742 d_flag: bool,
743 positions: *mut CGFloat,
744 char_indexes: *mut NSUInteger,
745 ) -> NSUInteger;
746
747 #[cfg(all(feature = "NSTextContainer", feature = "block2"))]
748 #[unsafe(method(enumerateLineFragmentsForGlyphRange:usingBlock:))]
749 #[unsafe(method_family = none)]
750 pub unsafe fn enumerateLineFragmentsForGlyphRange_usingBlock(
751 &self,
752 glyph_range: NSRange,
753 block: &block2::DynBlock<
754 dyn Fn(NSRect, NSRect, NonNull<NSTextContainer>, NSRange, NonNull<Bool>),
755 >,
756 );
757
758 #[cfg(all(feature = "NSTextContainer", feature = "block2"))]
759 #[unsafe(method(enumerateEnclosingRectsForGlyphRange:withinSelectedGlyphRange:inTextContainer:usingBlock:))]
760 #[unsafe(method_family = none)]
761 pub unsafe fn enumerateEnclosingRectsForGlyphRange_withinSelectedGlyphRange_inTextContainer_usingBlock(
762 &self,
763 glyph_range: NSRange,
764 selected_range: NSRange,
765 text_container: &NSTextContainer,
766 block: &block2::DynBlock<dyn Fn(NSRect, NonNull<Bool>)>,
767 );
768
769 #[unsafe(method(drawBackgroundForGlyphRange:atPoint:))]
771 #[unsafe(method_family = none)]
772 pub unsafe fn drawBackgroundForGlyphRange_atPoint(
773 &self,
774 glyphs_to_show: NSRange,
775 origin: NSPoint,
776 );
777
778 #[unsafe(method(drawGlyphsForGlyphRange:atPoint:))]
779 #[unsafe(method_family = none)]
780 pub unsafe fn drawGlyphsForGlyphRange_atPoint(
781 &self,
782 glyphs_to_show: NSRange,
783 origin: NSPoint,
784 );
785
786 #[cfg(all(
787 feature = "NSFont",
788 feature = "objc2-core-foundation",
789 feature = "objc2-core-graphics"
790 ))]
791 #[cfg(target_vendor = "apple")]
792 #[unsafe(method(showCGGlyphs:positions:count:font:textMatrix:attributes:inContext:))]
793 #[unsafe(method_family = none)]
794 pub unsafe fn showCGGlyphs_positions_count_font_textMatrix_attributes_inContext(
795 &self,
796 glyphs: NonNull<CGGlyph>,
797 positions: NonNull<CGPoint>,
798 glyph_count: NSInteger,
799 font: &NSFont,
800 text_matrix: CGAffineTransform,
801 attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
802 cg_context: &CGContext,
803 );
804
805 #[cfg(feature = "NSColor")]
806 #[unsafe(method(fillBackgroundRectArray:count:forCharacterRange:color:))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn fillBackgroundRectArray_count_forCharacterRange_color(
809 &self,
810 rect_array: NonNull<NSRect>,
811 rect_count: NSUInteger,
812 char_range: NSRange,
813 color: &NSColor,
814 );
815
816 #[cfg(all(feature = "NSAttributedString", feature = "objc2-core-foundation"))]
817 #[unsafe(method(drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
818 #[unsafe(method_family = none)]
819 pub unsafe fn drawUnderlineForGlyphRange_underlineType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
820 &self,
821 glyph_range: NSRange,
822 underline_val: NSUnderlineStyle,
823 baseline_offset: CGFloat,
824 line_rect: NSRect,
825 line_glyph_range: NSRange,
826 container_origin: NSPoint,
827 );
828
829 #[cfg(feature = "NSAttributedString")]
830 #[unsafe(method(underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
831 #[unsafe(method_family = none)]
832 pub unsafe fn underlineGlyphRange_underlineType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
833 &self,
834 glyph_range: NSRange,
835 underline_val: NSUnderlineStyle,
836 line_rect: NSRect,
837 line_glyph_range: NSRange,
838 container_origin: NSPoint,
839 );
840
841 #[cfg(all(feature = "NSAttributedString", feature = "objc2-core-foundation"))]
842 #[unsafe(method(drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
843 #[unsafe(method_family = none)]
844 pub unsafe fn drawStrikethroughForGlyphRange_strikethroughType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
845 &self,
846 glyph_range: NSRange,
847 strikethrough_val: NSUnderlineStyle,
848 baseline_offset: CGFloat,
849 line_rect: NSRect,
850 line_glyph_range: NSRange,
851 container_origin: NSPoint,
852 );
853
854 #[cfg(feature = "NSAttributedString")]
855 #[unsafe(method(strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
856 #[unsafe(method_family = none)]
857 pub unsafe fn strikethroughGlyphRange_strikethroughType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
858 &self,
859 glyph_range: NSRange,
860 strikethrough_val: NSUnderlineStyle,
861 line_rect: NSRect,
862 line_glyph_range: NSRange,
863 container_origin: NSPoint,
864 );
865
866 #[cfg(feature = "NSCell")]
867 #[unsafe(method(showAttachmentCell:inRect:characterIndex:))]
868 #[unsafe(method_family = none)]
869 pub unsafe fn showAttachmentCell_inRect_characterIndex(
870 &self,
871 cell: &NSCell,
872 rect: NSRect,
873 attachment_index: NSUInteger,
874 );
875
876 #[cfg(feature = "NSTextTable")]
877 #[unsafe(method(setLayoutRect:forTextBlock:glyphRange:))]
879 #[unsafe(method_family = none)]
880 pub unsafe fn setLayoutRect_forTextBlock_glyphRange(
881 &self,
882 rect: NSRect,
883 block: &NSTextBlock,
884 glyph_range: NSRange,
885 );
886
887 #[cfg(feature = "NSTextTable")]
888 #[unsafe(method(setBoundsRect:forTextBlock:glyphRange:))]
889 #[unsafe(method_family = none)]
890 pub unsafe fn setBoundsRect_forTextBlock_glyphRange(
891 &self,
892 rect: NSRect,
893 block: &NSTextBlock,
894 glyph_range: NSRange,
895 );
896
897 #[cfg(feature = "NSTextTable")]
898 #[unsafe(method(layoutRectForTextBlock:glyphRange:))]
899 #[unsafe(method_family = none)]
900 pub unsafe fn layoutRectForTextBlock_glyphRange(
901 &self,
902 block: &NSTextBlock,
903 glyph_range: NSRange,
904 ) -> NSRect;
905
906 #[cfg(feature = "NSTextTable")]
907 #[unsafe(method(boundsRectForTextBlock:glyphRange:))]
908 #[unsafe(method_family = none)]
909 pub unsafe fn boundsRectForTextBlock_glyphRange(
910 &self,
911 block: &NSTextBlock,
912 glyph_range: NSRange,
913 ) -> NSRect;
914
915 #[cfg(feature = "NSTextTable")]
916 #[unsafe(method(layoutRectForTextBlock:atIndex:effectiveRange:))]
917 #[unsafe(method_family = none)]
918 pub unsafe fn layoutRectForTextBlock_atIndex_effectiveRange(
919 &self,
920 block: &NSTextBlock,
921 glyph_index: NSUInteger,
922 effective_glyph_range: NSRangePointer,
923 ) -> NSRect;
924
925 #[cfg(feature = "NSTextTable")]
926 #[unsafe(method(boundsRectForTextBlock:atIndex:effectiveRange:))]
927 #[unsafe(method_family = none)]
928 pub unsafe fn boundsRectForTextBlock_atIndex_effectiveRange(
929 &self,
930 block: &NSTextBlock,
931 glyph_index: NSUInteger,
932 effective_glyph_range: NSRangePointer,
933 ) -> NSRect;
934
935 #[unsafe(method(temporaryAttributesAtCharacterIndex:effectiveRange:))]
937 #[unsafe(method_family = none)]
938 pub unsafe fn temporaryAttributesAtCharacterIndex_effectiveRange(
939 &self,
940 char_index: NSUInteger,
941 effective_char_range: NSRangePointer,
942 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
943
944 #[unsafe(method(setTemporaryAttributes:forCharacterRange:))]
945 #[unsafe(method_family = none)]
946 pub unsafe fn setTemporaryAttributes_forCharacterRange(
947 &self,
948 attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
949 char_range: NSRange,
950 );
951
952 #[unsafe(method(addTemporaryAttributes:forCharacterRange:))]
953 #[unsafe(method_family = none)]
954 pub unsafe fn addTemporaryAttributes_forCharacterRange(
955 &self,
956 attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
957 char_range: NSRange,
958 );
959
960 #[unsafe(method(removeTemporaryAttribute:forCharacterRange:))]
961 #[unsafe(method_family = none)]
962 pub unsafe fn removeTemporaryAttribute_forCharacterRange(
963 &self,
964 attr_name: &NSAttributedStringKey,
965 char_range: NSRange,
966 );
967
968 #[unsafe(method(temporaryAttribute:atCharacterIndex:effectiveRange:))]
969 #[unsafe(method_family = none)]
970 pub unsafe fn temporaryAttribute_atCharacterIndex_effectiveRange(
971 &self,
972 attr_name: &NSAttributedStringKey,
973 location: NSUInteger,
974 range: NSRangePointer,
975 ) -> Option<Retained<AnyObject>>;
976
977 #[unsafe(method(temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:))]
978 #[unsafe(method_family = none)]
979 pub unsafe fn temporaryAttribute_atCharacterIndex_longestEffectiveRange_inRange(
980 &self,
981 attr_name: &NSAttributedStringKey,
982 location: NSUInteger,
983 range: NSRangePointer,
984 range_limit: NSRange,
985 ) -> Option<Retained<AnyObject>>;
986
987 #[unsafe(method(temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:))]
988 #[unsafe(method_family = none)]
989 pub unsafe fn temporaryAttributesAtCharacterIndex_longestEffectiveRange_inRange(
990 &self,
991 location: NSUInteger,
992 range: NSRangePointer,
993 range_limit: NSRange,
994 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
995
996 #[unsafe(method(addTemporaryAttribute:value:forCharacterRange:))]
997 #[unsafe(method_family = none)]
998 pub unsafe fn addTemporaryAttribute_value_forCharacterRange(
999 &self,
1000 attr_name: &NSAttributedStringKey,
1001 value: &AnyObject,
1002 char_range: NSRange,
1003 );
1004
1005 #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
1006 #[unsafe(method(defaultLineHeightForFont:))]
1008 #[unsafe(method_family = none)]
1009 pub unsafe fn defaultLineHeightForFont(&self, the_font: &NSFont) -> CGFloat;
1010
1011 #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
1012 #[unsafe(method(defaultBaselineOffsetForFont:))]
1013 #[unsafe(method_family = none)]
1014 pub unsafe fn defaultBaselineOffsetForFont(&self, the_font: &NSFont) -> CGFloat;
1015 );
1016}
1017
1018impl NSLayoutManager {
1020 extern_methods!(
1021 #[unsafe(method(new))]
1022 #[unsafe(method_family = new)]
1023 pub unsafe fn new() -> Retained<Self>;
1024 );
1025}
1026
1027impl NSLayoutManager {
1029 extern_methods!(
1030 #[cfg(all(
1031 feature = "NSParagraphStyle",
1032 feature = "NSResponder",
1033 feature = "NSRulerMarker",
1034 feature = "NSRulerView",
1035 feature = "NSText",
1036 feature = "NSTextView",
1037 feature = "NSView"
1038 ))]
1039 #[unsafe(method(rulerMarkersForTextView:paragraphStyle:ruler:))]
1041 #[unsafe(method_family = none)]
1042 pub unsafe fn rulerMarkersForTextView_paragraphStyle_ruler(
1043 &self,
1044 view: &NSTextView,
1045 style: &NSParagraphStyle,
1046 ruler: &NSRulerView,
1047 ) -> Retained<NSArray<NSRulerMarker>>;
1048
1049 #[cfg(all(
1050 feature = "NSParagraphStyle",
1051 feature = "NSResponder",
1052 feature = "NSRulerView",
1053 feature = "NSText",
1054 feature = "NSTextView",
1055 feature = "NSView"
1056 ))]
1057 #[unsafe(method(rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:))]
1058 #[unsafe(method_family = none)]
1059 pub unsafe fn rulerAccessoryViewForTextView_paragraphStyle_ruler_enabled(
1060 &self,
1061 view: &NSTextView,
1062 style: &NSParagraphStyle,
1063 ruler: &NSRulerView,
1064 is_enabled: bool,
1065 ) -> Option<Retained<NSView>>;
1066
1067 #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
1068 #[unsafe(method(layoutManagerOwnsFirstResponderInWindow:))]
1070 #[unsafe(method_family = none)]
1071 pub unsafe fn layoutManagerOwnsFirstResponderInWindow(&self, window: &NSWindow) -> bool;
1072
1073 #[cfg(all(
1074 feature = "NSResponder",
1075 feature = "NSText",
1076 feature = "NSTextView",
1077 feature = "NSView"
1078 ))]
1079 #[unsafe(method(firstTextView))]
1080 #[unsafe(method_family = none)]
1081 pub unsafe fn firstTextView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;
1082
1083 #[cfg(all(
1084 feature = "NSResponder",
1085 feature = "NSText",
1086 feature = "NSTextView",
1087 feature = "NSView"
1088 ))]
1089 #[unsafe(method(textViewForBeginningOfSelection))]
1090 #[unsafe(method_family = none)]
1091 pub unsafe fn textViewForBeginningOfSelection(
1092 &self,
1093 mtm: MainThreadMarker,
1094 ) -> Option<Retained<NSTextView>>;
1095 );
1096}
1097
1098extern_protocol!(
1099 pub unsafe trait NSLayoutManagerDelegate: NSObjectProtocol {
1101 #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
1102 #[cfg(target_vendor = "apple")]
1103 #[optional]
1105 #[unsafe(method(layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:))]
1106 #[unsafe(method_family = none)]
1107 unsafe fn layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange(
1108 &self,
1109 layout_manager: &NSLayoutManager,
1110 glyphs: NonNull<CGGlyph>,
1111 props: NonNull<NSGlyphProperty>,
1112 char_indexes: NonNull<NSUInteger>,
1113 a_font: &NSFont,
1114 glyph_range: NSRange,
1115 ) -> NSUInteger;
1116
1117 #[cfg(feature = "objc2-core-foundation")]
1118 #[optional]
1120 #[unsafe(method(layoutManager:lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
1121 #[unsafe(method_family = none)]
1122 unsafe fn layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
1123 &self,
1124 layout_manager: &NSLayoutManager,
1125 glyph_index: NSUInteger,
1126 rect: NSRect,
1127 ) -> CGFloat;
1128
1129 #[cfg(feature = "objc2-core-foundation")]
1130 #[optional]
1131 #[unsafe(method(layoutManager:paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:))]
1132 #[unsafe(method_family = none)]
1133 unsafe fn layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
1134 &self,
1135 layout_manager: &NSLayoutManager,
1136 glyph_index: NSUInteger,
1137 rect: NSRect,
1138 ) -> CGFloat;
1139
1140 #[cfg(feature = "objc2-core-foundation")]
1141 #[optional]
1142 #[unsafe(method(layoutManager:paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
1143 #[unsafe(method_family = none)]
1144 unsafe fn layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
1145 &self,
1146 layout_manager: &NSLayoutManager,
1147 glyph_index: NSUInteger,
1148 rect: NSRect,
1149 ) -> CGFloat;
1150
1151 #[optional]
1152 #[unsafe(method(layoutManager:shouldUseAction:forControlCharacterAtIndex:))]
1153 #[unsafe(method_family = none)]
1154 unsafe fn layoutManager_shouldUseAction_forControlCharacterAtIndex(
1155 &self,
1156 layout_manager: &NSLayoutManager,
1157 action: NSControlCharacterAction,
1158 char_index: NSUInteger,
1159 ) -> NSControlCharacterAction;
1160
1161 #[optional]
1162 #[unsafe(method(layoutManager:shouldBreakLineByWordBeforeCharacterAtIndex:))]
1163 #[unsafe(method_family = none)]
1164 unsafe fn layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex(
1165 &self,
1166 layout_manager: &NSLayoutManager,
1167 char_index: NSUInteger,
1168 ) -> bool;
1169
1170 #[optional]
1171 #[unsafe(method(layoutManager:shouldBreakLineByHyphenatingBeforeCharacterAtIndex:))]
1172 #[unsafe(method_family = none)]
1173 unsafe fn layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
1174 &self,
1175 layout_manager: &NSLayoutManager,
1176 char_index: NSUInteger,
1177 ) -> bool;
1178
1179 #[cfg(feature = "NSTextContainer")]
1180 #[optional]
1181 #[unsafe(method(layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
1182 #[unsafe(method_family = none)]
1183 unsafe fn layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
1184 &self,
1185 layout_manager: &NSLayoutManager,
1186 glyph_index: NSUInteger,
1187 text_container: &NSTextContainer,
1188 proposed_rect: NSRect,
1189 glyph_position: NSPoint,
1190 char_index: NSUInteger,
1191 ) -> NSRect;
1192
1193 #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
1194 #[optional]
1195 #[unsafe(method(layoutManager:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:inTextContainer:forGlyphRange:))]
1196 #[unsafe(method_family = none)]
1197 unsafe fn layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange(
1198 &self,
1199 layout_manager: &NSLayoutManager,
1200 line_fragment_rect: NonNull<NSRect>,
1201 line_fragment_used_rect: NonNull<NSRect>,
1202 baseline_offset: NonNull<CGFloat>,
1203 text_container: &NSTextContainer,
1204 glyph_range: NSRange,
1205 ) -> bool;
1206
1207 #[optional]
1209 #[unsafe(method(layoutManagerDidInvalidateLayout:))]
1210 #[unsafe(method_family = none)]
1211 unsafe fn layoutManagerDidInvalidateLayout(&self, sender: &NSLayoutManager);
1212
1213 #[cfg(feature = "NSTextContainer")]
1214 #[optional]
1215 #[unsafe(method(layoutManager:didCompleteLayoutForTextContainer:atEnd:))]
1216 #[unsafe(method_family = none)]
1217 unsafe fn layoutManager_didCompleteLayoutForTextContainer_atEnd(
1218 &self,
1219 layout_manager: &NSLayoutManager,
1220 text_container: Option<&NSTextContainer>,
1221 layout_finished_flag: bool,
1222 );
1223
1224 #[cfg(feature = "NSTextContainer")]
1225 #[optional]
1226 #[unsafe(method(layoutManager:textContainer:didChangeGeometryFromSize:))]
1227 #[unsafe(method_family = none)]
1228 unsafe fn layoutManager_textContainer_didChangeGeometryFromSize(
1229 &self,
1230 layout_manager: &NSLayoutManager,
1231 text_container: &NSTextContainer,
1232 old_size: NSSize,
1233 );
1234
1235 #[optional]
1236 #[unsafe(method(layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:))]
1237 #[unsafe(method_family = none)]
1238 unsafe fn layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange(
1239 &self,
1240 layout_manager: &NSLayoutManager,
1241 attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
1242 to_screen: bool,
1243 char_index: NSUInteger,
1244 effective_char_range: NSRangePointer,
1245 ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
1246 }
1247);
1248
1249#[deprecated]
1251pub const NSGlyphAttributeSoft: c_uint = 0;
1252#[deprecated]
1254pub const NSGlyphAttributeElastic: c_uint = 1;
1255#[deprecated]
1257pub const NSGlyphAttributeBidiLevel: c_uint = 2;
1258#[deprecated]
1260pub const NSGlyphAttributeInscribe: c_uint = 5;
1261
1262#[deprecated = "Use NSGlyphProperty instead"]
1265#[repr(transparent)]
1266#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1267pub struct NSGlyphInscription(pub NSUInteger);
1268impl NSGlyphInscription {
1269 #[doc(alias = "NSGlyphInscribeBase")]
1270 #[deprecated]
1271 pub const InscribeBase: Self = Self(0);
1272 #[doc(alias = "NSGlyphInscribeBelow")]
1273 #[deprecated]
1274 pub const InscribeBelow: Self = Self(1);
1275 #[doc(alias = "NSGlyphInscribeAbove")]
1276 #[deprecated]
1277 pub const InscribeAbove: Self = Self(2);
1278 #[doc(alias = "NSGlyphInscribeOverstrike")]
1279 #[deprecated]
1280 pub const InscribeOverstrike: Self = Self(3);
1281 #[doc(alias = "NSGlyphInscribeOverBelow")]
1282 #[deprecated]
1283 pub const InscribeOverBelow: Self = Self(4);
1284}
1285
1286unsafe impl Encode for NSGlyphInscription {
1287 const ENCODING: Encoding = NSUInteger::ENCODING;
1288}
1289
1290unsafe impl RefEncode for NSGlyphInscription {
1291 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1292}
1293
1294impl NSLayoutManager {
1296 extern_methods!(
1297 #[cfg(feature = "NSFont")]
1298 #[unsafe(method(glyphAtIndex:isValidIndex:))]
1299 #[unsafe(method_family = none)]
1300 pub unsafe fn glyphAtIndex_isValidIndex(
1301 &self,
1302 glyph_index: NSUInteger,
1303 is_valid_index: *mut Bool,
1304 ) -> NSGlyph;
1305
1306 #[cfg(feature = "NSFont")]
1307 #[unsafe(method(glyphAtIndex:))]
1308 #[unsafe(method_family = none)]
1309 pub unsafe fn glyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyph;
1310
1311 #[cfg(feature = "NSTextContainer")]
1312 #[unsafe(method(rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:))]
1313 #[unsafe(method_family = none)]
1314 pub unsafe fn rectArrayForCharacterRange_withinSelectedCharacterRange_inTextContainer_rectCount(
1315 &self,
1316 char_range: NSRange,
1317 sel_char_range: NSRange,
1318 container: &NSTextContainer,
1319 rect_count: NonNull<NSUInteger>,
1320 ) -> NSRectArray;
1321
1322 #[cfg(feature = "NSTextContainer")]
1323 #[unsafe(method(rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:))]
1324 #[unsafe(method_family = none)]
1325 pub unsafe fn rectArrayForGlyphRange_withinSelectedGlyphRange_inTextContainer_rectCount(
1326 &self,
1327 glyph_range: NSRange,
1328 sel_glyph_range: NSRange,
1329 container: &NSTextContainer,
1330 rect_count: NonNull<NSUInteger>,
1331 ) -> NSRectArray;
1332
1333 #[deprecated]
1334 #[unsafe(method(usesScreenFonts))]
1335 #[unsafe(method_family = none)]
1336 pub unsafe fn usesScreenFonts(&self) -> bool;
1337
1338 #[deprecated]
1340 #[unsafe(method(setUsesScreenFonts:))]
1341 #[unsafe(method_family = none)]
1342 pub unsafe fn setUsesScreenFonts(&self, uses_screen_fonts: bool);
1343
1344 #[cfg(feature = "NSFont")]
1345 #[deprecated]
1346 #[unsafe(method(substituteFontForFont:))]
1347 #[unsafe(method_family = none)]
1348 pub unsafe fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
1349
1350 #[cfg(feature = "NSFont")]
1351 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1352 #[unsafe(method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:))]
1353 #[unsafe(method_family = none)]
1354 pub unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
1355 &self,
1356 glyphs: NonNull<NSGlyph>,
1357 length: NSUInteger,
1358 glyph_index: NSUInteger,
1359 char_index: NSUInteger,
1360 );
1361
1362 #[cfg(feature = "NSFont")]
1363 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1364 #[unsafe(method(insertGlyph:atGlyphIndex:characterIndex:))]
1365 #[unsafe(method_family = none)]
1366 pub unsafe fn insertGlyph_atGlyphIndex_characterIndex(
1367 &self,
1368 glyph: NSGlyph,
1369 glyph_index: NSUInteger,
1370 char_index: NSUInteger,
1371 );
1372
1373 #[cfg(feature = "NSFont")]
1374 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1375 #[unsafe(method(replaceGlyphAtIndex:withGlyph:))]
1376 #[unsafe(method_family = none)]
1377 pub unsafe fn replaceGlyphAtIndex_withGlyph(
1378 &self,
1379 glyph_index: NSUInteger,
1380 new_glyph: NSGlyph,
1381 );
1382
1383 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1384 #[unsafe(method(deleteGlyphsInRange:))]
1385 #[unsafe(method_family = none)]
1386 pub unsafe fn deleteGlyphsInRange(&self, glyph_range: NSRange);
1387
1388 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1389 #[unsafe(method(setCharacterIndex:forGlyphAtIndex:))]
1390 #[unsafe(method_family = none)]
1391 pub unsafe fn setCharacterIndex_forGlyphAtIndex(
1392 &self,
1393 char_index: NSUInteger,
1394 glyph_index: NSUInteger,
1395 );
1396
1397 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1398 #[unsafe(method(setIntAttribute:value:forGlyphAtIndex:))]
1399 #[unsafe(method_family = none)]
1400 pub unsafe fn setIntAttribute_value_forGlyphAtIndex(
1401 &self,
1402 attribute_tag: NSInteger,
1403 val: NSInteger,
1404 glyph_index: NSUInteger,
1405 );
1406
1407 #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1408 #[unsafe(method(invalidateGlyphsOnLayoutInvalidationForGlyphRange:))]
1409 #[unsafe(method_family = none)]
1410 pub unsafe fn invalidateGlyphsOnLayoutInvalidationForGlyphRange(
1411 &self,
1412 glyph_range: NSRange,
1413 );
1414
1415 #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1416 #[unsafe(method(intAttribute:forGlyphAtIndex:))]
1417 #[unsafe(method_family = none)]
1418 pub unsafe fn intAttribute_forGlyphAtIndex(
1419 &self,
1420 attribute_tag: NSInteger,
1421 glyph_index: NSUInteger,
1422 ) -> NSInteger;
1423
1424 #[cfg(feature = "NSFont")]
1425 #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1426 #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:))]
1427 #[unsafe(method_family = none)]
1428 pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
1429 &self,
1430 glyph_range: NSRange,
1431 glyph_buffer: *mut NSGlyph,
1432 char_index_buffer: *mut NSUInteger,
1433 inscribe_buffer: *mut NSGlyphInscription,
1434 elastic_buffer: *mut Bool,
1435 ) -> NSUInteger;
1436
1437 #[cfg(feature = "NSFont")]
1438 #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1439 #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:))]
1440 #[unsafe(method_family = none)]
1441 pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_bidiLevels(
1442 &self,
1443 glyph_range: NSRange,
1444 glyph_buffer: *mut NSGlyph,
1445 char_index_buffer: *mut NSUInteger,
1446 inscribe_buffer: *mut NSGlyphInscription,
1447 elastic_buffer: *mut Bool,
1448 bidi_level_buffer: *mut c_uchar,
1449 ) -> NSUInteger;
1450
1451 #[cfg(feature = "NSFont")]
1452 #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1453 #[unsafe(method(getGlyphs:range:))]
1454 #[unsafe(method_family = none)]
1455 pub unsafe fn getGlyphs_range(
1456 &self,
1457 glyph_array: *mut NSGlyph,
1458 glyph_range: NSRange,
1459 ) -> NSUInteger;
1460
1461 #[deprecated = "Use -invalidateLayoutForCharacterRange:actualCharacterRange: instead"]
1462 #[unsafe(method(invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:))]
1463 #[unsafe(method_family = none)]
1464 pub unsafe fn invalidateLayoutForCharacterRange_isSoft_actualCharacterRange(
1465 &self,
1466 char_range: NSRange,
1467 flag: bool,
1468 actual_char_range: NSRangePointer,
1469 );
1470
1471 #[cfg(feature = "NSTextStorage")]
1472 #[deprecated = "Use -processEditingForTextStorage:edited:range:changeInLength:invalidatedRange: instead"]
1473 #[unsafe(method(textStorage:edited:range:changeInLength:invalidatedRange:))]
1474 #[unsafe(method_family = none)]
1475 pub unsafe fn textStorage_edited_range_changeInLength_invalidatedRange(
1476 &self,
1477 str: &NSTextStorage,
1478 edited_mask: NSTextStorageEditedOptions,
1479 new_char_range: NSRange,
1480 delta: NSInteger,
1481 invalidated_char_range: NSRange,
1482 );
1483
1484 #[deprecated = "Use -setLocation:forStartOfGlyphRange: instead"]
1485 #[unsafe(method(setLocations:startingGlyphIndexes:count:forGlyphRange:))]
1486 #[unsafe(method_family = none)]
1487 pub unsafe fn setLocations_startingGlyphIndexes_count_forGlyphRange(
1488 &self,
1489 locations: NSPointArray,
1490 glyph_indexes: NonNull<NSUInteger>,
1491 count: NSUInteger,
1492 glyph_range: NSRange,
1493 );
1494
1495 #[cfg(all(feature = "NSColor", feature = "NSFont"))]
1496 #[deprecated = "Use -showCGGlyphs:positions:count:font:matrix:attributes:inContext: instead"]
1497 #[unsafe(method(showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:))]
1498 #[unsafe(method_family = none)]
1499 pub unsafe fn showPackedGlyphs_length_glyphRange_atPoint_font_color_printingAdjustment(
1500 &self,
1501 glyphs: NonNull<c_char>,
1502 glyph_len: NSUInteger,
1503 glyph_range: NSRange,
1504 point: NSPoint,
1505 font: &NSFont,
1506 color: &NSColor,
1507 printing_adjustment: NSSize,
1508 );
1509
1510 #[cfg(all(
1511 feature = "NSFont",
1512 feature = "NSGraphicsContext",
1513 feature = "objc2-core-graphics"
1514 ))]
1515 #[cfg(target_vendor = "apple")]
1516 #[deprecated]
1517 #[unsafe(method(showCGGlyphs:positions:count:font:matrix:attributes:inContext:))]
1518 #[unsafe(method_family = none)]
1519 pub unsafe fn showCGGlyphs_positions_count_font_matrix_attributes_inContext(
1520 &self,
1521 glyphs: NonNull<CGGlyph>,
1522 positions: NonNull<NSPoint>,
1523 glyph_count: NSUInteger,
1524 font: &NSFont,
1525 text_matrix: &NSAffineTransform,
1526 attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
1527 graphics_context: &NSGraphicsContext,
1528 );
1529
1530 #[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
1531 #[unsafe(method(hyphenationFactor))]
1532 #[unsafe(method_family = none)]
1533 pub unsafe fn hyphenationFactor(&self) -> c_float;
1534
1535 #[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
1537 #[unsafe(method(setHyphenationFactor:))]
1538 #[unsafe(method_family = none)]
1539 pub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float);
1540 );
1541}
1542
1543impl NSLayoutManager {
1545 extern_methods!(
1546 #[cfg(feature = "NSGlyphGenerator")]
1547 #[unsafe(method(glyphGenerator))]
1548 #[unsafe(method_family = none)]
1549 pub unsafe fn glyphGenerator(&self) -> Retained<NSGlyphGenerator>;
1550
1551 #[cfg(feature = "NSGlyphGenerator")]
1552 #[unsafe(method(setGlyphGenerator:))]
1554 #[unsafe(method_family = none)]
1555 pub unsafe fn setGlyphGenerator(&self, glyph_generator: &NSGlyphGenerator);
1556 );
1557}
1558
1559#[cfg(feature = "NSGlyphGenerator")]
1560extern_conformance!(
1561 unsafe impl NSGlyphStorage for NSLayoutManager {}
1562);