#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextLayoutOrientation(pub NSInteger);
impl NSTextLayoutOrientation {
#[doc(alias = "NSTextLayoutOrientationHorizontal")]
pub const Horizontal: Self = Self(0);
#[doc(alias = "NSTextLayoutOrientationVertical")]
pub const Vertical: Self = Self(1);
}
unsafe impl Encode for NSTextLayoutOrientation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTextLayoutOrientation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGlyphProperty(pub NSInteger);
impl NSGlyphProperty {
#[doc(alias = "NSGlyphPropertyNull")]
pub const Null: Self = Self(1 << 0);
#[doc(alias = "NSGlyphPropertyControlCharacter")]
pub const ControlCharacter: Self = Self(1 << 1);
#[doc(alias = "NSGlyphPropertyElastic")]
pub const Elastic: Self = Self(1 << 2);
#[doc(alias = "NSGlyphPropertyNonBaseCharacter")]
pub const NonBaseCharacter: Self = Self(1 << 3);
}
unsafe impl Encode for NSGlyphProperty {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGlyphProperty {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSControlCharacterAction(pub NSInteger);
impl NSControlCharacterAction {
#[doc(alias = "NSControlCharacterActionZeroAdvancement")]
pub const ZeroAdvancement: Self = Self(1 << 0);
#[doc(alias = "NSControlCharacterActionWhitespace")]
pub const Whitespace: Self = Self(1 << 1);
#[doc(alias = "NSControlCharacterActionHorizontalTab")]
pub const HorizontalTab: Self = Self(1 << 2);
#[doc(alias = "NSControlCharacterActionLineBreak")]
pub const LineBreak: Self = Self(1 << 3);
#[doc(alias = "NSControlCharacterActionParagraphBreak")]
pub const ParagraphBreak: Self = Self(1 << 4);
#[doc(alias = "NSControlCharacterActionContainerBreak")]
pub const ContainerBreak: Self = Self(1 << 5);
}
unsafe impl Encode for NSControlCharacterAction {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSControlCharacterAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSTextLayoutOrientationProvider {
#[method(layoutOrientation)]
unsafe fn layoutOrientation(&self) -> NSTextLayoutOrientation;
}
unsafe impl ProtocolType for dyn NSTextLayoutOrientationProvider {}
);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTypesetterBehavior(pub NSInteger);
impl NSTypesetterBehavior {
pub const NSTypesetterLatestBehavior: Self = Self(-1);
pub const NSTypesetterOriginalBehavior: Self = Self(0);
#[doc(alias = "NSTypesetterBehavior_10_2_WithCompatibility")]
pub const _10_2_WithCompatibility: Self = Self(1);
#[doc(alias = "NSTypesetterBehavior_10_2")]
pub const _10_2: Self = Self(2);
#[doc(alias = "NSTypesetterBehavior_10_3")]
pub const _10_3: Self = Self(3);
#[doc(alias = "NSTypesetterBehavior_10_4")]
pub const _10_4: Self = Self(4);
}
unsafe impl Encode for NSTypesetterBehavior {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTypesetterBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSLayoutManager;
unsafe impl ClassType for NSLayoutManager {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSLayoutManager {}
unsafe impl NSObjectProtocol for NSLayoutManager {}
unsafe impl NSSecureCoding for NSLayoutManager {}
extern_methods!(
unsafe impl NSLayoutManager {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
#[cfg(feature = "NSTextStorage")]
#[method_id(@__retain_semantics Other textStorage)]
pub unsafe fn textStorage(&self) -> Option<Id<NSTextStorage>>;
#[cfg(feature = "NSTextStorage")]
#[method(setTextStorage:)]
pub unsafe fn setTextStorage(&self, text_storage: Option<&NSTextStorage>);
#[cfg(feature = "NSTextStorage")]
#[method(replaceTextStorage:)]
pub unsafe fn replaceTextStorage(&self, new_text_storage: &NSTextStorage);
#[cfg(feature = "NSTextContainer")]
#[method_id(@__retain_semantics Other textContainers)]
pub unsafe fn textContainers(&self) -> Id<NSArray<NSTextContainer>>;
#[cfg(feature = "NSTextContainer")]
#[method(addTextContainer:)]
pub unsafe fn addTextContainer(&self, container: &NSTextContainer);
#[cfg(feature = "NSTextContainer")]
#[method(insertTextContainer:atIndex:)]
pub unsafe fn insertTextContainer_atIndex(
&self,
container: &NSTextContainer,
index: NSUInteger,
);
#[method(removeTextContainerAtIndex:)]
pub unsafe fn removeTextContainerAtIndex(&self, index: NSUInteger);
#[cfg(feature = "NSTextContainer")]
#[method(textContainerChangedGeometry:)]
pub unsafe fn textContainerChangedGeometry(&self, container: &NSTextContainer);
#[cfg(feature = "NSTextContainer")]
#[method(textContainerChangedTextView:)]
pub unsafe fn textContainerChangedTextView(&self, container: &NSTextContainer);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSLayoutManagerDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSLayoutManagerDelegate>>,
);
#[method(showsInvisibleCharacters)]
pub unsafe fn showsInvisibleCharacters(&self) -> bool;
#[method(setShowsInvisibleCharacters:)]
pub unsafe fn setShowsInvisibleCharacters(&self, shows_invisible_characters: bool);
#[method(showsControlCharacters)]
pub unsafe fn showsControlCharacters(&self) -> bool;
#[method(setShowsControlCharacters:)]
pub unsafe fn setShowsControlCharacters(&self, shows_control_characters: bool);
#[method(usesDefaultHyphenation)]
pub unsafe fn usesDefaultHyphenation(&self) -> bool;
#[method(setUsesDefaultHyphenation:)]
pub unsafe fn setUsesDefaultHyphenation(&self, uses_default_hyphenation: bool);
#[method(usesFontLeading)]
pub unsafe fn usesFontLeading(&self) -> bool;
#[method(setUsesFontLeading:)]
pub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool);
#[method(allowsNonContiguousLayout)]
pub unsafe fn allowsNonContiguousLayout(&self) -> bool;
#[method(setAllowsNonContiguousLayout:)]
pub unsafe fn setAllowsNonContiguousLayout(&self, allows_non_contiguous_layout: bool);
#[method(hasNonContiguousLayout)]
pub unsafe fn hasNonContiguousLayout(&self) -> bool;
#[method(limitsLayoutForSuspiciousContents)]
pub unsafe fn limitsLayoutForSuspiciousContents(&self) -> bool;
#[method(setLimitsLayoutForSuspiciousContents:)]
pub unsafe fn setLimitsLayoutForSuspiciousContents(
&self,
limits_layout_for_suspicious_contents: bool,
);
#[method(backgroundLayoutEnabled)]
pub unsafe fn backgroundLayoutEnabled(&self) -> bool;
#[method(setBackgroundLayoutEnabled:)]
pub unsafe fn setBackgroundLayoutEnabled(&self, background_layout_enabled: bool);
#[cfg(feature = "NSCell")]
#[method(defaultAttachmentScaling)]
pub unsafe fn defaultAttachmentScaling(&self) -> NSImageScaling;
#[cfg(feature = "NSCell")]
#[method(setDefaultAttachmentScaling:)]
pub unsafe fn setDefaultAttachmentScaling(
&self,
default_attachment_scaling: NSImageScaling,
);
#[cfg(feature = "NSTypesetter")]
#[method_id(@__retain_semantics Other typesetter)]
pub unsafe fn typesetter(&self) -> Id<NSTypesetter>;
#[cfg(feature = "NSTypesetter")]
#[method(setTypesetter:)]
pub unsafe fn setTypesetter(&self, typesetter: &NSTypesetter);
#[method(typesetterBehavior)]
pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior;
#[method(setTypesetterBehavior:)]
pub unsafe fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
#[method(invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:)]
pub unsafe fn invalidateGlyphsForCharacterRange_changeInLength_actualCharacterRange(
&self,
char_range: NSRange,
delta: NSInteger,
actual_char_range: NSRangePointer,
);
#[method(invalidateLayoutForCharacterRange:actualCharacterRange:)]
pub unsafe fn invalidateLayoutForCharacterRange_actualCharacterRange(
&self,
char_range: NSRange,
actual_char_range: NSRangePointer,
);
#[method(invalidateDisplayForCharacterRange:)]
pub unsafe fn invalidateDisplayForCharacterRange(&self, char_range: NSRange);
#[method(invalidateDisplayForGlyphRange:)]
pub unsafe fn invalidateDisplayForGlyphRange(&self, glyph_range: NSRange);
#[cfg(feature = "NSTextStorage")]
#[method(processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:)]
pub unsafe fn processEditingForTextStorage_edited_range_changeInLength_invalidatedRange(
&self,
text_storage: &NSTextStorage,
edit_mask: NSTextStorageEditActions,
new_char_range: NSRange,
delta: NSInteger,
invalidated_char_range: NSRange,
);
#[method(ensureGlyphsForCharacterRange:)]
pub unsafe fn ensureGlyphsForCharacterRange(&self, char_range: NSRange);
#[method(ensureGlyphsForGlyphRange:)]
pub unsafe fn ensureGlyphsForGlyphRange(&self, glyph_range: NSRange);
#[method(ensureLayoutForCharacterRange:)]
pub unsafe fn ensureLayoutForCharacterRange(&self, char_range: NSRange);
#[method(ensureLayoutForGlyphRange:)]
pub unsafe fn ensureLayoutForGlyphRange(&self, glyph_range: NSRange);
#[cfg(feature = "NSTextContainer")]
#[method(ensureLayoutForTextContainer:)]
pub unsafe fn ensureLayoutForTextContainer(&self, container: &NSTextContainer);
#[cfg(feature = "NSTextContainer")]
#[method(ensureLayoutForBoundingRect:inTextContainer:)]
pub unsafe fn ensureLayoutForBoundingRect_inTextContainer(
&self,
bounds: NSRect,
container: &NSTextContainer,
);
#[method(numberOfGlyphs)]
pub unsafe fn numberOfGlyphs(&self) -> NSUInteger;
#[method(isValidGlyphIndex:)]
pub unsafe fn isValidGlyphIndex(&self, glyph_index: NSUInteger) -> bool;
#[method(propertyForGlyphAtIndex:)]
pub unsafe fn propertyForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyphProperty;
#[method(characterIndexForGlyphAtIndex:)]
pub unsafe fn characterIndexForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSUInteger;
#[method(glyphIndexForCharacterAtIndex:)]
pub unsafe fn glyphIndexForCharacterAtIndex(&self, char_index: NSUInteger) -> NSUInteger;
#[cfg(feature = "NSTextContainer")]
#[method(setTextContainer:forGlyphRange:)]
pub unsafe fn setTextContainer_forGlyphRange(
&self,
container: &NSTextContainer,
glyph_range: NSRange,
);
#[method(setLineFragmentRect:forGlyphRange:usedRect:)]
pub unsafe fn setLineFragmentRect_forGlyphRange_usedRect(
&self,
fragment_rect: NSRect,
glyph_range: NSRange,
used_rect: NSRect,
);
#[cfg(feature = "NSTextContainer")]
#[method(setExtraLineFragmentRect:usedRect:textContainer:)]
pub unsafe fn setExtraLineFragmentRect_usedRect_textContainer(
&self,
fragment_rect: NSRect,
used_rect: NSRect,
container: &NSTextContainer,
);
#[method(setLocation:forStartOfGlyphRange:)]
pub unsafe fn setLocation_forStartOfGlyphRange(
&self,
location: NSPoint,
glyph_range: NSRange,
);
#[method(setNotShownAttribute:forGlyphAtIndex:)]
pub unsafe fn setNotShownAttribute_forGlyphAtIndex(
&self,
flag: bool,
glyph_index: NSUInteger,
);
#[method(setDrawsOutsideLineFragment:forGlyphAtIndex:)]
pub unsafe fn setDrawsOutsideLineFragment_forGlyphAtIndex(
&self,
flag: bool,
glyph_index: NSUInteger,
);
#[method(setAttachmentSize:forGlyphRange:)]
pub unsafe fn setAttachmentSize_forGlyphRange(
&self,
attachment_size: NSSize,
glyph_range: NSRange,
);
#[method(getFirstUnlaidCharacterIndex:glyphIndex:)]
pub unsafe fn getFirstUnlaidCharacterIndex_glyphIndex(
&self,
char_index: *mut NSUInteger,
glyph_index: *mut NSUInteger,
);
#[method(firstUnlaidCharacterIndex)]
pub unsafe fn firstUnlaidCharacterIndex(&self) -> NSUInteger;
#[method(firstUnlaidGlyphIndex)]
pub unsafe fn firstUnlaidGlyphIndex(&self) -> NSUInteger;
#[cfg(feature = "NSTextContainer")]
#[method_id(@__retain_semantics Other textContainerForGlyphAtIndex:effectiveRange:)]
pub unsafe fn textContainerForGlyphAtIndex_effectiveRange(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
) -> Option<Id<NSTextContainer>>;
#[cfg(feature = "NSTextContainer")]
#[method_id(@__retain_semantics Other textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:)]
pub unsafe fn textContainerForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
flag: bool,
) -> Option<Id<NSTextContainer>>;
#[cfg(feature = "NSTextContainer")]
#[method(usedRectForTextContainer:)]
pub unsafe fn usedRectForTextContainer(&self, container: &NSTextContainer) -> NSRect;
#[method(lineFragmentRectForGlyphAtIndex:effectiveRange:)]
pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
) -> NSRect;
#[method(lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:)]
pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
flag: bool,
) -> NSRect;
#[method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:)]
pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
) -> NSRect;
#[method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:)]
pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
&self,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
flag: bool,
) -> NSRect;
#[method(extraLineFragmentRect)]
pub unsafe fn extraLineFragmentRect(&self) -> NSRect;
#[method(extraLineFragmentUsedRect)]
pub unsafe fn extraLineFragmentUsedRect(&self) -> NSRect;
#[cfg(feature = "NSTextContainer")]
#[method_id(@__retain_semantics Other extraLineFragmentTextContainer)]
pub unsafe fn extraLineFragmentTextContainer(&self) -> Option<Id<NSTextContainer>>;
#[method(locationForGlyphAtIndex:)]
pub unsafe fn locationForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSPoint;
#[method(notShownAttributeForGlyphAtIndex:)]
pub unsafe fn notShownAttributeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> bool;
#[method(drawsOutsideLineFragmentForGlyphAtIndex:)]
pub unsafe fn drawsOutsideLineFragmentForGlyphAtIndex(
&self,
glyph_index: NSUInteger,
) -> bool;
#[method(attachmentSizeForGlyphAtIndex:)]
pub unsafe fn attachmentSizeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSSize;
#[method(truncatedGlyphRangeInLineFragmentForGlyphAtIndex:)]
pub unsafe fn truncatedGlyphRangeInLineFragmentForGlyphAtIndex(
&self,
glyph_index: NSUInteger,
) -> NSRange;
#[method(glyphRangeForCharacterRange:actualCharacterRange:)]
pub unsafe fn glyphRangeForCharacterRange_actualCharacterRange(
&self,
char_range: NSRange,
actual_char_range: NSRangePointer,
) -> NSRange;
#[method(characterRangeForGlyphRange:actualGlyphRange:)]
pub unsafe fn characterRangeForGlyphRange_actualGlyphRange(
&self,
glyph_range: NSRange,
actual_glyph_range: NSRangePointer,
) -> NSRange;
#[cfg(feature = "NSTextContainer")]
#[method(glyphRangeForTextContainer:)]
pub unsafe fn glyphRangeForTextContainer(&self, container: &NSTextContainer) -> NSRange;
#[method(rangeOfNominallySpacedGlyphsContainingIndex:)]
pub unsafe fn rangeOfNominallySpacedGlyphsContainingIndex(
&self,
glyph_index: NSUInteger,
) -> NSRange;
#[cfg(feature = "NSTextContainer")]
#[method(boundingRectForGlyphRange:inTextContainer:)]
pub unsafe fn boundingRectForGlyphRange_inTextContainer(
&self,
glyph_range: NSRange,
container: &NSTextContainer,
) -> NSRect;
#[cfg(feature = "NSTextContainer")]
#[method(glyphRangeForBoundingRect:inTextContainer:)]
pub unsafe fn glyphRangeForBoundingRect_inTextContainer(
&self,
bounds: NSRect,
container: &NSTextContainer,
) -> NSRange;
#[cfg(feature = "NSTextContainer")]
#[method(glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:)]
pub unsafe fn glyphRangeForBoundingRectWithoutAdditionalLayout_inTextContainer(
&self,
bounds: NSRect,
container: &NSTextContainer,
) -> NSRange;
#[cfg(feature = "NSTextContainer")]
#[method(glyphIndexForPoint:inTextContainer:)]
pub unsafe fn glyphIndexForPoint_inTextContainer(
&self,
point: NSPoint,
container: &NSTextContainer,
) -> NSUInteger;
#[cfg(feature = "NSTextContainer")]
#[method(fractionOfDistanceThroughGlyphForPoint:inTextContainer:)]
pub unsafe fn fractionOfDistanceThroughGlyphForPoint_inTextContainer(
&self,
point: NSPoint,
container: &NSTextContainer,
) -> CGFloat;
#[cfg(feature = "NSTextContainer")]
#[method(characterIndexForPoint:inTextContainer:fractionOfDistanceBetweenInsertionPoints:)]
pub unsafe fn characterIndexForPoint_inTextContainer_fractionOfDistanceBetweenInsertionPoints(
&self,
point: NSPoint,
container: &NSTextContainer,
partial_fraction: *mut CGFloat,
) -> NSUInteger;
#[method(getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:)]
pub unsafe fn getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes(
&self,
char_index: NSUInteger,
a_flag: bool,
d_flag: bool,
positions: *mut CGFloat,
char_indexes: *mut NSUInteger,
) -> NSUInteger;
#[cfg(all(feature = "NSTextContainer", feature = "block2"))]
#[method(enumerateLineFragmentsForGlyphRange:usingBlock:)]
pub unsafe fn enumerateLineFragmentsForGlyphRange_usingBlock(
&self,
glyph_range: NSRange,
block: &Block<dyn Fn(NSRect, NSRect, NonNull<NSTextContainer>, NSRange, NonNull<Bool>)>,
);
#[cfg(all(feature = "NSTextContainer", feature = "block2"))]
#[method(enumerateEnclosingRectsForGlyphRange:withinSelectedGlyphRange:inTextContainer:usingBlock:)]
pub unsafe fn enumerateEnclosingRectsForGlyphRange_withinSelectedGlyphRange_inTextContainer_usingBlock(
&self,
glyph_range: NSRange,
selected_range: NSRange,
text_container: &NSTextContainer,
block: &Block<dyn Fn(NSRect, NonNull<Bool>)>,
);
#[method(drawBackgroundForGlyphRange:atPoint:)]
pub unsafe fn drawBackgroundForGlyphRange_atPoint(
&self,
glyphs_to_show: NSRange,
origin: NSPoint,
);
#[method(drawGlyphsForGlyphRange:atPoint:)]
pub unsafe fn drawGlyphsForGlyphRange_atPoint(
&self,
glyphs_to_show: NSRange,
origin: NSPoint,
);
#[cfg(feature = "NSColor")]
#[method(fillBackgroundRectArray:count:forCharacterRange:color:)]
pub unsafe fn fillBackgroundRectArray_count_forCharacterRange_color(
&self,
rect_array: NonNull<NSRect>,
rect_count: NSUInteger,
char_range: NSRange,
color: &NSColor,
);
#[cfg(feature = "NSAttributedString")]
#[method(drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)]
pub unsafe fn drawUnderlineForGlyphRange_underlineType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
&self,
glyph_range: NSRange,
underline_val: NSUnderlineStyle,
baseline_offset: CGFloat,
line_rect: NSRect,
line_glyph_range: NSRange,
container_origin: NSPoint,
);
#[cfg(feature = "NSAttributedString")]
#[method(underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)]
pub unsafe fn underlineGlyphRange_underlineType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
&self,
glyph_range: NSRange,
underline_val: NSUnderlineStyle,
line_rect: NSRect,
line_glyph_range: NSRange,
container_origin: NSPoint,
);
#[cfg(feature = "NSAttributedString")]
#[method(drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)]
pub unsafe fn drawStrikethroughForGlyphRange_strikethroughType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
&self,
glyph_range: NSRange,
strikethrough_val: NSUnderlineStyle,
baseline_offset: CGFloat,
line_rect: NSRect,
line_glyph_range: NSRange,
container_origin: NSPoint,
);
#[cfg(feature = "NSAttributedString")]
#[method(strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)]
pub unsafe fn strikethroughGlyphRange_strikethroughType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
&self,
glyph_range: NSRange,
strikethrough_val: NSUnderlineStyle,
line_rect: NSRect,
line_glyph_range: NSRange,
container_origin: NSPoint,
);
#[cfg(feature = "NSCell")]
#[method(showAttachmentCell:inRect:characterIndex:)]
pub unsafe fn showAttachmentCell_inRect_characterIndex(
&self,
cell: &NSCell,
rect: NSRect,
attachment_index: NSUInteger,
);
#[cfg(feature = "NSTextTable")]
#[method(setLayoutRect:forTextBlock:glyphRange:)]
pub unsafe fn setLayoutRect_forTextBlock_glyphRange(
&self,
rect: NSRect,
block: &NSTextBlock,
glyph_range: NSRange,
);
#[cfg(feature = "NSTextTable")]
#[method(setBoundsRect:forTextBlock:glyphRange:)]
pub unsafe fn setBoundsRect_forTextBlock_glyphRange(
&self,
rect: NSRect,
block: &NSTextBlock,
glyph_range: NSRange,
);
#[cfg(feature = "NSTextTable")]
#[method(layoutRectForTextBlock:glyphRange:)]
pub unsafe fn layoutRectForTextBlock_glyphRange(
&self,
block: &NSTextBlock,
glyph_range: NSRange,
) -> NSRect;
#[cfg(feature = "NSTextTable")]
#[method(boundsRectForTextBlock:glyphRange:)]
pub unsafe fn boundsRectForTextBlock_glyphRange(
&self,
block: &NSTextBlock,
glyph_range: NSRange,
) -> NSRect;
#[cfg(feature = "NSTextTable")]
#[method(layoutRectForTextBlock:atIndex:effectiveRange:)]
pub unsafe fn layoutRectForTextBlock_atIndex_effectiveRange(
&self,
block: &NSTextBlock,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
) -> NSRect;
#[cfg(feature = "NSTextTable")]
#[method(boundsRectForTextBlock:atIndex:effectiveRange:)]
pub unsafe fn boundsRectForTextBlock_atIndex_effectiveRange(
&self,
block: &NSTextBlock,
glyph_index: NSUInteger,
effective_glyph_range: NSRangePointer,
) -> NSRect;
#[method_id(@__retain_semantics Other temporaryAttributesAtCharacterIndex:effectiveRange:)]
pub unsafe fn temporaryAttributesAtCharacterIndex_effectiveRange(
&self,
char_index: NSUInteger,
effective_char_range: NSRangePointer,
) -> Id<NSDictionary<NSAttributedStringKey, AnyObject>>;
#[method(setTemporaryAttributes:forCharacterRange:)]
pub unsafe fn setTemporaryAttributes_forCharacterRange(
&self,
attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
char_range: NSRange,
);
#[method(addTemporaryAttributes:forCharacterRange:)]
pub unsafe fn addTemporaryAttributes_forCharacterRange(
&self,
attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
char_range: NSRange,
);
#[method(removeTemporaryAttribute:forCharacterRange:)]
pub unsafe fn removeTemporaryAttribute_forCharacterRange(
&self,
attr_name: &NSAttributedStringKey,
char_range: NSRange,
);
#[method_id(@__retain_semantics Other temporaryAttribute:atCharacterIndex:effectiveRange:)]
pub unsafe fn temporaryAttribute_atCharacterIndex_effectiveRange(
&self,
attr_name: &NSAttributedStringKey,
location: NSUInteger,
range: NSRangePointer,
) -> Option<Id<AnyObject>>;
#[method_id(@__retain_semantics Other temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:)]
pub unsafe fn temporaryAttribute_atCharacterIndex_longestEffectiveRange_inRange(
&self,
attr_name: &NSAttributedStringKey,
location: NSUInteger,
range: NSRangePointer,
range_limit: NSRange,
) -> Option<Id<AnyObject>>;
#[method_id(@__retain_semantics Other temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:)]
pub unsafe fn temporaryAttributesAtCharacterIndex_longestEffectiveRange_inRange(
&self,
location: NSUInteger,
range: NSRangePointer,
range_limit: NSRange,
) -> Id<NSDictionary<NSAttributedStringKey, AnyObject>>;
#[method(addTemporaryAttribute:value:forCharacterRange:)]
pub unsafe fn addTemporaryAttribute_value_forCharacterRange(
&self,
attr_name: &NSAttributedStringKey,
value: &AnyObject,
char_range: NSRange,
);
#[cfg(feature = "NSFont")]
#[method(defaultLineHeightForFont:)]
pub unsafe fn defaultLineHeightForFont(&self, the_font: &NSFont) -> CGFloat;
#[cfg(feature = "NSFont")]
#[method(defaultBaselineOffsetForFont:)]
pub unsafe fn defaultBaselineOffsetForFont(&self, the_font: &NSFont) -> CGFloat;
}
);
extern_methods!(
unsafe impl NSLayoutManager {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_methods!(
unsafe impl NSLayoutManager {
#[cfg(all(
feature = "NSParagraphStyle",
feature = "NSResponder",
feature = "NSRulerMarker",
feature = "NSRulerView",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other rulerMarkersForTextView:paragraphStyle:ruler:)]
pub unsafe fn rulerMarkersForTextView_paragraphStyle_ruler(
&self,
view: &NSTextView,
style: &NSParagraphStyle,
ruler: &NSRulerView,
) -> Id<NSArray<NSRulerMarker>>;
#[cfg(all(
feature = "NSParagraphStyle",
feature = "NSResponder",
feature = "NSRulerView",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:)]
pub unsafe fn rulerAccessoryViewForTextView_paragraphStyle_ruler_enabled(
&self,
view: &NSTextView,
style: &NSParagraphStyle,
ruler: &NSRulerView,
is_enabled: bool,
) -> Option<Id<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method(layoutManagerOwnsFirstResponderInWindow:)]
pub unsafe fn layoutManagerOwnsFirstResponderInWindow(&self, window: &NSWindow) -> bool;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other firstTextView)]
pub unsafe fn firstTextView(&self, mtm: MainThreadMarker) -> Option<Id<NSTextView>>;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other textViewForBeginningOfSelection)]
pub unsafe fn textViewForBeginningOfSelection(
&self,
mtm: MainThreadMarker,
) -> Option<Id<NSTextView>>;
}
);
extern_protocol!(
pub unsafe trait NSLayoutManagerDelegate: NSObjectProtocol {
#[optional]
#[method(layoutManager:lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
unsafe fn layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
layout_manager: &NSLayoutManager,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[optional]
#[method(layoutManager:paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:)]
unsafe fn layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
&self,
layout_manager: &NSLayoutManager,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[optional]
#[method(layoutManager:paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
unsafe fn layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
layout_manager: &NSLayoutManager,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[optional]
#[method(layoutManager:shouldUseAction:forControlCharacterAtIndex:)]
unsafe fn layoutManager_shouldUseAction_forControlCharacterAtIndex(
&self,
layout_manager: &NSLayoutManager,
action: NSControlCharacterAction,
char_index: NSUInteger,
) -> NSControlCharacterAction;
#[optional]
#[method(layoutManager:shouldBreakLineByWordBeforeCharacterAtIndex:)]
unsafe fn layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex(
&self,
layout_manager: &NSLayoutManager,
char_index: NSUInteger,
) -> bool;
#[optional]
#[method(layoutManager:shouldBreakLineByHyphenatingBeforeCharacterAtIndex:)]
unsafe fn layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
&self,
layout_manager: &NSLayoutManager,
char_index: NSUInteger,
) -> bool;
#[cfg(feature = "NSTextContainer")]
#[optional]
#[method(layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:)]
unsafe fn layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
&self,
layout_manager: &NSLayoutManager,
glyph_index: NSUInteger,
text_container: &NSTextContainer,
proposed_rect: NSRect,
glyph_position: NSPoint,
char_index: NSUInteger,
) -> NSRect;
#[cfg(feature = "NSTextContainer")]
#[optional]
#[method(layoutManager:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:inTextContainer:forGlyphRange:)]
unsafe fn layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange(
&self,
layout_manager: &NSLayoutManager,
line_fragment_rect: NonNull<NSRect>,
line_fragment_used_rect: NonNull<NSRect>,
baseline_offset: NonNull<CGFloat>,
text_container: &NSTextContainer,
glyph_range: NSRange,
) -> bool;
#[optional]
#[method(layoutManagerDidInvalidateLayout:)]
unsafe fn layoutManagerDidInvalidateLayout(&self, sender: &NSLayoutManager);
#[cfg(feature = "NSTextContainer")]
#[optional]
#[method(layoutManager:didCompleteLayoutForTextContainer:atEnd:)]
unsafe fn layoutManager_didCompleteLayoutForTextContainer_atEnd(
&self,
layout_manager: &NSLayoutManager,
text_container: Option<&NSTextContainer>,
layout_finished_flag: bool,
);
#[cfg(feature = "NSTextContainer")]
#[optional]
#[method(layoutManager:textContainer:didChangeGeometryFromSize:)]
unsafe fn layoutManager_textContainer_didChangeGeometryFromSize(
&self,
layout_manager: &NSLayoutManager,
text_container: &NSTextContainer,
old_size: NSSize,
);
#[optional]
#[method_id(@__retain_semantics Other layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:)]
unsafe fn layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange(
&self,
layout_manager: &NSLayoutManager,
attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
to_screen: bool,
char_index: NSUInteger,
effective_char_range: NSRangePointer,
) -> Option<Id<NSDictionary<NSAttributedStringKey, AnyObject>>>;
}
unsafe impl ProtocolType for dyn NSLayoutManagerDelegate {}
);
#[deprecated]
pub const NSGlyphAttributeSoft: c_uint = 0;
#[deprecated]
pub const NSGlyphAttributeElastic: c_uint = 1;
#[deprecated]
pub const NSGlyphAttributeBidiLevel: c_uint = 2;
#[deprecated]
pub const NSGlyphAttributeInscribe: c_uint = 5;
#[deprecated = "Use NSGlyphProperty instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGlyphInscription(pub NSUInteger);
impl NSGlyphInscription {
#[deprecated]
pub const NSGlyphInscribeBase: Self = Self(0);
#[deprecated]
pub const NSGlyphInscribeBelow: Self = Self(1);
#[deprecated]
pub const NSGlyphInscribeAbove: Self = Self(2);
#[deprecated]
pub const NSGlyphInscribeOverstrike: Self = Self(3);
#[deprecated]
pub const NSGlyphInscribeOverBelow: Self = Self(4);
}
unsafe impl Encode for NSGlyphInscription {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSGlyphInscription {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
unsafe impl NSLayoutManager {
#[cfg(feature = "NSFont")]
#[method(glyphAtIndex:isValidIndex:)]
pub unsafe fn glyphAtIndex_isValidIndex(
&self,
glyph_index: NSUInteger,
is_valid_index: *mut Bool,
) -> NSGlyph;
#[cfg(feature = "NSFont")]
#[method(glyphAtIndex:)]
pub unsafe fn glyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyph;
#[cfg(feature = "NSTextContainer")]
#[method(rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:)]
pub unsafe fn rectArrayForCharacterRange_withinSelectedCharacterRange_inTextContainer_rectCount(
&self,
char_range: NSRange,
sel_char_range: NSRange,
container: &NSTextContainer,
rect_count: NonNull<NSUInteger>,
) -> NSRectArray;
#[cfg(feature = "NSTextContainer")]
#[method(rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:)]
pub unsafe fn rectArrayForGlyphRange_withinSelectedGlyphRange_inTextContainer_rectCount(
&self,
glyph_range: NSRange,
sel_glyph_range: NSRange,
container: &NSTextContainer,
rect_count: NonNull<NSUInteger>,
) -> NSRectArray;
#[deprecated]
#[method(usesScreenFonts)]
pub unsafe fn usesScreenFonts(&self) -> bool;
#[deprecated]
#[method(setUsesScreenFonts:)]
pub unsafe fn setUsesScreenFonts(&self, uses_screen_fonts: bool);
#[cfg(feature = "NSFont")]
#[deprecated]
#[method_id(@__retain_semantics Other substituteFontForFont:)]
pub unsafe fn substituteFontForFont(&self, original_font: &NSFont) -> Id<NSFont>;
#[cfg(feature = "NSFont")]
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:)]
pub unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
&self,
glyphs: NonNull<NSGlyph>,
length: NSUInteger,
glyph_index: NSUInteger,
char_index: NSUInteger,
);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(insertGlyph:atGlyphIndex:characterIndex:)]
pub unsafe fn insertGlyph_atGlyphIndex_characterIndex(
&self,
glyph: NSGlyph,
glyph_index: NSUInteger,
char_index: NSUInteger,
);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(replaceGlyphAtIndex:withGlyph:)]
pub unsafe fn replaceGlyphAtIndex_withGlyph(
&self,
glyph_index: NSUInteger,
new_glyph: NSGlyph,
);
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(deleteGlyphsInRange:)]
pub unsafe fn deleteGlyphsInRange(&self, glyph_range: NSRange);
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(setCharacterIndex:forGlyphAtIndex:)]
pub unsafe fn setCharacterIndex_forGlyphAtIndex(
&self,
char_index: NSUInteger,
glyph_index: NSUInteger,
);
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(setIntAttribute:value:forGlyphAtIndex:)]
pub unsafe fn setIntAttribute_value_forGlyphAtIndex(
&self,
attribute_tag: NSInteger,
val: NSInteger,
glyph_index: NSUInteger,
);
#[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
#[method(invalidateGlyphsOnLayoutInvalidationForGlyphRange:)]
pub unsafe fn invalidateGlyphsOnLayoutInvalidationForGlyphRange(
&self,
glyph_range: NSRange,
);
#[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
#[method(intAttribute:forGlyphAtIndex:)]
pub unsafe fn intAttribute_forGlyphAtIndex(
&self,
attribute_tag: NSInteger,
glyph_index: NSUInteger,
) -> NSInteger;
#[cfg(feature = "NSFont")]
#[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
#[method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:)]
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
&self,
glyph_range: NSRange,
glyph_buffer: *mut NSGlyph,
char_index_buffer: *mut NSUInteger,
inscribe_buffer: *mut NSGlyphInscription,
elastic_buffer: *mut Bool,
) -> NSUInteger;
#[cfg(feature = "NSFont")]
#[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
#[method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:)]
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_bidiLevels(
&self,
glyph_range: NSRange,
glyph_buffer: *mut NSGlyph,
char_index_buffer: *mut NSUInteger,
inscribe_buffer: *mut NSGlyphInscription,
elastic_buffer: *mut Bool,
bidi_level_buffer: *mut c_uchar,
) -> NSUInteger;
#[cfg(feature = "NSFont")]
#[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
#[method(getGlyphs:range:)]
pub unsafe fn getGlyphs_range(
&self,
glyph_array: *mut NSGlyph,
glyph_range: NSRange,
) -> NSUInteger;
#[deprecated = "Use -invalidateLayoutForCharacterRange:actualCharacterRange: instead"]
#[method(invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:)]
pub unsafe fn invalidateLayoutForCharacterRange_isSoft_actualCharacterRange(
&self,
char_range: NSRange,
flag: bool,
actual_char_range: NSRangePointer,
);
#[cfg(feature = "NSTextStorage")]
#[deprecated = "Use -processEditingForTextStorage:edited:range:changeInLength:invalidatedRange: instead"]
#[method(textStorage:edited:range:changeInLength:invalidatedRange:)]
pub unsafe fn textStorage_edited_range_changeInLength_invalidatedRange(
&self,
str: &NSTextStorage,
edited_mask: NSTextStorageEditedOptions,
new_char_range: NSRange,
delta: NSInteger,
invalidated_char_range: NSRange,
);
#[deprecated = "Use -setLocation:forStartOfGlyphRange: instead"]
#[method(setLocations:startingGlyphIndexes:count:forGlyphRange:)]
pub unsafe fn setLocations_startingGlyphIndexes_count_forGlyphRange(
&self,
locations: NSPointArray,
glyph_indexes: NonNull<NSUInteger>,
count: NSUInteger,
glyph_range: NSRange,
);
#[cfg(all(feature = "NSColor", feature = "NSFont"))]
#[deprecated = "Use -showCGGlyphs:positions:count:font:matrix:attributes:inContext: instead"]
#[method(showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:)]
pub unsafe fn showPackedGlyphs_length_glyphRange_atPoint_font_color_printingAdjustment(
&self,
glyphs: NonNull<c_char>,
glyph_len: NSUInteger,
glyph_range: NSRange,
point: NSPoint,
font: &NSFont,
color: &NSColor,
printing_adjustment: NSSize,
);
#[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
#[method(hyphenationFactor)]
pub unsafe fn hyphenationFactor(&self) -> c_float;
#[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
#[method(setHyphenationFactor:)]
pub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float);
}
);
extern_methods!(
unsafe impl NSLayoutManager {
#[cfg(feature = "NSGlyphGenerator")]
#[method_id(@__retain_semantics Other glyphGenerator)]
pub unsafe fn glyphGenerator(&self) -> Id<NSGlyphGenerator>;
#[cfg(feature = "NSGlyphGenerator")]
#[method(setGlyphGenerator:)]
pub unsafe fn setGlyphGenerator(&self, glyph_generator: &NSGlyphGenerator);
}
);
#[cfg(feature = "NSGlyphGenerator")]
unsafe impl NSGlyphStorage for NSLayoutManager {}