objc2_foundation/generated/
NSUserNotification.rs

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