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