objc2_core_foundation/generated/
CFUserNotification.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;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfusernotification?language=objc)
11#[repr(C)]
12pub struct CFUserNotification {
13    inner: [u8; 0],
14    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
15}
16
17cf_type!(
18    #[encoding_name = "__CFUserNotification"]
19    unsafe impl CFUserNotification {}
20);
21
22/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfusernotificationcallback?language=objc)
23#[cfg(feature = "CFBase")]
24pub type CFUserNotificationCallBack =
25    Option<unsafe extern "C-unwind" fn(*mut CFUserNotification, CFOptionFlags)>;
26
27#[cfg(feature = "CFBase")]
28unsafe impl ConcreteType for CFUserNotification {
29    #[doc(alias = "CFUserNotificationGetTypeID")]
30    #[inline]
31    fn type_id() -> CFTypeID {
32        extern "C-unwind" {
33            fn CFUserNotificationGetTypeID() -> CFTypeID;
34        }
35        unsafe { CFUserNotificationGetTypeID() }
36    }
37}
38
39#[cfg(all(feature = "CFBase", feature = "CFDate", feature = "CFDictionary"))]
40#[inline]
41pub unsafe extern "C-unwind" fn CFUserNotificationCreate(
42    allocator: Option<&CFAllocator>,
43    timeout: CFTimeInterval,
44    flags: CFOptionFlags,
45    error: *mut i32,
46    dictionary: Option<&CFDictionary>,
47) -> Option<CFRetained<CFUserNotification>> {
48    extern "C-unwind" {
49        fn CFUserNotificationCreate(
50            allocator: Option<&CFAllocator>,
51            timeout: CFTimeInterval,
52            flags: CFOptionFlags,
53            error: *mut i32,
54            dictionary: Option<&CFDictionary>,
55        ) -> Option<NonNull<CFUserNotification>>;
56    }
57    let ret = unsafe { CFUserNotificationCreate(allocator, timeout, flags, error, dictionary) };
58    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
59}
60
61extern "C-unwind" {
62    #[cfg(all(feature = "CFBase", feature = "CFDate"))]
63    pub fn CFUserNotificationReceiveResponse(
64        user_notification: &CFUserNotification,
65        timeout: CFTimeInterval,
66        response_flags: *mut CFOptionFlags,
67    ) -> i32;
68}
69
70#[cfg(feature = "CFBase")]
71#[inline]
72pub unsafe extern "C-unwind" fn CFUserNotificationGetResponseValue(
73    user_notification: &CFUserNotification,
74    key: Option<&CFString>,
75    idx: CFIndex,
76) -> Option<CFRetained<CFString>> {
77    extern "C-unwind" {
78        fn CFUserNotificationGetResponseValue(
79            user_notification: &CFUserNotification,
80            key: Option<&CFString>,
81            idx: CFIndex,
82        ) -> Option<NonNull<CFString>>;
83    }
84    let ret = unsafe { CFUserNotificationGetResponseValue(user_notification, key, idx) };
85    ret.map(|ret| unsafe { CFRetained::retain(ret) })
86}
87
88#[cfg(feature = "CFDictionary")]
89#[inline]
90pub unsafe extern "C-unwind" fn CFUserNotificationGetResponseDictionary(
91    user_notification: &CFUserNotification,
92) -> Option<CFRetained<CFDictionary>> {
93    extern "C-unwind" {
94        fn CFUserNotificationGetResponseDictionary(
95            user_notification: &CFUserNotification,
96        ) -> Option<NonNull<CFDictionary>>;
97    }
98    let ret = unsafe { CFUserNotificationGetResponseDictionary(user_notification) };
99    ret.map(|ret| unsafe { CFRetained::retain(ret) })
100}
101
102extern "C-unwind" {
103    #[cfg(all(feature = "CFBase", feature = "CFDate", feature = "CFDictionary"))]
104    pub fn CFUserNotificationUpdate(
105        user_notification: &CFUserNotification,
106        timeout: CFTimeInterval,
107        flags: CFOptionFlags,
108        dictionary: Option<&CFDictionary>,
109    ) -> i32;
110}
111
112extern "C-unwind" {
113    pub fn CFUserNotificationCancel(user_notification: &CFUserNotification) -> i32;
114}
115
116#[cfg(all(feature = "CFBase", feature = "CFRunLoop"))]
117#[inline]
118pub unsafe extern "C-unwind" fn CFUserNotificationCreateRunLoopSource(
119    allocator: Option<&CFAllocator>,
120    user_notification: Option<&CFUserNotification>,
121    callout: CFUserNotificationCallBack,
122    order: CFIndex,
123) -> Option<CFRetained<CFRunLoopSource>> {
124    extern "C-unwind" {
125        fn CFUserNotificationCreateRunLoopSource(
126            allocator: Option<&CFAllocator>,
127            user_notification: Option<&CFUserNotification>,
128            callout: CFUserNotificationCallBack,
129            order: CFIndex,
130        ) -> Option<NonNull<CFRunLoopSource>>;
131    }
132    let ret = unsafe {
133        CFUserNotificationCreateRunLoopSource(allocator, user_notification, callout, order)
134    };
135    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
136}
137
138extern "C-unwind" {
139    #[cfg(all(feature = "CFBase", feature = "CFDate", feature = "CFURL"))]
140    pub fn CFUserNotificationDisplayNotice(
141        timeout: CFTimeInterval,
142        flags: CFOptionFlags,
143        icon_url: Option<&CFURL>,
144        sound_url: Option<&CFURL>,
145        localization_url: Option<&CFURL>,
146        alert_header: Option<&CFString>,
147        alert_message: Option<&CFString>,
148        default_button_title: Option<&CFString>,
149    ) -> i32;
150}
151
152extern "C-unwind" {
153    #[cfg(all(feature = "CFBase", feature = "CFDate", feature = "CFURL"))]
154    pub fn CFUserNotificationDisplayAlert(
155        timeout: CFTimeInterval,
156        flags: CFOptionFlags,
157        icon_url: Option<&CFURL>,
158        sound_url: Option<&CFURL>,
159        localization_url: Option<&CFURL>,
160        alert_header: Option<&CFString>,
161        alert_message: Option<&CFString>,
162        default_button_title: Option<&CFString>,
163        alternate_button_title: Option<&CFString>,
164        other_button_title: Option<&CFString>,
165        response_flags: *mut CFOptionFlags,
166    ) -> i32;
167}
168
169/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationstopalertlevel?language=objc)
170#[cfg(feature = "CFBase")]
171pub const kCFUserNotificationStopAlertLevel: CFOptionFlags = 0;
172/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationnotealertlevel?language=objc)
173#[cfg(feature = "CFBase")]
174pub const kCFUserNotificationNoteAlertLevel: CFOptionFlags = 1;
175/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationcautionalertlevel?language=objc)
176#[cfg(feature = "CFBase")]
177pub const kCFUserNotificationCautionAlertLevel: CFOptionFlags = 2;
178/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationplainalertlevel?language=objc)
179#[cfg(feature = "CFBase")]
180pub const kCFUserNotificationPlainAlertLevel: CFOptionFlags = 3;
181
182/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationdefaultresponse?language=objc)
183#[cfg(feature = "CFBase")]
184pub const kCFUserNotificationDefaultResponse: CFOptionFlags = 0;
185/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationalternateresponse?language=objc)
186#[cfg(feature = "CFBase")]
187pub const kCFUserNotificationAlternateResponse: CFOptionFlags = 1;
188/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationotherresponse?language=objc)
189#[cfg(feature = "CFBase")]
190pub const kCFUserNotificationOtherResponse: CFOptionFlags = 2;
191/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationcancelresponse?language=objc)
192#[cfg(feature = "CFBase")]
193pub const kCFUserNotificationCancelResponse: CFOptionFlags = 3;
194
195/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationnodefaultbuttonflag?language=objc)
196#[cfg(feature = "CFBase")]
197pub const kCFUserNotificationNoDefaultButtonFlag: CFOptionFlags = 1 << 5;
198/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationuseradiobuttonsflag?language=objc)
199#[cfg(feature = "CFBase")]
200pub const kCFUserNotificationUseRadioButtonsFlag: CFOptionFlags = 1 << 6;
201
202// TODO: pub fn CFUserNotificationCheckBoxChecked(i: CFIndex,) -> CFOptionFlags;
203
204// TODO: pub fn CFUserNotificationSecureTextField(i: CFIndex,) -> CFOptionFlags;
205
206// TODO: pub fn CFUserNotificationPopUpSelection(n: CFIndex,) -> CFOptionFlags;
207
208extern "C" {
209    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationiconurlkey?language=objc)
210    #[cfg(feature = "CFBase")]
211    pub static kCFUserNotificationIconURLKey: Option<&'static CFString>;
212}
213
214extern "C" {
215    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationsoundurlkey?language=objc)
216    #[cfg(feature = "CFBase")]
217    pub static kCFUserNotificationSoundURLKey: Option<&'static CFString>;
218}
219
220extern "C" {
221    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationlocalizationurlkey?language=objc)
222    #[cfg(feature = "CFBase")]
223    pub static kCFUserNotificationLocalizationURLKey: Option<&'static CFString>;
224}
225
226extern "C" {
227    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationalertheaderkey?language=objc)
228    #[cfg(feature = "CFBase")]
229    pub static kCFUserNotificationAlertHeaderKey: Option<&'static CFString>;
230}
231
232extern "C" {
233    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationalertmessagekey?language=objc)
234    #[cfg(feature = "CFBase")]
235    pub static kCFUserNotificationAlertMessageKey: Option<&'static CFString>;
236}
237
238extern "C" {
239    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationdefaultbuttontitlekey?language=objc)
240    #[cfg(feature = "CFBase")]
241    pub static kCFUserNotificationDefaultButtonTitleKey: Option<&'static CFString>;
242}
243
244extern "C" {
245    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationalternatebuttontitlekey?language=objc)
246    #[cfg(feature = "CFBase")]
247    pub static kCFUserNotificationAlternateButtonTitleKey: Option<&'static CFString>;
248}
249
250extern "C" {
251    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationotherbuttontitlekey?language=objc)
252    #[cfg(feature = "CFBase")]
253    pub static kCFUserNotificationOtherButtonTitleKey: Option<&'static CFString>;
254}
255
256extern "C" {
257    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationprogressindicatorvaluekey?language=objc)
258    #[cfg(feature = "CFBase")]
259    pub static kCFUserNotificationProgressIndicatorValueKey: Option<&'static CFString>;
260}
261
262extern "C" {
263    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationpopuptitleskey?language=objc)
264    #[cfg(feature = "CFBase")]
265    pub static kCFUserNotificationPopUpTitlesKey: Option<&'static CFString>;
266}
267
268extern "C" {
269    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationtextfieldtitleskey?language=objc)
270    #[cfg(feature = "CFBase")]
271    pub static kCFUserNotificationTextFieldTitlesKey: Option<&'static CFString>;
272}
273
274extern "C" {
275    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationcheckboxtitleskey?language=objc)
276    #[cfg(feature = "CFBase")]
277    pub static kCFUserNotificationCheckBoxTitlesKey: Option<&'static CFString>;
278}
279
280extern "C" {
281    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationtextfieldvalueskey?language=objc)
282    #[cfg(feature = "CFBase")]
283    pub static kCFUserNotificationTextFieldValuesKey: Option<&'static CFString>;
284}
285
286extern "C" {
287    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationpopupselectionkey?language=objc)
288    #[cfg(feature = "CFBase")]
289    pub static kCFUserNotificationPopUpSelectionKey: Option<&'static CFString>;
290}
291
292extern "C" {
293    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationalerttopmostkey?language=objc)
294    #[cfg(feature = "CFBase")]
295    pub static kCFUserNotificationAlertTopMostKey: Option<&'static CFString>;
296}
297
298extern "C" {
299    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfusernotificationkeyboardtypeskey?language=objc)
300    #[cfg(feature = "CFBase")]
301    pub static kCFUserNotificationKeyboardTypesKey: Option<&'static CFString>;
302}