objc2_app_kit/generated/
NSUserDefaultsController.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuserdefaultscontroller?language=objc)
12    #[unsafe(super(NSController, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(feature = "NSController")]
16    pub struct NSUserDefaultsController;
17);
18
19#[cfg(feature = "NSController")]
20extern_conformance!(
21    unsafe impl NSCoding for NSUserDefaultsController {}
22);
23
24#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
25extern_conformance!(
26    unsafe impl NSEditor for NSUserDefaultsController {}
27);
28
29#[cfg(all(feature = "NSController", feature = "NSKeyValueBinding"))]
30extern_conformance!(
31    unsafe impl NSEditorRegistration for NSUserDefaultsController {}
32);
33
34#[cfg(feature = "NSController")]
35extern_conformance!(
36    unsafe impl NSObjectProtocol for NSUserDefaultsController {}
37);
38
39#[cfg(feature = "NSController")]
40impl NSUserDefaultsController {
41    extern_methods!(
42        #[unsafe(method(sharedUserDefaultsController))]
43        #[unsafe(method_family = none)]
44        pub fn sharedUserDefaultsController(
45            mtm: MainThreadMarker,
46        ) -> Retained<NSUserDefaultsController>;
47
48        /// # Safety
49        ///
50        /// `initial_values` generic should be of the correct type.
51        #[unsafe(method(initWithDefaults:initialValues:))]
52        #[unsafe(method_family = init)]
53        pub unsafe fn initWithDefaults_initialValues(
54            this: Allocated<Self>,
55            defaults: Option<&NSUserDefaults>,
56            initial_values: Option<&NSDictionary<NSString, AnyObject>>,
57        ) -> Retained<Self>;
58
59        /// # Safety
60        ///
61        /// `coder` possibly has further requirements.
62        #[unsafe(method(initWithCoder:))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn initWithCoder(
65            this: Allocated<Self>,
66            coder: &NSCoder,
67        ) -> Option<Retained<Self>>;
68
69        #[unsafe(method(defaults))]
70        #[unsafe(method_family = none)]
71        pub fn defaults(&self) -> Retained<NSUserDefaults>;
72
73        #[unsafe(method(initialValues))]
74        #[unsafe(method_family = none)]
75        pub fn initialValues(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
76
77        /// Setter for [`initialValues`][Self::initialValues].
78        ///
79        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
80        ///
81        /// # Safety
82        ///
83        /// `initial_values` generic should be of the correct type.
84        #[unsafe(method(setInitialValues:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setInitialValues(
87            &self,
88            initial_values: Option<&NSDictionary<NSString, AnyObject>>,
89        );
90
91        #[unsafe(method(appliesImmediately))]
92        #[unsafe(method_family = none)]
93        pub fn appliesImmediately(&self) -> bool;
94
95        /// Setter for [`appliesImmediately`][Self::appliesImmediately].
96        #[unsafe(method(setAppliesImmediately:))]
97        #[unsafe(method_family = none)]
98        pub fn setAppliesImmediately(&self, applies_immediately: bool);
99
100        #[unsafe(method(hasUnappliedChanges))]
101        #[unsafe(method_family = none)]
102        pub fn hasUnappliedChanges(&self) -> bool;
103
104        #[unsafe(method(values))]
105        #[unsafe(method_family = none)]
106        pub fn values(&self) -> Retained<AnyObject>;
107
108        /// # Safety
109        ///
110        /// `sender` should be of the correct type.
111        #[unsafe(method(revert:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn revert(&self, sender: Option<&AnyObject>);
114
115        /// # Safety
116        ///
117        /// `sender` should be of the correct type.
118        #[unsafe(method(save:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn save(&self, sender: Option<&AnyObject>);
121
122        /// # Safety
123        ///
124        /// `sender` should be of the correct type.
125        #[unsafe(method(revertToInitialValues:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn revertToInitialValues(&self, sender: Option<&AnyObject>);
128    );
129}
130
131/// Methods declared on superclass `NSController`.
132#[cfg(feature = "NSController")]
133impl NSUserDefaultsController {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub fn init(this: Allocated<Self>) -> Retained<Self>;
138    );
139}
140
141/// Methods declared on superclass `NSObject`.
142#[cfg(feature = "NSController")]
143impl NSUserDefaultsController {
144    extern_methods!(
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
148    );
149}