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#[doc(alias = "CTTextTabRef")]
15#[repr(C)]
16pub struct CTTextTab {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl CTTextTab {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"__CTTextTab"> for CTTextTab {}
27);
28
29unsafe impl ConcreteType for CTTextTab {
30 #[doc(alias = "CTTextTabGetTypeID")]
32 #[inline]
33 fn type_id() -> CFTypeID {
34 extern "C-unwind" {
35 fn CTTextTabGetTypeID() -> CFTypeID;
36 }
37 unsafe { CTTextTabGetTypeID() }
38 }
39}
40
41extern "C" {
42 pub static kCTTabColumnTerminatorsAttributeName: &'static CFString;
54}
55
56impl CTTextTab {
57 #[doc(alias = "CTTextTabCreate")]
79 #[cfg(feature = "CTParagraphStyle")]
80 #[inline]
81 pub unsafe fn new(
82 alignment: CTTextAlignment,
83 location: c_double,
84 options: Option<&CFDictionary>,
85 ) -> CFRetained<CTTextTab> {
86 extern "C-unwind" {
87 fn CTTextTabCreate(
88 alignment: CTTextAlignment,
89 location: c_double,
90 options: Option<&CFDictionary>,
91 ) -> Option<NonNull<CTTextTab>>;
92 }
93 let ret = unsafe { CTTextTabCreate(alignment, location, options) };
94 let ret =
95 ret.expect("function was marked as returning non-null, but actually returned NULL");
96 unsafe { CFRetained::from_raw(ret) }
97 }
98
99 #[doc(alias = "CTTextTabGetAlignment")]
107 #[cfg(feature = "CTParagraphStyle")]
108 #[inline]
109 pub unsafe fn alignment(&self) -> CTTextAlignment {
110 extern "C-unwind" {
111 fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
112 }
113 unsafe { CTTextTabGetAlignment(self) }
114 }
115
116 #[doc(alias = "CTTextTabGetLocation")]
124 #[inline]
125 pub unsafe fn location(&self) -> c_double {
126 extern "C-unwind" {
127 fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
128 }
129 unsafe { CTTextTabGetLocation(self) }
130 }
131
132 #[doc(alias = "CTTextTabGetOptions")]
141 #[inline]
142 pub unsafe fn options(&self) -> Option<CFRetained<CFDictionary>> {
143 extern "C-unwind" {
144 fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
145 }
146 let ret = unsafe { CTTextTabGetOptions(self) };
147 ret.map(|ret| unsafe { CFRetained::retain(ret) })
148 }
149}
150
151#[cfg(feature = "CTParagraphStyle")]
152#[deprecated = "renamed to `CTTextTab::new`"]
153#[inline]
154pub unsafe extern "C-unwind" fn CTTextTabCreate(
155 alignment: CTTextAlignment,
156 location: c_double,
157 options: Option<&CFDictionary>,
158) -> CFRetained<CTTextTab> {
159 extern "C-unwind" {
160 fn CTTextTabCreate(
161 alignment: CTTextAlignment,
162 location: c_double,
163 options: Option<&CFDictionary>,
164 ) -> Option<NonNull<CTTextTab>>;
165 }
166 let ret = unsafe { CTTextTabCreate(alignment, location, options) };
167 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
168 unsafe { CFRetained::from_raw(ret) }
169}
170
171extern "C-unwind" {
172 #[cfg(feature = "CTParagraphStyle")]
173 #[deprecated = "renamed to `CTTextTab::alignment`"]
174 pub fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
175}
176
177extern "C-unwind" {
178 #[deprecated = "renamed to `CTTextTab::location`"]
179 pub fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
180}
181
182#[deprecated = "renamed to `CTTextTab::options`"]
183#[inline]
184pub unsafe extern "C-unwind" fn CTTextTabGetOptions(
185 tab: &CTTextTab,
186) -> Option<CFRetained<CFDictionary>> {
187 extern "C-unwind" {
188 fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
189 }
190 let ret = unsafe { CTTextTabGetOptions(tab) };
191 ret.map(|ret| unsafe { CFRetained::retain(ret) })
192}