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 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 fn title(&self) -> Option<Retained<NSString>>;
73
74 #[cfg(feature = "NSString")]
75 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
79 #[unsafe(method(setTitle:))]
80 #[unsafe(method_family = none)]
81 pub fn setTitle(&self, title: Option<&NSString>);
82
83 #[cfg(feature = "NSString")]
84 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
85 #[unsafe(method(subtitle))]
86 #[unsafe(method_family = none)]
87 pub fn subtitle(&self) -> Option<Retained<NSString>>;
88
89 #[cfg(feature = "NSString")]
90 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
94 #[unsafe(method(setSubtitle:))]
95 #[unsafe(method_family = none)]
96 pub fn setSubtitle(&self, subtitle: Option<&NSString>);
97
98 #[cfg(feature = "NSString")]
99 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
100 #[unsafe(method(informativeText))]
101 #[unsafe(method_family = none)]
102 pub fn informativeText(&self) -> Option<Retained<NSString>>;
103
104 #[cfg(feature = "NSString")]
105 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
109 #[unsafe(method(setInformativeText:))]
110 #[unsafe(method_family = none)]
111 pub fn setInformativeText(&self, informative_text: Option<&NSString>);
112
113 #[cfg(feature = "NSString")]
114 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
115 #[unsafe(method(actionButtonTitle))]
116 #[unsafe(method_family = none)]
117 pub fn actionButtonTitle(&self) -> Retained<NSString>;
118
119 #[cfg(feature = "NSString")]
120 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
124 #[unsafe(method(setActionButtonTitle:))]
125 #[unsafe(method_family = none)]
126 pub fn setActionButtonTitle(&self, action_button_title: &NSString);
127
128 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
129 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
130 #[unsafe(method(userInfo))]
131 #[unsafe(method_family = none)]
132 pub fn userInfo(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
133
134 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
135 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
143 #[unsafe(method(setUserInfo:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary<NSString, AnyObject>>);
146
147 #[cfg(feature = "NSDate")]
148 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
149 #[unsafe(method(deliveryDate))]
150 #[unsafe(method_family = none)]
151 pub fn deliveryDate(&self) -> Option<Retained<NSDate>>;
152
153 #[cfg(feature = "NSDate")]
154 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
158 #[unsafe(method(setDeliveryDate:))]
159 #[unsafe(method_family = none)]
160 pub fn setDeliveryDate(&self, delivery_date: Option<&NSDate>);
161
162 #[cfg(feature = "NSTimeZone")]
163 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
164 #[unsafe(method(deliveryTimeZone))]
165 #[unsafe(method_family = none)]
166 pub fn deliveryTimeZone(&self) -> Option<Retained<NSTimeZone>>;
167
168 #[cfg(feature = "NSTimeZone")]
169 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
173 #[unsafe(method(setDeliveryTimeZone:))]
174 #[unsafe(method_family = none)]
175 pub fn setDeliveryTimeZone(&self, delivery_time_zone: Option<&NSTimeZone>);
176
177 #[cfg(feature = "NSCalendar")]
178 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
179 #[unsafe(method(deliveryRepeatInterval))]
180 #[unsafe(method_family = none)]
181 pub fn deliveryRepeatInterval(&self) -> Option<Retained<NSDateComponents>>;
182
183 #[cfg(feature = "NSCalendar")]
184 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
188 #[unsafe(method(setDeliveryRepeatInterval:))]
189 #[unsafe(method_family = none)]
190 pub fn setDeliveryRepeatInterval(
191 &self,
192 delivery_repeat_interval: Option<&NSDateComponents>,
193 );
194
195 #[cfg(feature = "NSDate")]
196 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
197 #[unsafe(method(actualDeliveryDate))]
198 #[unsafe(method_family = none)]
199 pub fn actualDeliveryDate(&self) -> Option<Retained<NSDate>>;
200
201 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
202 #[unsafe(method(isPresented))]
203 #[unsafe(method_family = none)]
204 pub fn isPresented(&self) -> bool;
205
206 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
207 #[unsafe(method(isRemote))]
208 #[unsafe(method_family = none)]
209 pub fn isRemote(&self) -> bool;
210
211 #[cfg(feature = "NSString")]
212 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
213 #[unsafe(method(soundName))]
214 #[unsafe(method_family = none)]
215 pub fn soundName(&self) -> Option<Retained<NSString>>;
216
217 #[cfg(feature = "NSString")]
218 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
222 #[unsafe(method(setSoundName:))]
223 #[unsafe(method_family = none)]
224 pub fn setSoundName(&self, sound_name: Option<&NSString>);
225
226 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
227 #[unsafe(method(hasActionButton))]
228 #[unsafe(method_family = none)]
229 pub fn hasActionButton(&self) -> bool;
230
231 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
233 #[unsafe(method(setHasActionButton:))]
234 #[unsafe(method_family = none)]
235 pub fn setHasActionButton(&self, has_action_button: bool);
236
237 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
238 #[unsafe(method(activationType))]
239 #[unsafe(method_family = none)]
240 pub fn activationType(&self) -> NSUserNotificationActivationType;
241
242 #[cfg(feature = "NSString")]
243 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
244 #[unsafe(method(otherButtonTitle))]
245 #[unsafe(method_family = none)]
246 pub fn otherButtonTitle(&self) -> Retained<NSString>;
247
248 #[cfg(feature = "NSString")]
249 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
253 #[unsafe(method(setOtherButtonTitle:))]
254 #[unsafe(method_family = none)]
255 pub fn setOtherButtonTitle(&self, other_button_title: &NSString);
256
257 #[cfg(feature = "NSString")]
258 #[unsafe(method(identifier))]
259 #[unsafe(method_family = none)]
260 pub fn identifier(&self) -> Option<Retained<NSString>>;
261
262 #[cfg(feature = "NSString")]
263 #[unsafe(method(setIdentifier:))]
267 #[unsafe(method_family = none)]
268 pub fn setIdentifier(&self, identifier: Option<&NSString>);
269
270 #[unsafe(method(hasReplyButton))]
271 #[unsafe(method_family = none)]
272 pub fn hasReplyButton(&self) -> bool;
273
274 #[unsafe(method(setHasReplyButton:))]
276 #[unsafe(method_family = none)]
277 pub fn setHasReplyButton(&self, has_reply_button: bool);
278
279 #[cfg(feature = "NSString")]
280 #[unsafe(method(responsePlaceholder))]
281 #[unsafe(method_family = none)]
282 pub fn responsePlaceholder(&self) -> Option<Retained<NSString>>;
283
284 #[cfg(feature = "NSString")]
285 #[unsafe(method(setResponsePlaceholder:))]
289 #[unsafe(method_family = none)]
290 pub fn setResponsePlaceholder(&self, response_placeholder: Option<&NSString>);
291
292 #[cfg(feature = "NSAttributedString")]
293 #[unsafe(method(response))]
294 #[unsafe(method_family = none)]
295 pub fn response(&self) -> Option<Retained<NSAttributedString>>;
296
297 #[cfg(feature = "NSArray")]
298 #[unsafe(method(additionalActions))]
299 #[unsafe(method_family = none)]
300 pub fn additionalActions(&self) -> Option<Retained<NSArray<NSUserNotificationAction>>>;
301
302 #[cfg(feature = "NSArray")]
303 #[unsafe(method(setAdditionalActions:))]
307 #[unsafe(method_family = none)]
308 pub fn setAdditionalActions(
309 &self,
310 additional_actions: Option<&NSArray<NSUserNotificationAction>>,
311 );
312
313 #[unsafe(method(additionalActivationAction))]
314 #[unsafe(method_family = none)]
315 pub fn additionalActivationAction(&self) -> Option<Retained<NSUserNotificationAction>>;
316 );
317}
318
319impl NSUserNotification {
321 extern_methods!(
322 #[unsafe(method(new))]
323 #[unsafe(method_family = new)]
324 pub fn new() -> Retained<Self>;
325 );
326}
327
328impl DefaultRetained for NSUserNotification {
329 #[inline]
330 fn default_retained() -> Retained<Self> {
331 Self::new()
332 }
333}
334
335extern_class!(
336 #[unsafe(super(NSObject))]
338 #[derive(Debug, PartialEq, Eq, Hash)]
339 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
340 pub struct NSUserNotificationAction;
341);
342
343#[cfg(feature = "NSObject")]
344extern_conformance!(
345 unsafe impl NSCopying for NSUserNotificationAction {}
346);
347
348#[cfg(feature = "NSObject")]
349unsafe impl CopyingHelper for NSUserNotificationAction {
350 type Result = Self;
351}
352
353extern_conformance!(
354 unsafe impl NSObjectProtocol for NSUserNotificationAction {}
355);
356
357impl NSUserNotificationAction {
358 extern_methods!(
359 #[cfg(feature = "NSString")]
360 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
361 #[unsafe(method(actionWithIdentifier:title:))]
362 #[unsafe(method_family = none)]
363 pub fn actionWithIdentifier_title(
364 identifier: Option<&NSString>,
365 title: Option<&NSString>,
366 ) -> Retained<Self>;
367
368 #[cfg(feature = "NSString")]
369 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
370 #[unsafe(method(identifier))]
371 #[unsafe(method_family = none)]
372 pub fn identifier(&self) -> Option<Retained<NSString>>;
373
374 #[cfg(feature = "NSString")]
375 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
376 #[unsafe(method(title))]
377 #[unsafe(method_family = none)]
378 pub fn title(&self) -> Option<Retained<NSString>>;
379 );
380}
381
382impl NSUserNotificationAction {
384 extern_methods!(
385 #[unsafe(method(init))]
386 #[unsafe(method_family = init)]
387 pub fn init(this: Allocated<Self>) -> Retained<Self>;
388
389 #[unsafe(method(new))]
390 #[unsafe(method_family = new)]
391 pub fn new() -> Retained<Self>;
392 );
393}
394
395impl DefaultRetained for NSUserNotificationAction {
396 #[inline]
397 fn default_retained() -> Retained<Self> {
398 Self::new()
399 }
400}
401
402extern "C" {
403 #[cfg(feature = "NSString")]
405 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
406 pub static NSUserNotificationDefaultSoundName: &'static NSString;
407}
408
409extern_class!(
410 #[unsafe(super(NSObject))]
412 #[derive(Debug, PartialEq, Eq, Hash)]
413 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
414 pub struct NSUserNotificationCenter;
415);
416
417extern_conformance!(
418 unsafe impl NSObjectProtocol for NSUserNotificationCenter {}
419);
420
421impl NSUserNotificationCenter {
422 extern_methods!(
423 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
424 #[unsafe(method(defaultUserNotificationCenter))]
425 #[unsafe(method_family = none)]
426 pub fn defaultUserNotificationCenter() -> Retained<NSUserNotificationCenter>;
427
428 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
432 #[unsafe(method(delegate))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn delegate(
435 &self,
436 ) -> Option<Retained<ProtocolObject<dyn NSUserNotificationCenterDelegate>>>;
437
438 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
444 #[unsafe(method(setDelegate:))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn setDelegate(
447 &self,
448 delegate: Option<&ProtocolObject<dyn NSUserNotificationCenterDelegate>>,
449 );
450
451 #[cfg(feature = "NSArray")]
452 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
453 #[unsafe(method(scheduledNotifications))]
454 #[unsafe(method_family = none)]
455 pub fn scheduledNotifications(&self) -> Retained<NSArray<NSUserNotification>>;
456
457 #[cfg(feature = "NSArray")]
458 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
462 #[unsafe(method(setScheduledNotifications:))]
463 #[unsafe(method_family = none)]
464 pub fn setScheduledNotifications(
465 &self,
466 scheduled_notifications: &NSArray<NSUserNotification>,
467 );
468
469 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
470 #[unsafe(method(scheduleNotification:))]
471 #[unsafe(method_family = none)]
472 pub fn scheduleNotification(&self, notification: &NSUserNotification);
473
474 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
475 #[unsafe(method(removeScheduledNotification:))]
476 #[unsafe(method_family = none)]
477 pub fn removeScheduledNotification(&self, notification: &NSUserNotification);
478
479 #[cfg(feature = "NSArray")]
480 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
481 #[unsafe(method(deliveredNotifications))]
482 #[unsafe(method_family = none)]
483 pub fn deliveredNotifications(&self) -> Retained<NSArray<NSUserNotification>>;
484
485 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
486 #[unsafe(method(deliverNotification:))]
487 #[unsafe(method_family = none)]
488 pub fn deliverNotification(&self, notification: &NSUserNotification);
489
490 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
491 #[unsafe(method(removeDeliveredNotification:))]
492 #[unsafe(method_family = none)]
493 pub fn removeDeliveredNotification(&self, notification: &NSUserNotification);
494
495 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
496 #[unsafe(method(removeAllDeliveredNotifications))]
497 #[unsafe(method_family = none)]
498 pub fn removeAllDeliveredNotifications(&self);
499 );
500}
501
502impl NSUserNotificationCenter {
504 extern_methods!(
505 #[unsafe(method(init))]
506 #[unsafe(method_family = init)]
507 pub fn init(this: Allocated<Self>) -> Retained<Self>;
508
509 #[unsafe(method(new))]
510 #[unsafe(method_family = new)]
511 pub fn new() -> Retained<Self>;
512 );
513}
514
515impl DefaultRetained for NSUserNotificationCenter {
516 #[inline]
517 fn default_retained() -> Retained<Self> {
518 Self::new()
519 }
520}
521
522extern_protocol!(
523 pub unsafe trait NSUserNotificationCenterDelegate: NSObjectProtocol {
525 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
526 #[optional]
527 #[unsafe(method(userNotificationCenter:didDeliverNotification:))]
528 #[unsafe(method_family = none)]
529 fn userNotificationCenter_didDeliverNotification(
530 &self,
531 center: &NSUserNotificationCenter,
532 notification: &NSUserNotification,
533 );
534
535 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
536 #[optional]
537 #[unsafe(method(userNotificationCenter:didActivateNotification:))]
538 #[unsafe(method_family = none)]
539 fn userNotificationCenter_didActivateNotification(
540 &self,
541 center: &NSUserNotificationCenter,
542 notification: &NSUserNotification,
543 );
544
545 #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
546 #[optional]
547 #[unsafe(method(userNotificationCenter:shouldPresentNotification:))]
548 #[unsafe(method_family = none)]
549 fn userNotificationCenter_shouldPresentNotification(
550 &self,
551 center: &NSUserNotificationCenter,
552 notification: &NSUserNotification,
553 ) -> bool;
554 }
555);