objc2_quartz_core/generated/
CATextLayer.rs1use 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")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14pub type CATextLayerTruncationMode = NSString;
17
18pub type CATextLayerAlignmentMode = NSString;
21
22extern_class!(
23 #[unsafe(super(CALayer, NSObject))]
25 #[derive(Debug, PartialEq, Eq, Hash)]
26 #[cfg(feature = "CALayer")]
27 pub struct CATextLayer;
28);
29
30#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
31extern_conformance!(
32 unsafe impl CAMediaTiming for CATextLayer {}
33);
34
35#[cfg(feature = "CALayer")]
36extern_conformance!(
37 unsafe impl NSCoding for CATextLayer {}
38);
39
40#[cfg(feature = "CALayer")]
41extern_conformance!(
42 unsafe impl NSObjectProtocol for CATextLayer {}
43);
44
45#[cfg(feature = "CALayer")]
46extern_conformance!(
47 unsafe impl NSSecureCoding for CATextLayer {}
48);
49
50#[cfg(feature = "CALayer")]
51impl CATextLayer {
52 extern_methods!(
53 #[unsafe(method(string))]
54 #[unsafe(method_family = none)]
55 pub fn string(&self) -> Option<Retained<AnyObject>>;
56
57 #[unsafe(method(setString:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn setString(&self, string: Option<&AnyObject>);
67
68 #[cfg(feature = "objc2-core-foundation")]
69 #[unsafe(method(font))]
70 #[unsafe(method_family = none)]
71 pub fn font(&self) -> Option<Retained<CFType>>;
72
73 #[cfg(feature = "objc2-core-foundation")]
74 #[unsafe(method(setFont:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn setFont(&self, font: Option<&CFType>);
82
83 #[cfg(feature = "objc2-core-foundation")]
84 #[unsafe(method(fontSize))]
85 #[unsafe(method_family = none)]
86 pub fn fontSize(&self) -> CGFloat;
87
88 #[cfg(feature = "objc2-core-foundation")]
89 #[unsafe(method(setFontSize:))]
91 #[unsafe(method_family = none)]
92 pub fn setFontSize(&self, font_size: CGFloat);
93
94 #[cfg(feature = "objc2-core-graphics")]
95 #[unsafe(method(foregroundColor))]
96 #[unsafe(method_family = none)]
97 pub fn foregroundColor(&self) -> Option<Retained<CGColor>>;
98
99 #[cfg(feature = "objc2-core-graphics")]
100 #[unsafe(method(setForegroundColor:))]
102 #[unsafe(method_family = none)]
103 pub fn setForegroundColor(&self, foreground_color: Option<&CGColor>);
104
105 #[unsafe(method(isWrapped))]
106 #[unsafe(method_family = none)]
107 pub fn isWrapped(&self) -> bool;
108
109 #[unsafe(method(setWrapped:))]
111 #[unsafe(method_family = none)]
112 pub fn setWrapped(&self, wrapped: bool);
113
114 #[unsafe(method(truncationMode))]
115 #[unsafe(method_family = none)]
116 pub fn truncationMode(&self) -> Retained<CATextLayerTruncationMode>;
117
118 #[unsafe(method(setTruncationMode:))]
122 #[unsafe(method_family = none)]
123 pub fn setTruncationMode(&self, truncation_mode: &CATextLayerTruncationMode);
124
125 #[unsafe(method(alignmentMode))]
126 #[unsafe(method_family = none)]
127 pub fn alignmentMode(&self) -> Retained<CATextLayerAlignmentMode>;
128
129 #[unsafe(method(setAlignmentMode:))]
133 #[unsafe(method_family = none)]
134 pub fn setAlignmentMode(&self, alignment_mode: &CATextLayerAlignmentMode);
135
136 #[unsafe(method(allowsFontSubpixelQuantization))]
137 #[unsafe(method_family = none)]
138 pub fn allowsFontSubpixelQuantization(&self) -> bool;
139
140 #[unsafe(method(setAllowsFontSubpixelQuantization:))]
142 #[unsafe(method_family = none)]
143 pub fn setAllowsFontSubpixelQuantization(&self, allows_font_subpixel_quantization: bool);
144 );
145}
146
147#[cfg(feature = "CALayer")]
149impl CATextLayer {
150 extern_methods!(
151 #[unsafe(method(layer))]
153 #[unsafe(method_family = none)]
154 pub fn layer() -> Retained<Self>;
155
156 #[unsafe(method(init))]
157 #[unsafe(method_family = init)]
158 pub fn init(this: Allocated<Self>) -> Retained<Self>;
159
160 #[unsafe(method(initWithLayer:))]
164 #[unsafe(method_family = init)]
165 pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
166 );
167}
168
169#[cfg(feature = "CALayer")]
171impl CATextLayer {
172 extern_methods!(
173 #[unsafe(method(new))]
174 #[unsafe(method_family = new)]
175 pub fn new() -> Retained<Self>;
176 );
177}
178
179#[cfg(feature = "CALayer")]
180impl DefaultRetained for CATextLayer {
181 #[inline]
182 fn default_retained() -> Retained<Self> {
183 Self::new()
184 }
185}
186
187extern "C" {
188 pub static kCATruncationNone: &'static CATextLayerTruncationMode;
190}
191
192extern "C" {
193 pub static kCATruncationStart: &'static CATextLayerTruncationMode;
195}
196
197extern "C" {
198 pub static kCATruncationEnd: &'static CATextLayerTruncationMode;
200}
201
202extern "C" {
203 pub static kCATruncationMiddle: &'static CATextLayerTruncationMode;
205}
206
207extern "C" {
208 pub static kCAAlignmentNatural: &'static CATextLayerAlignmentMode;
210}
211
212extern "C" {
213 pub static kCAAlignmentLeft: &'static CATextLayerAlignmentMode;
215}
216
217extern "C" {
218 pub static kCAAlignmentRight: &'static CATextLayerAlignmentMode;
220}
221
222extern "C" {
223 pub static kCAAlignmentCenter: &'static CATextLayerAlignmentMode;
225}
226
227extern "C" {
228 pub static kCAAlignmentJustified: &'static CATextLayerAlignmentMode;
230}