objc2_core_text/generated/
CTTextTab.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[repr(C)]
15pub struct CTTextTab {
16 inner: [u8; 0],
17 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21 unsafe impl CTTextTab {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25 unsafe impl RefEncode<"__CTTextTab"> for CTTextTab {}
26);
27
28unsafe impl ConcreteType for CTTextTab {
29 #[doc(alias = "CTTextTabGetTypeID")]
31 #[inline]
32 fn type_id() -> CFTypeID {
33 extern "C-unwind" {
34 fn CTTextTabGetTypeID() -> CFTypeID;
35 }
36 unsafe { CTTextTabGetTypeID() }
37 }
38}
39
40extern "C" {
41 pub static kCTTabColumnTerminatorsAttributeName: &'static CFString;
53}
54
55impl CTTextTab {
56 #[doc(alias = "CTTextTabCreate")]
74 #[cfg(feature = "CTParagraphStyle")]
75 #[inline]
76 pub unsafe fn new(
77 alignment: CTTextAlignment,
78 location: c_double,
79 options: Option<&CFDictionary>,
80 ) -> CFRetained<CTTextTab> {
81 extern "C-unwind" {
82 fn CTTextTabCreate(
83 alignment: CTTextAlignment,
84 location: c_double,
85 options: Option<&CFDictionary>,
86 ) -> Option<NonNull<CTTextTab>>;
87 }
88 let ret = unsafe { CTTextTabCreate(alignment, location, options) };
89 let ret =
90 ret.expect("function was marked as returning non-null, but actually returned NULL");
91 unsafe { CFRetained::from_raw(ret) }
92 }
93
94 #[doc(alias = "CTTextTabGetAlignment")]
102 #[cfg(feature = "CTParagraphStyle")]
103 #[inline]
104 pub unsafe fn alignment(self: &CTTextTab) -> CTTextAlignment {
105 extern "C-unwind" {
106 fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
107 }
108 unsafe { CTTextTabGetAlignment(self) }
109 }
110
111 #[doc(alias = "CTTextTabGetLocation")]
119 #[inline]
120 pub unsafe fn location(self: &CTTextTab) -> c_double {
121 extern "C-unwind" {
122 fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
123 }
124 unsafe { CTTextTabGetLocation(self) }
125 }
126
127 #[doc(alias = "CTTextTabGetOptions")]
136 #[inline]
137 pub unsafe fn options(self: &CTTextTab) -> Option<CFRetained<CFDictionary>> {
138 extern "C-unwind" {
139 fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
140 }
141 let ret = unsafe { CTTextTabGetOptions(self) };
142 ret.map(|ret| unsafe { CFRetained::retain(ret) })
143 }
144}
145
146#[cfg(feature = "CTParagraphStyle")]
147#[deprecated = "renamed to `CTTextTab::new`"]
148#[inline]
149pub unsafe extern "C-unwind" fn CTTextTabCreate(
150 alignment: CTTextAlignment,
151 location: c_double,
152 options: Option<&CFDictionary>,
153) -> CFRetained<CTTextTab> {
154 extern "C-unwind" {
155 fn CTTextTabCreate(
156 alignment: CTTextAlignment,
157 location: c_double,
158 options: Option<&CFDictionary>,
159 ) -> Option<NonNull<CTTextTab>>;
160 }
161 let ret = unsafe { CTTextTabCreate(alignment, location, options) };
162 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
163 unsafe { CFRetained::from_raw(ret) }
164}
165
166extern "C-unwind" {
167 #[cfg(feature = "CTParagraphStyle")]
168 #[deprecated = "renamed to `CTTextTab::alignment`"]
169 pub fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
170}
171
172extern "C-unwind" {
173 #[deprecated = "renamed to `CTTextTab::location`"]
174 pub fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
175}
176
177#[deprecated = "renamed to `CTTextTab::options`"]
178#[inline]
179pub unsafe extern "C-unwind" fn CTTextTabGetOptions(
180 tab: &CTTextTab,
181) -> Option<CFRetained<CFDictionary>> {
182 extern "C-unwind" {
183 fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
184 }
185 let ret = unsafe { CTTextTabGetOptions(tab) };
186 ret.map(|ret| unsafe { CFRetained::retain(ret) })
187}