objc2_app_kit/generated/
NSSharingCollaborationModeRestriction.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// Represents the types of sharing (collaborating on an item vs. sending a copy of the item)
10/// The share picker supports up to two modes, each of which corresponds to one of these types
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingcollaborationmode?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSSharingCollaborationMode(pub NSInteger);
17impl NSSharingCollaborationMode {
18    #[doc(alias = "NSSharingCollaborationModeSendCopy")]
19    pub const SendCopy: Self = Self(0);
20    #[doc(alias = "NSSharingCollaborationModeCollaborate")]
21    pub const Collaborate: Self = Self(1);
22}
23
24unsafe impl Encode for NSSharingCollaborationMode {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSSharingCollaborationMode {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// Specifies whether a specific type of sharing should be disabled in the share picker, and if so, whether a reason should be provided for the disablement
34    /// If a reason is provided, the corresponding mode will show up as an option, but an alert explaining why it is disabled will show if it is chosen, and the mode will switch back to the supported one
35    /// Optionally, an extra alert button can be provided for a "recovery suggestion". This can give a user a way to fix whatever is causing this type of sharing to be disabled
36    /// If no reason is provided, the corresponding mode will not show up as an option
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingcollaborationmoderestriction?language=objc)
39    #[unsafe(super(NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct NSSharingCollaborationModeRestriction;
42);
43
44unsafe impl NSCoding for NSSharingCollaborationModeRestriction {}
45
46unsafe impl NSCopying for NSSharingCollaborationModeRestriction {}
47
48unsafe impl CopyingHelper for NSSharingCollaborationModeRestriction {
49    type Result = Self;
50}
51
52unsafe impl NSObjectProtocol for NSSharingCollaborationModeRestriction {}
53
54unsafe impl NSSecureCoding for NSSharingCollaborationModeRestriction {}
55
56impl NSSharingCollaborationModeRestriction {
57    extern_methods!(
58        /// The type of sharing which should be disabled
59        #[unsafe(method(disabledMode))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn disabledMode(&self) -> NSSharingCollaborationMode;
62
63        /// The title of the alert if a reason for disabling is provided
64        #[unsafe(method(alertTitle))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn alertTitle(&self) -> Option<Retained<NSString>>;
67
68        /// The message of the alert if a reason for disabling is provided
69        #[unsafe(method(alertMessage))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn alertMessage(&self) -> Option<Retained<NSString>>;
72
73        /// The label on the alert button which will simply confirm that the alert was viewed and dismiss it
74        /// Defaults to "OK"
75        #[unsafe(method(alertDismissButtonTitle))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn alertDismissButtonTitle(&self) -> Option<Retained<NSString>>;
78
79        /// The label on the recovery suggestion button if it is provided
80        #[unsafe(method(alertRecoverySuggestionButtonTitle))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn alertRecoverySuggestionButtonTitle(&self) -> Option<Retained<NSString>>;
83
84        /// The URL that is opened when the user selects the recovery suggestion, if any
85        #[unsafe(method(alertRecoverySuggestionButtonLaunchURL))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn alertRecoverySuggestionButtonLaunchURL(&self) -> Option<Retained<NSURL>>;
88
89        /// - Parameters:
90        /// - disabledMode: The disabled type of sharing
91        #[unsafe(method(initWithDisabledMode:))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn initWithDisabledMode(
94            this: Allocated<Self>,
95            disabled_mode: NSSharingCollaborationMode,
96        ) -> Retained<Self>;
97
98        /// - Parameters:
99        /// - disabledMode: The disabled type of sharing
100        /// - alertTitle: The alert title
101        /// - alertMessage: The alert message
102        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage(
105            this: Allocated<Self>,
106            disabled_mode: NSSharingCollaborationMode,
107            alert_title: &NSString,
108            alert_message: &NSString,
109        ) -> Retained<Self>;
110
111        /// - Parameters:
112        /// - disabledMode: The disabled type of sharing
113        /// - alertTitle: The alert title
114        /// - alertMessage: The alert message
115        /// - alertDismissButtonTitle: The label on the default alert button
116        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:))]
117        #[unsafe(method_family = init)]
118        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle(
119            this: Allocated<Self>,
120            disabled_mode: NSSharingCollaborationMode,
121            alert_title: &NSString,
122            alert_message: &NSString,
123            alert_dismiss_button_title: &NSString,
124        ) -> Retained<Self>;
125
126        /// - Parameters:
127        /// - disabledMode: The disabled type of sharing
128        /// - alertTitle: The alert title
129        /// - alertMessage: The alert message
130        /// - alertDismissButtonTitle: The label on the default alert button
131        /// - alertRecoverySuggestionButtonTitle: The label on the optional recovery suggestion button on the alert
132        /// - alertRecoverySuggestionButtonLaunchURL: The URL that is opened when the optional recovery suggestion button is selected
133        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:alertRecoverySuggestionButtonTitle:alertRecoverySuggestionButtonLaunchURL:))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle_alertRecoverySuggestionButtonTitle_alertRecoverySuggestionButtonLaunchURL(
136            this: Allocated<Self>,
137            disabled_mode: NSSharingCollaborationMode,
138            alert_title: &NSString,
139            alert_message: &NSString,
140            alert_dismiss_button_title: &NSString,
141            alert_recovery_suggestion_button_title: &NSString,
142            alert_recovery_suggestion_button_launch_url: &NSURL,
143        ) -> Retained<Self>;
144
145        #[unsafe(method(init))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149        #[unsafe(method(new))]
150        #[unsafe(method_family = new)]
151        pub unsafe fn new() -> Retained<Self>;
152    );
153}