objc2_foundation/generated/
NSUserNotification.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSUserNotificationActivationType(pub NSInteger);
15impl NSUserNotificationActivationType {
16 #[doc(alias = "NSUserNotificationActivationTypeNone")]
17 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
18 pub const None: Self = Self(0);
19 #[doc(alias = "NSUserNotificationActivationTypeContentsClicked")]
20 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
21 pub const ContentsClicked: Self = Self(1);
22 #[doc(alias = "NSUserNotificationActivationTypeActionButtonClicked")]
23 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
24 pub const ActionButtonClicked: Self = Self(2);
25 #[doc(alias = "NSUserNotificationActivationTypeReplied")]
26 pub const Replied: Self = Self(3);
27 #[doc(alias = "NSUserNotificationActivationTypeAdditionalActionClicked")]
28 pub const AdditionalActionClicked: Self = Self(4);
29}
30
31unsafe impl Encode for NSUserNotificationActivationType {
32 const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for NSUserNotificationActivationType {
36 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40 #[unsafe(super(NSObject))]
42 #[derive(Debug, PartialEq, Eq, Hash)]
43 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
44 pub struct NSUserNotification;
45);
46
47#[cfg(feature = "NSObject")]
48extern_conformance!(
49 unsafe impl NSCopying for NSUserNotification {}
50);
51
52#[cfg(feature = "NSObject")]
53unsafe impl CopyingHelper for NSUserNotification {
54 type Result = Self;
55}
56
57extern_conformance!(
58 unsafe impl NSObjectProtocol for NSUserNotification {}
59);
60
61impl NSUserNotification {
62 extern_methods!(
63 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
64 #[unsafe(method(init))]
65 #[unsafe(method_family = init)]
66 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
67
68 #[cfg(feature = "NSString")]
69 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
70 #[unsafe(method(title))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
73
74 #[cfg(feature = "NSString")]
75 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
77 #[unsafe(method(setTitle:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn setTitle(&self, title: Option<&NSString>);
80
81 #[cfg(feature = "NSString")]
82 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
83 #[unsafe(method(subtitle))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
86
87 #[cfg(feature = "NSString")]
88 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
90 #[unsafe(method(setSubtitle:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
93
94 #[cfg(feature = "NSString")]
95 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
96 #[unsafe(method(informativeText))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
99
100 #[cfg(feature = "NSString")]
101 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
103 #[unsafe(method(setInformativeText:))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
106
107 #[cfg(feature = "NSString")]
108 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
109 #[unsafe(method(actionButtonTitle))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn actionButtonTitle(&self) -> Retained<NSString>;
112
113 #[cfg(feature = "NSString")]
114 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
116 #[unsafe(method(setActionButtonTitle:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setActionButtonTitle(&self, action_button_title: &NSString);
119
120 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
121 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
122 #[unsafe(method(userInfo))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn userInfo(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
125
126 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
127 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
129 #[unsafe(method(setUserInfo:))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary<NSString, AnyObject>>);
132
133 #[cfg(feature = "NSDate")]
134 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
135 #[unsafe(method(deliveryDate))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn deliveryDate(&self) -> Option<Retained<NSDate>>;
138
139 #[cfg(feature = "NSDate")]
140 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
142 #[unsafe(method(setDeliveryDate:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn setDeliveryDate(&self, delivery_date: Option<&NSDate>);
145
146 #[cfg(feature = "NSTimeZone")]
147 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
148 #[unsafe(method(deliveryTimeZone))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn deliveryTimeZone(&self) -> Option<Retained<NSTimeZone>>;
151
152 #[cfg(feature = "NSTimeZone")]
153 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
155 #[unsafe(method(setDeliveryTimeZone:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setDeliveryTimeZone(&self, delivery_time_zone: Option<&NSTimeZone>);
158
159 #[cfg(feature = "NSCalendar")]
160 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
161 #[unsafe(method(deliveryRepeatInterval))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn deliveryRepeatInterval(&self) -> Option<Retained<NSDateComponents>>;
164
165 #[cfg(feature = "NSCalendar")]
166 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
168 #[unsafe(method(setDeliveryRepeatInterval:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setDeliveryRepeatInterval(
171 &self,
172 delivery_repeat_interval: Option<&NSDateComponents>,
173 );
174
175 #[cfg(feature = "NSDate")]
176 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
177 #[unsafe(method(actualDeliveryDate))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn actualDeliveryDate(&self) -> Option<Retained<NSDate>>;
180
181 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
182 #[unsafe(method(isPresented))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn isPresented(&self) -> bool;
185
186 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
187 #[unsafe(method(isRemote))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn isRemote(&self) -> bool;
190
191 #[cfg(feature = "NSString")]
192 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
193 #[unsafe(method(soundName))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn soundName(&self) -> Option<Retained<NSString>>;
196
197 #[cfg(feature = "NSString")]
198 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
200 #[unsafe(method(setSoundName:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn setSoundName(&self, sound_name: Option<&NSString>);
203
204 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
205 #[unsafe(method(hasActionButton))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn hasActionButton(&self) -> bool;
208
209 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
211 #[unsafe(method(setHasActionButton:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn setHasActionButton(&self, has_action_button: bool);
214
215 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
216 #[unsafe(method(activationType))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn activationType(&self) -> NSUserNotificationActivationType;
219
220 #[cfg(feature = "NSString")]
221 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
222 #[unsafe(method(otherButtonTitle))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn otherButtonTitle(&self) -> Retained<NSString>;
225
226 #[cfg(feature = "NSString")]
227 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
229 #[unsafe(method(setOtherButtonTitle:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn setOtherButtonTitle(&self, other_button_title: &NSString);
232
233 #[cfg(feature = "NSString")]
234 #[unsafe(method(identifier))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
237
238 #[cfg(feature = "NSString")]
239 #[unsafe(method(setIdentifier:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
243
244 #[unsafe(method(hasReplyButton))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn hasReplyButton(&self) -> bool;
247
248 #[unsafe(method(setHasReplyButton:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setHasReplyButton(&self, has_reply_button: bool);
252
253 #[cfg(feature = "NSString")]
254 #[unsafe(method(responsePlaceholder))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn responsePlaceholder(&self) -> Option<Retained<NSString>>;
257
258 #[cfg(feature = "NSString")]
259 #[unsafe(method(setResponsePlaceholder:))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn setResponsePlaceholder(&self, response_placeholder: Option<&NSString>);
263
264 #[cfg(feature = "NSAttributedString")]
265 #[unsafe(method(response))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn response(&self) -> Option<Retained<NSAttributedString>>;
268
269 #[cfg(feature = "NSArray")]
270 #[unsafe(method(additionalActions))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn additionalActions(
273 &self,
274 ) -> Option<Retained<NSArray<NSUserNotificationAction>>>;
275
276 #[cfg(feature = "NSArray")]
277 #[unsafe(method(setAdditionalActions:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn setAdditionalActions(
281 &self,
282 additional_actions: Option<&NSArray<NSUserNotificationAction>>,
283 );
284
285 #[unsafe(method(additionalActivationAction))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn additionalActivationAction(
288 &self,
289 ) -> Option<Retained<NSUserNotificationAction>>;
290 );
291}
292
293impl NSUserNotification {
295 extern_methods!(
296 #[unsafe(method(new))]
297 #[unsafe(method_family = new)]
298 pub unsafe fn new() -> Retained<Self>;
299 );
300}
301
302extern_class!(
303 #[unsafe(super(NSObject))]
305 #[derive(Debug, PartialEq, Eq, Hash)]
306 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
307 pub struct NSUserNotificationAction;
308);
309
310#[cfg(feature = "NSObject")]
311extern_conformance!(
312 unsafe impl NSCopying for NSUserNotificationAction {}
313);
314
315#[cfg(feature = "NSObject")]
316unsafe impl CopyingHelper for NSUserNotificationAction {
317 type Result = Self;
318}
319
320extern_conformance!(
321 unsafe impl NSObjectProtocol for NSUserNotificationAction {}
322);
323
324impl NSUserNotificationAction {
325 extern_methods!(
326 #[cfg(feature = "NSString")]
327 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
328 #[unsafe(method(actionWithIdentifier:title:))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn actionWithIdentifier_title(
331 identifier: Option<&NSString>,
332 title: Option<&NSString>,
333 ) -> Retained<Self>;
334
335 #[cfg(feature = "NSString")]
336 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
337 #[unsafe(method(identifier))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
340
341 #[cfg(feature = "NSString")]
342 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
343 #[unsafe(method(title))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
346 );
347}
348
349impl NSUserNotificationAction {
351 extern_methods!(
352 #[unsafe(method(init))]
353 #[unsafe(method_family = init)]
354 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
355
356 #[unsafe(method(new))]
357 #[unsafe(method_family = new)]
358 pub unsafe fn new() -> Retained<Self>;
359 );
360}
361
362extern "C" {
363 #[cfg(feature = "NSString")]
365 pub static NSUserNotificationDefaultSoundName: &'static NSString;
366}
367
368extern_class!(
369 #[unsafe(super(NSObject))]
371 #[derive(Debug, PartialEq, Eq, Hash)]
372 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
373 pub struct NSUserNotificationCenter;
374);
375
376extern_conformance!(
377 unsafe impl NSObjectProtocol for NSUserNotificationCenter {}
378);
379
380impl NSUserNotificationCenter {
381 extern_methods!(
382 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
383 #[unsafe(method(defaultUserNotificationCenter))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn defaultUserNotificationCenter() -> Retained<NSUserNotificationCenter>;
386
387 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
388 #[unsafe(method(delegate))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn delegate(
391 &self,
392 ) -> Option<Retained<ProtocolObject<dyn NSUserNotificationCenterDelegate>>>;
393
394 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
396 #[unsafe(method(setDelegate:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn setDelegate(
399 &self,
400 delegate: Option<&ProtocolObject<dyn NSUserNotificationCenterDelegate>>,
401 );
402
403 #[cfg(feature = "NSArray")]
404 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
405 #[unsafe(method(scheduledNotifications))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn scheduledNotifications(&self) -> Retained<NSArray<NSUserNotification>>;
408
409 #[cfg(feature = "NSArray")]
410 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
412 #[unsafe(method(setScheduledNotifications:))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn setScheduledNotifications(
415 &self,
416 scheduled_notifications: &NSArray<NSUserNotification>,
417 );
418
419 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
420 #[unsafe(method(scheduleNotification:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn scheduleNotification(&self, notification: &NSUserNotification);
423
424 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
425 #[unsafe(method(removeScheduledNotification:))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn removeScheduledNotification(&self, notification: &NSUserNotification);
428
429 #[cfg(feature = "NSArray")]
430 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
431 #[unsafe(method(deliveredNotifications))]
432 #[unsafe(method_family = none)]
433 pub unsafe fn deliveredNotifications(&self) -> Retained<NSArray<NSUserNotification>>;
434
435 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
436 #[unsafe(method(deliverNotification:))]
437 #[unsafe(method_family = none)]
438 pub unsafe fn deliverNotification(&self, notification: &NSUserNotification);
439
440 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
441 #[unsafe(method(removeDeliveredNotification:))]
442 #[unsafe(method_family = none)]
443 pub unsafe fn removeDeliveredNotification(&self, notification: &NSUserNotification);
444
445 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
446 #[unsafe(method(removeAllDeliveredNotifications))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn removeAllDeliveredNotifications(&self);
449 );
450}
451
452impl NSUserNotificationCenter {
454 extern_methods!(
455 #[unsafe(method(init))]
456 #[unsafe(method_family = init)]
457 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
458
459 #[unsafe(method(new))]
460 #[unsafe(method_family = new)]
461 pub unsafe fn new() -> Retained<Self>;
462 );
463}
464
465extern_protocol!(
466 pub unsafe trait NSUserNotificationCenterDelegate: NSObjectProtocol {
468 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
469 #[optional]
470 #[unsafe(method(userNotificationCenter:didDeliverNotification:))]
471 #[unsafe(method_family = none)]
472 unsafe fn userNotificationCenter_didDeliverNotification(
473 &self,
474 center: &NSUserNotificationCenter,
475 notification: &NSUserNotification,
476 );
477
478 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
479 #[optional]
480 #[unsafe(method(userNotificationCenter:didActivateNotification:))]
481 #[unsafe(method_family = none)]
482 unsafe fn userNotificationCenter_didActivateNotification(
483 &self,
484 center: &NSUserNotificationCenter,
485 notification: &NSUserNotification,
486 );
487
488 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
489 #[optional]
490 #[unsafe(method(userNotificationCenter:shouldPresentNotification:))]
491 #[unsafe(method_family = none)]
492 unsafe fn userNotificationCenter_shouldPresentNotification(
493 &self,
494 center: &NSUserNotificationCenter,
495 notification: &NSUserNotification,
496 ) -> bool;
497 }
498);