objc2_core_foundation/generated/
CFUserNotification.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7
8use crate::*;
9
10#[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#[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#[cfg(feature = "CFBase")]
171pub const kCFUserNotificationStopAlertLevel: CFOptionFlags = 0;
172#[cfg(feature = "CFBase")]
174pub const kCFUserNotificationNoteAlertLevel: CFOptionFlags = 1;
175#[cfg(feature = "CFBase")]
177pub const kCFUserNotificationCautionAlertLevel: CFOptionFlags = 2;
178#[cfg(feature = "CFBase")]
180pub const kCFUserNotificationPlainAlertLevel: CFOptionFlags = 3;
181
182#[cfg(feature = "CFBase")]
184pub const kCFUserNotificationDefaultResponse: CFOptionFlags = 0;
185#[cfg(feature = "CFBase")]
187pub const kCFUserNotificationAlternateResponse: CFOptionFlags = 1;
188#[cfg(feature = "CFBase")]
190pub const kCFUserNotificationOtherResponse: CFOptionFlags = 2;
191#[cfg(feature = "CFBase")]
193pub const kCFUserNotificationCancelResponse: CFOptionFlags = 3;
194
195#[cfg(feature = "CFBase")]
197pub const kCFUserNotificationNoDefaultButtonFlag: CFOptionFlags = 1 << 5;
198#[cfg(feature = "CFBase")]
200pub const kCFUserNotificationUseRadioButtonsFlag: CFOptionFlags = 1 << 6;
201
202extern "C" {
209 #[cfg(feature = "CFBase")]
211 pub static kCFUserNotificationIconURLKey: Option<&'static CFString>;
212}
213
214extern "C" {
215 #[cfg(feature = "CFBase")]
217 pub static kCFUserNotificationSoundURLKey: Option<&'static CFString>;
218}
219
220extern "C" {
221 #[cfg(feature = "CFBase")]
223 pub static kCFUserNotificationLocalizationURLKey: Option<&'static CFString>;
224}
225
226extern "C" {
227 #[cfg(feature = "CFBase")]
229 pub static kCFUserNotificationAlertHeaderKey: Option<&'static CFString>;
230}
231
232extern "C" {
233 #[cfg(feature = "CFBase")]
235 pub static kCFUserNotificationAlertMessageKey: Option<&'static CFString>;
236}
237
238extern "C" {
239 #[cfg(feature = "CFBase")]
241 pub static kCFUserNotificationDefaultButtonTitleKey: Option<&'static CFString>;
242}
243
244extern "C" {
245 #[cfg(feature = "CFBase")]
247 pub static kCFUserNotificationAlternateButtonTitleKey: Option<&'static CFString>;
248}
249
250extern "C" {
251 #[cfg(feature = "CFBase")]
253 pub static kCFUserNotificationOtherButtonTitleKey: Option<&'static CFString>;
254}
255
256extern "C" {
257 #[cfg(feature = "CFBase")]
259 pub static kCFUserNotificationProgressIndicatorValueKey: Option<&'static CFString>;
260}
261
262extern "C" {
263 #[cfg(feature = "CFBase")]
265 pub static kCFUserNotificationPopUpTitlesKey: Option<&'static CFString>;
266}
267
268extern "C" {
269 #[cfg(feature = "CFBase")]
271 pub static kCFUserNotificationTextFieldTitlesKey: Option<&'static CFString>;
272}
273
274extern "C" {
275 #[cfg(feature = "CFBase")]
277 pub static kCFUserNotificationCheckBoxTitlesKey: Option<&'static CFString>;
278}
279
280extern "C" {
281 #[cfg(feature = "CFBase")]
283 pub static kCFUserNotificationTextFieldValuesKey: Option<&'static CFString>;
284}
285
286extern "C" {
287 #[cfg(feature = "CFBase")]
289 pub static kCFUserNotificationPopUpSelectionKey: Option<&'static CFString>;
290}
291
292extern "C" {
293 #[cfg(feature = "CFBase")]
295 pub static kCFUserNotificationAlertTopMostKey: Option<&'static CFString>;
296}
297
298extern "C" {
299 #[cfg(feature = "CFBase")]
301 pub static kCFUserNotificationKeyboardTypesKey: Option<&'static CFString>;
302}