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
44extern_conformance!(
45    unsafe impl NSCoding for NSSharingCollaborationModeRestriction {}
46);
47
48extern_conformance!(
49    unsafe impl NSCopying for NSSharingCollaborationModeRestriction {}
50);
51
52unsafe impl CopyingHelper for NSSharingCollaborationModeRestriction {
53    type Result = Self;
54}
55
56extern_conformance!(
57    unsafe impl NSObjectProtocol for NSSharingCollaborationModeRestriction {}
58);
59
60extern_conformance!(
61    unsafe impl NSSecureCoding for NSSharingCollaborationModeRestriction {}
62);
63
64impl NSSharingCollaborationModeRestriction {
65    extern_methods!(
66        /// The type of sharing which should be disabled
67        #[unsafe(method(disabledMode))]
68        #[unsafe(method_family = none)]
69        pub fn disabledMode(&self) -> NSSharingCollaborationMode;
70
71        /// The title of the alert if a reason for disabling is provided
72        #[unsafe(method(alertTitle))]
73        #[unsafe(method_family = none)]
74        pub fn alertTitle(&self) -> Option<Retained<NSString>>;
75
76        /// The message of the alert if a reason for disabling is provided
77        #[unsafe(method(alertMessage))]
78        #[unsafe(method_family = none)]
79        pub fn alertMessage(&self) -> Option<Retained<NSString>>;
80
81        /// The label on the alert button which will simply confirm that the alert was viewed and dismiss it
82        /// Defaults to "OK"
83        #[unsafe(method(alertDismissButtonTitle))]
84        #[unsafe(method_family = none)]
85        pub fn alertDismissButtonTitle(&self) -> Option<Retained<NSString>>;
86
87        /// The label on the recovery suggestion button if it is provided
88        #[unsafe(method(alertRecoverySuggestionButtonTitle))]
89        #[unsafe(method_family = none)]
90        pub fn alertRecoverySuggestionButtonTitle(&self) -> Option<Retained<NSString>>;
91
92        /// The URL that is opened when the user selects the recovery suggestion, if any
93        #[unsafe(method(alertRecoverySuggestionButtonLaunchURL))]
94        #[unsafe(method_family = none)]
95        pub fn alertRecoverySuggestionButtonLaunchURL(&self) -> Option<Retained<NSURL>>;
96
97        /// - Parameters:
98        /// - disabledMode: The disabled type of sharing
99        #[unsafe(method(initWithDisabledMode:))]
100        #[unsafe(method_family = init)]
101        pub fn initWithDisabledMode(
102            this: Allocated<Self>,
103            disabled_mode: NSSharingCollaborationMode,
104        ) -> Retained<Self>;
105
106        /// - Parameters:
107        /// - disabledMode: The disabled type of sharing
108        /// - alertTitle: The alert title
109        /// - alertMessage: The alert message
110        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:))]
111        #[unsafe(method_family = init)]
112        pub fn initWithDisabledMode_alertTitle_alertMessage(
113            this: Allocated<Self>,
114            disabled_mode: NSSharingCollaborationMode,
115            alert_title: &NSString,
116            alert_message: &NSString,
117        ) -> Retained<Self>;
118
119        /// - Parameters:
120        /// - disabledMode: The disabled type of sharing
121        /// - alertTitle: The alert title
122        /// - alertMessage: The alert message
123        /// - alertDismissButtonTitle: The label on the default alert button
124        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:))]
125        #[unsafe(method_family = init)]
126        pub fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle(
127            this: Allocated<Self>,
128            disabled_mode: NSSharingCollaborationMode,
129            alert_title: &NSString,
130            alert_message: &NSString,
131            alert_dismiss_button_title: &NSString,
132        ) -> Retained<Self>;
133
134        /// - Parameters:
135        /// - disabledMode: The disabled type of sharing
136        /// - alertTitle: The alert title
137        /// - alertMessage: The alert message
138        /// - alertDismissButtonTitle: The label on the default alert button
139        /// - alertRecoverySuggestionButtonTitle: The label on the optional recovery suggestion button on the alert
140        /// - alertRecoverySuggestionButtonLaunchURL: The URL that is opened when the optional recovery suggestion button is selected
141        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:alertRecoverySuggestionButtonTitle:alertRecoverySuggestionButtonLaunchURL:))]
142        #[unsafe(method_family = init)]
143        pub fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle_alertRecoverySuggestionButtonTitle_alertRecoverySuggestionButtonLaunchURL(
144            this: Allocated<Self>,
145            disabled_mode: NSSharingCollaborationMode,
146            alert_title: &NSString,
147            alert_message: &NSString,
148            alert_dismiss_button_title: &NSString,
149            alert_recovery_suggestion_button_title: &NSString,
150            alert_recovery_suggestion_button_launch_url: &NSURL,
151        ) -> Retained<Self>;
152
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new() -> Retained<Self>;
160    );
161}