objc2_app_kit/generated/
NSGlyphInfo.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-graphics")]
6#[cfg(target_vendor = "apple")]
7use objc2_core_graphics::*;
8#[cfg(feature = "objc2-core-text")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_text::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphinfo?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct NSGlyphInfo;
20);
21
22#[cfg(feature = "objc2-core-text")]
23#[cfg(target_vendor = "apple")]
24impl AsRef<NSGlyphInfo> for CTGlyphInfo {
25    #[inline]
26    fn as_ref(&self) -> &NSGlyphInfo {
27        unsafe { &*((self as *const Self).cast()) }
28    }
29}
30
31#[cfg(feature = "objc2-core-text")]
32#[cfg(target_vendor = "apple")]
33impl AsRef<CTGlyphInfo> for NSGlyphInfo {
34    #[inline]
35    fn as_ref(&self) -> &CTGlyphInfo {
36        unsafe { &*((self as *const Self).cast()) }
37    }
38}
39
40extern_conformance!(
41    unsafe impl NSCoding for NSGlyphInfo {}
42);
43
44extern_conformance!(
45    unsafe impl NSCopying for NSGlyphInfo {}
46);
47
48unsafe impl CopyingHelper for NSGlyphInfo {
49    type Result = Self;
50}
51
52extern_conformance!(
53    unsafe impl NSObjectProtocol for NSGlyphInfo {}
54);
55
56extern_conformance!(
57    unsafe impl NSSecureCoding for NSGlyphInfo {}
58);
59
60impl NSGlyphInfo {
61    extern_methods!(
62        #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
63        #[cfg(target_vendor = "apple")]
64        #[unsafe(method(glyphInfoWithCGGlyph:forFont:baseString:))]
65        #[unsafe(method_family = none)]
66        pub fn glyphInfoWithCGGlyph_forFont_baseString(
67            glyph: CGGlyph,
68            font: &NSFont,
69            string: &NSString,
70        ) -> Option<Retained<NSGlyphInfo>>;
71
72        #[cfg(feature = "objc2-core-graphics")]
73        #[cfg(target_vendor = "apple")]
74        #[unsafe(method(glyphID))]
75        #[unsafe(method_family = none)]
76        pub fn glyphID(&self) -> CGGlyph;
77
78        #[unsafe(method(baseString))]
79        #[unsafe(method_family = none)]
80        pub fn baseString(&self) -> Retained<NSString>;
81    );
82}
83
84/// Methods declared on superclass `NSObject`.
85impl NSGlyphInfo {
86    extern_methods!(
87        #[unsafe(method(init))]
88        #[unsafe(method_family = init)]
89        pub fn init(this: Allocated<Self>) -> Retained<Self>;
90
91        #[unsafe(method(new))]
92        #[unsafe(method_family = new)]
93        pub fn new() -> Retained<Self>;
94    );
95}
96
97impl DefaultRetained for NSGlyphInfo {
98    #[inline]
99    fn default_retained() -> Retained<Self> {
100        Self::new()
101    }
102}
103
104/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscharactercollection?language=objc)
105// NS_ENUM
106#[repr(transparent)]
107#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
108pub struct NSCharacterCollection(pub NSUInteger);
109impl NSCharacterCollection {
110    #[doc(alias = "NSIdentityMappingCharacterCollection")]
111    pub const IdentityMappingCharacterCollection: Self = Self(0);
112    #[doc(alias = "NSAdobeCNS1CharacterCollection")]
113    pub const AdobeCNS1CharacterCollection: Self = Self(1);
114    #[doc(alias = "NSAdobeGB1CharacterCollection")]
115    pub const AdobeGB1CharacterCollection: Self = Self(2);
116    #[doc(alias = "NSAdobeJapan1CharacterCollection")]
117    pub const AdobeJapan1CharacterCollection: Self = Self(3);
118    #[doc(alias = "NSAdobeJapan2CharacterCollection")]
119    pub const AdobeJapan2CharacterCollection: Self = Self(4);
120    #[doc(alias = "NSAdobeKorea1CharacterCollection")]
121    pub const AdobeKorea1CharacterCollection: Self = Self(5);
122}
123
124unsafe impl Encode for NSCharacterCollection {
125    const ENCODING: Encoding = NSUInteger::ENCODING;
126}
127
128unsafe impl RefEncode for NSCharacterCollection {
129    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
130}
131
132/// NSGlyphInfo_Deprecated.
133impl NSGlyphInfo {
134    extern_methods!(
135        #[cfg(feature = "NSFont")]
136        #[unsafe(method(glyphInfoWithGlyphName:forFont:baseString:))]
137        #[unsafe(method_family = none)]
138        pub fn glyphInfoWithGlyphName_forFont_baseString(
139            glyph_name: &NSString,
140            font: &NSFont,
141            string: &NSString,
142        ) -> Option<Retained<NSGlyphInfo>>;
143
144        #[cfg(feature = "NSFont")]
145        #[unsafe(method(glyphInfoWithGlyph:forFont:baseString:))]
146        #[unsafe(method_family = none)]
147        pub fn glyphInfoWithGlyph_forFont_baseString(
148            glyph: NSGlyph,
149            font: &NSFont,
150            string: &NSString,
151        ) -> Option<Retained<NSGlyphInfo>>;
152
153        #[unsafe(method(glyphInfoWithCharacterIdentifier:collection:baseString:))]
154        #[unsafe(method_family = none)]
155        pub fn glyphInfoWithCharacterIdentifier_collection_baseString(
156            cid: NSUInteger,
157            character_collection: NSCharacterCollection,
158            string: &NSString,
159        ) -> Option<Retained<NSGlyphInfo>>;
160
161        #[unsafe(method(glyphName))]
162        #[unsafe(method_family = none)]
163        pub fn glyphName(&self) -> Option<Retained<NSString>>;
164
165        #[unsafe(method(characterIdentifier))]
166        #[unsafe(method_family = none)]
167        pub fn characterIdentifier(&self) -> NSUInteger;
168
169        #[unsafe(method(characterCollection))]
170        #[unsafe(method_family = none)]
171        pub fn characterCollection(&self) -> NSCharacterCollection;
172    );
173}