1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/coretext/cttexttab?language=objc)
#[doc(alias = "CTTextTabRef")]
#[repr(C)]
pub struct CTTextTab {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl CTTextTab {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__CTTextTab"> for CTTextTab {}
);
unsafe impl ConcreteType for CTTextTab {
/// Returns the CFType of the text tab object
#[doc(alias = "CTTextTabGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn CTTextTabGetTypeID() -> CFTypeID;
}
unsafe { CTTextTabGetTypeID() }
}
}
extern "C" {
/// Used to specify the terminating character for a tab column
///
///
/// The value associated with this attribute is a CFCharacterSet. The
/// character set is used to determine the terminating character for
/// a tab column. The tab and newline characters are implied even if
/// they don't exist in the character set. This attribute can be used
/// to implement decimal tabs, for instance. This attribute is
/// optional.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kcttabcolumnterminatorsattributename?language=objc)
pub static kCTTabColumnTerminatorsAttributeName: &'static CFString;
}
impl CTTextTab {
/// Creates and initializes a new text tab.
///
///
/// Parameter `alignment`: The tab's alignment. This is used to determine the position of
/// text inside the tab column. This parameter must be set to a valid
/// CTTextAlignment value or this function will return NULL.
///
///
/// Parameter `location`: The tab's ruler location, relative to the back margin.
///
///
/// Parameter `options`: Options to pass in when the tab is created. Currently, the only
/// option available is kCTTabColumnTerminatorsAttributeName. This
/// parameter is optional and can be set to NULL if not needed.
///
///
/// Returns: The new CTTextTab.
///
/// # Safety
///
/// `options` generics must be of the correct type.
#[doc(alias = "CTTextTabCreate")]
#[cfg(feature = "CTParagraphStyle")]
#[inline]
pub unsafe fn new(
alignment: CTTextAlignment,
location: c_double,
options: Option<&CFDictionary>,
) -> CFRetained<CTTextTab> {
extern "C-unwind" {
fn CTTextTabCreate(
alignment: CTTextAlignment,
location: c_double,
options: Option<&CFDictionary>,
) -> Option<NonNull<CTTextTab>>;
}
let ret = unsafe { CTTextTabCreate(alignment, location, options) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
/// Returns the text alignment of the tab.
///
///
/// Parameter `tab`: The tab whose text alignment you wish to access.
///
///
/// Returns: The tab's text alignment value.
#[doc(alias = "CTTextTabGetAlignment")]
#[cfg(feature = "CTParagraphStyle")]
#[inline]
pub unsafe fn alignment(&self) -> CTTextAlignment {
extern "C-unwind" {
fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
}
unsafe { CTTextTabGetAlignment(self) }
}
/// Returns the tab's ruler location.
///
///
/// Parameter `tab`: The tab whose location you wish to access.
///
///
/// Returns: The tab's ruler location relative to the back margin.
#[doc(alias = "CTTextTabGetLocation")]
#[inline]
pub unsafe fn location(&self) -> c_double {
extern "C-unwind" {
fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
}
unsafe { CTTextTabGetLocation(self) }
}
/// Returns the dictionary of attributes associated with the tab.
///
///
/// Parameter `tab`: The tab whose attributes you wish to access.
///
///
/// Returns: The dictionary of attributes associated with the tab or NULL if
/// no dictionary is present.
#[doc(alias = "CTTextTabGetOptions")]
#[inline]
pub unsafe fn options(&self) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CTTextTabGetOptions(self) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
}
#[cfg(feature = "CTParagraphStyle")]
#[deprecated = "renamed to `CTTextTab::new`"]
#[inline]
pub unsafe extern "C-unwind" fn CTTextTabCreate(
alignment: CTTextAlignment,
location: c_double,
options: Option<&CFDictionary>,
) -> CFRetained<CTTextTab> {
extern "C-unwind" {
fn CTTextTabCreate(
alignment: CTTextAlignment,
location: c_double,
options: Option<&CFDictionary>,
) -> Option<NonNull<CTTextTab>>;
}
let ret = unsafe { CTTextTabCreate(alignment, location, options) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
extern "C-unwind" {
#[cfg(feature = "CTParagraphStyle")]
#[deprecated = "renamed to `CTTextTab::alignment`"]
pub fn CTTextTabGetAlignment(tab: &CTTextTab) -> CTTextAlignment;
}
extern "C-unwind" {
#[deprecated = "renamed to `CTTextTab::location`"]
pub fn CTTextTabGetLocation(tab: &CTTextTab) -> c_double;
}
#[deprecated = "renamed to `CTTextTab::options`"]
#[inline]
pub unsafe extern "C-unwind" fn CTTextTabGetOptions(
tab: &CTTextTab,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CTTextTabGetOptions(tab: &CTTextTab) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CTTextTabGetOptions(tab) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}