objc2_core_text/generated/
CTTextTab.rs

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