use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineBreakMode(pub NSUInteger);
impl NSLineBreakMode {
#[doc(alias = "NSLineBreakByWordWrapping")]
pub const ByWordWrapping: Self = Self(0);
#[doc(alias = "NSLineBreakByCharWrapping")]
pub const ByCharWrapping: Self = Self(1);
#[doc(alias = "NSLineBreakByClipping")]
pub const ByClipping: Self = Self(2);
#[doc(alias = "NSLineBreakByTruncatingHead")]
pub const ByTruncatingHead: Self = Self(3);
#[doc(alias = "NSLineBreakByTruncatingTail")]
pub const ByTruncatingTail: Self = Self(4);
#[doc(alias = "NSLineBreakByTruncatingMiddle")]
pub const ByTruncatingMiddle: Self = Self(5);
}
unsafe impl Encode for NSLineBreakMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineBreakMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineBreakStrategy(pub NSUInteger);
bitflags::bitflags! {
impl NSLineBreakStrategy: NSUInteger {
#[doc(alias = "NSLineBreakStrategyNone")]
const None = 0;
#[doc(alias = "NSLineBreakStrategyPushOut")]
const PushOut = 1<<0;
#[doc(alias = "NSLineBreakStrategyHangulWordPriority")]
const HangulWordPriority = 1<<1;
#[doc(alias = "NSLineBreakStrategyStandard")]
const Standard = 0xFFFF;
}
}
unsafe impl Encode for NSLineBreakStrategy {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineBreakStrategy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSTextTabOptionKey = NSString;
extern "C" {
pub static NSTabColumnTerminatorsAttributeName: &'static NSTextTabOptionKey;
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextTab;
);
extern_conformance!(
unsafe impl NSCoding for NSTextTab {}
);
extern_conformance!(
unsafe impl NSCopying for NSTextTab {}
);
unsafe impl CopyingHelper for NSTextTab {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextTab {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSTextTab {}
);
impl NSTextTab {
extern_methods!(
#[unsafe(method(columnTerminatorsForLocale:))]
#[unsafe(method_family = none)]
pub fn columnTerminatorsForLocale(a_locale: Option<&NSLocale>) -> Retained<NSCharacterSet>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(location))]
#[unsafe(method_family = none)]
pub fn location(&self) -> CGFloat;
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub fn options(&self) -> Retained<NSDictionary<NSTextTabOptionKey, AnyObject>>;
);
}
impl NSTextTab {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSTextTab {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSParagraphStyle;
);
extern_conformance!(
unsafe impl NSCoding for NSParagraphStyle {}
);
extern_conformance!(
unsafe impl NSCopying for NSParagraphStyle {}
);
unsafe impl CopyingHelper for NSParagraphStyle {
type Result = Self;
}
extern_conformance!(
unsafe impl NSMutableCopying for NSParagraphStyle {}
);
unsafe impl MutableCopyingHelper for NSParagraphStyle {
type Result = NSMutableParagraphStyle;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSParagraphStyle {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSParagraphStyle {}
);
impl NSParagraphStyle {
extern_methods!(
#[unsafe(method(defaultParagraphStyle))]
#[unsafe(method_family = none)]
pub fn defaultParagraphStyle() -> Retained<NSParagraphStyle>;
#[cfg(feature = "NSText")]
#[unsafe(method(defaultWritingDirectionForLanguage:))]
#[unsafe(method_family = none)]
pub fn defaultWritingDirectionForLanguage(
language_name: Option<&NSString>,
) -> NSWritingDirection;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineSpacing))]
#[unsafe(method_family = none)]
pub fn lineSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacing))]
#[unsafe(method_family = none)]
pub fn paragraphSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(headIndent))]
#[unsafe(method_family = none)]
pub fn headIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(tailIndent))]
#[unsafe(method_family = none)]
pub fn tailIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(firstLineHeadIndent))]
#[unsafe(method_family = none)]
pub fn firstLineHeadIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(minimumLineHeight))]
#[unsafe(method_family = none)]
pub fn minimumLineHeight(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(maximumLineHeight))]
#[unsafe(method_family = none)]
pub fn maximumLineHeight(&self) -> CGFloat;
#[unsafe(method(lineBreakMode))]
#[unsafe(method_family = none)]
pub fn lineBreakMode(&self) -> NSLineBreakMode;
#[cfg(feature = "NSText")]
#[unsafe(method(baseWritingDirection))]
#[unsafe(method_family = none)]
pub fn baseWritingDirection(&self) -> NSWritingDirection;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineHeightMultiple))]
#[unsafe(method_family = none)]
pub fn lineHeightMultiple(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacingBefore))]
#[unsafe(method_family = none)]
pub fn paragraphSpacingBefore(&self) -> CGFloat;
#[unsafe(method(hyphenationFactor))]
#[unsafe(method_family = none)]
pub fn hyphenationFactor(&self) -> c_float;
#[unsafe(method(usesDefaultHyphenation))]
#[unsafe(method_family = none)]
pub fn usesDefaultHyphenation(&self) -> bool;
#[unsafe(method(tabStops))]
#[unsafe(method_family = none)]
pub fn tabStops(&self) -> Retained<NSArray<NSTextTab>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(defaultTabInterval))]
#[unsafe(method_family = none)]
pub fn defaultTabInterval(&self) -> CGFloat;
#[cfg(feature = "NSTextList")]
#[unsafe(method(textLists))]
#[unsafe(method_family = none)]
pub fn textLists(&self) -> Retained<NSArray<NSTextList>>;
#[unsafe(method(allowsDefaultTighteningForTruncation))]
#[unsafe(method_family = none)]
pub fn allowsDefaultTighteningForTruncation(&self) -> bool;
#[unsafe(method(lineBreakStrategy))]
#[unsafe(method_family = none)]
pub fn lineBreakStrategy(&self) -> NSLineBreakStrategy;
);
}
impl NSParagraphStyle {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSParagraphStyle {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSParagraphStyle, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMutableParagraphStyle;
);
extern_conformance!(
unsafe impl NSCoding for NSMutableParagraphStyle {}
);
extern_conformance!(
unsafe impl NSCopying for NSMutableParagraphStyle {}
);
unsafe impl CopyingHelper for NSMutableParagraphStyle {
type Result = NSParagraphStyle;
}
extern_conformance!(
unsafe impl NSMutableCopying for NSMutableParagraphStyle {}
);
unsafe impl MutableCopyingHelper for NSMutableParagraphStyle {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSMutableParagraphStyle {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSMutableParagraphStyle {}
);
impl NSMutableParagraphStyle {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineSpacing))]
#[unsafe(method_family = none)]
pub fn lineSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineSpacing:))]
#[unsafe(method_family = none)]
pub fn setLineSpacing(&self, line_spacing: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacing))]
#[unsafe(method_family = none)]
pub fn paragraphSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setParagraphSpacing:))]
#[unsafe(method_family = none)]
pub fn setParagraphSpacing(&self, paragraph_spacing: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(firstLineHeadIndent))]
#[unsafe(method_family = none)]
pub fn firstLineHeadIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setFirstLineHeadIndent:))]
#[unsafe(method_family = none)]
pub fn setFirstLineHeadIndent(&self, first_line_head_indent: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(headIndent))]
#[unsafe(method_family = none)]
pub fn headIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setHeadIndent:))]
#[unsafe(method_family = none)]
pub fn setHeadIndent(&self, head_indent: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(tailIndent))]
#[unsafe(method_family = none)]
pub fn tailIndent(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setTailIndent:))]
#[unsafe(method_family = none)]
pub fn setTailIndent(&self, tail_indent: CGFloat);
#[unsafe(method(lineBreakMode))]
#[unsafe(method_family = none)]
pub fn lineBreakMode(&self) -> NSLineBreakMode;
#[unsafe(method(setLineBreakMode:))]
#[unsafe(method_family = none)]
pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(minimumLineHeight))]
#[unsafe(method_family = none)]
pub fn minimumLineHeight(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setMinimumLineHeight:))]
#[unsafe(method_family = none)]
pub fn setMinimumLineHeight(&self, minimum_line_height: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(maximumLineHeight))]
#[unsafe(method_family = none)]
pub fn maximumLineHeight(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setMaximumLineHeight:))]
#[unsafe(method_family = none)]
pub fn setMaximumLineHeight(&self, maximum_line_height: CGFloat);
#[cfg(feature = "NSText")]
#[unsafe(method(baseWritingDirection))]
#[unsafe(method_family = none)]
pub fn baseWritingDirection(&self) -> NSWritingDirection;
#[cfg(feature = "NSText")]
#[unsafe(method(setBaseWritingDirection:))]
#[unsafe(method_family = none)]
pub fn setBaseWritingDirection(&self, base_writing_direction: NSWritingDirection);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineHeightMultiple))]
#[unsafe(method_family = none)]
pub fn lineHeightMultiple(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineHeightMultiple:))]
#[unsafe(method_family = none)]
pub fn setLineHeightMultiple(&self, line_height_multiple: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacingBefore))]
#[unsafe(method_family = none)]
pub fn paragraphSpacingBefore(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setParagraphSpacingBefore:))]
#[unsafe(method_family = none)]
pub fn setParagraphSpacingBefore(&self, paragraph_spacing_before: CGFloat);
#[unsafe(method(hyphenationFactor))]
#[unsafe(method_family = none)]
pub fn hyphenationFactor(&self) -> c_float;
#[unsafe(method(setHyphenationFactor:))]
#[unsafe(method_family = none)]
pub fn setHyphenationFactor(&self, hyphenation_factor: c_float);
#[unsafe(method(usesDefaultHyphenation))]
#[unsafe(method_family = none)]
pub fn usesDefaultHyphenation(&self) -> bool;
#[unsafe(method(setUsesDefaultHyphenation:))]
#[unsafe(method_family = none)]
pub fn setUsesDefaultHyphenation(&self, uses_default_hyphenation: bool);
#[unsafe(method(tabStops))]
#[unsafe(method_family = none)]
pub fn tabStops(&self) -> Retained<NSArray<NSTextTab>>;
#[unsafe(method(setTabStops:))]
#[unsafe(method_family = none)]
pub fn setTabStops(&self, tab_stops: Option<&NSArray<NSTextTab>>);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(defaultTabInterval))]
#[unsafe(method_family = none)]
pub fn defaultTabInterval(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDefaultTabInterval:))]
#[unsafe(method_family = none)]
pub fn setDefaultTabInterval(&self, default_tab_interval: CGFloat);
#[unsafe(method(allowsDefaultTighteningForTruncation))]
#[unsafe(method_family = none)]
pub fn allowsDefaultTighteningForTruncation(&self) -> bool;
#[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
#[unsafe(method_family = none)]
pub fn setAllowsDefaultTighteningForTruncation(
&self,
allows_default_tightening_for_truncation: bool,
);
#[unsafe(method(lineBreakStrategy))]
#[unsafe(method_family = none)]
pub fn lineBreakStrategy(&self) -> NSLineBreakStrategy;
#[unsafe(method(setLineBreakStrategy:))]
#[unsafe(method_family = none)]
pub fn setLineBreakStrategy(&self, line_break_strategy: NSLineBreakStrategy);
#[cfg(feature = "NSTextList")]
#[unsafe(method(textLists))]
#[unsafe(method_family = none)]
pub fn textLists(&self) -> Retained<NSArray<NSTextList>>;
#[cfg(feature = "NSTextList")]
#[unsafe(method(setTextLists:))]
#[unsafe(method_family = none)]
pub fn setTextLists(&self, text_lists: &NSArray<NSTextList>);
#[unsafe(method(addTabStop:))]
#[unsafe(method_family = none)]
pub fn addTabStop(&self, an_object: &NSTextTab);
#[unsafe(method(removeTabStop:))]
#[unsafe(method_family = none)]
pub fn removeTabStop(&self, an_object: &NSTextTab);
#[unsafe(method(setParagraphStyle:))]
#[unsafe(method_family = none)]
pub fn setParagraphStyle(&self, obj: &NSParagraphStyle);
);
}
impl NSMutableParagraphStyle {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSMutableParagraphStyle {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl NSTextTab {
extern_methods!(
#[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
#[unsafe(method(initWithTextAlignment:location:options:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTextAlignment_location_options(
this: Allocated<Self>,
alignment: NSTextAlignment,
loc: CGFloat,
options: &NSDictionary<NSTextTabOptionKey, AnyObject>,
) -> Retained<Self>;
#[cfg(feature = "NSText")]
#[unsafe(method(alignment))]
#[unsafe(method_family = none)]
pub fn alignment(&self) -> NSTextAlignment;
);
}
impl NSParagraphStyle {
extern_methods!(
#[cfg(feature = "NSText")]
#[unsafe(method(alignment))]
#[unsafe(method_family = none)]
pub fn alignment(&self) -> NSTextAlignment;
#[unsafe(method(tighteningFactorForTruncation))]
#[unsafe(method_family = none)]
pub fn tighteningFactorForTruncation(&self) -> c_float;
#[cfg(feature = "NSTextTable")]
#[unsafe(method(textBlocks))]
#[unsafe(method_family = none)]
pub fn textBlocks(&self) -> Retained<NSArray<NSTextBlock>>;
#[unsafe(method(headerLevel))]
#[unsafe(method_family = none)]
pub fn headerLevel(&self) -> NSInteger;
);
}
impl NSMutableParagraphStyle {
extern_methods!(
#[cfg(feature = "NSText")]
#[unsafe(method(alignment))]
#[unsafe(method_family = none)]
pub fn alignment(&self) -> NSTextAlignment;
#[cfg(feature = "NSText")]
#[unsafe(method(setAlignment:))]
#[unsafe(method_family = none)]
pub fn setAlignment(&self, alignment: NSTextAlignment);
#[unsafe(method(tighteningFactorForTruncation))]
#[unsafe(method_family = none)]
pub fn tighteningFactorForTruncation(&self) -> c_float;
#[unsafe(method(setTighteningFactorForTruncation:))]
#[unsafe(method_family = none)]
pub fn setTighteningFactorForTruncation(&self, tightening_factor_for_truncation: c_float);
#[cfg(feature = "NSTextTable")]
#[unsafe(method(textBlocks))]
#[unsafe(method_family = none)]
pub fn textBlocks(&self) -> Retained<NSArray<NSTextBlock>>;
#[cfg(feature = "NSTextTable")]
#[unsafe(method(setTextBlocks:))]
#[unsafe(method_family = none)]
pub fn setTextBlocks(&self, text_blocks: &NSArray<NSTextBlock>);
#[unsafe(method(headerLevel))]
#[unsafe(method_family = none)]
pub fn headerLevel(&self) -> NSInteger;
#[unsafe(method(setHeaderLevel:))]
#[unsafe(method_family = none)]
pub fn setHeaderLevel(&self, header_level: NSInteger);
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextTabType(pub NSUInteger);
impl NSTextTabType {
#[doc(alias = "NSLeftTabStopType")]
pub const LeftTabStopType: Self = Self(0);
#[doc(alias = "NSRightTabStopType")]
pub const RightTabStopType: Self = Self(1);
#[doc(alias = "NSCenterTabStopType")]
pub const CenterTabStopType: Self = Self(2);
#[doc(alias = "NSDecimalTabStopType")]
pub const DecimalTabStopType: Self = Self(3);
}
unsafe impl Encode for NSTextTabType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTextTabType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl NSTextTab {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithType:location:))]
#[unsafe(method_family = init)]
pub fn initWithType_location(
this: Allocated<Self>,
r#type: NSTextTabType,
loc: CGFloat,
) -> Retained<Self>;
#[unsafe(method(tabStopType))]
#[unsafe(method_family = none)]
pub fn tabStopType(&self) -> NSTextTabType;
);
}