objc2_app_kit/generated/
NSAppearance.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancename?language=objc)
11// NS_TYPED_EXTENSIBLE_ENUM
12pub type NSAppearanceName = NSString;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearance?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct NSAppearance;
19);
20
21extern_conformance!(
22    unsafe impl NSCoding for NSAppearance {}
23);
24
25extern_conformance!(
26    unsafe impl NSObjectProtocol for NSAppearance {}
27);
28
29extern_conformance!(
30    unsafe impl NSSecureCoding for NSAppearance {}
31);
32
33impl NSAppearance {
34    extern_methods!(
35        #[unsafe(method(name))]
36        #[unsafe(method_family = none)]
37        pub fn name(&self) -> Retained<NSAppearanceName>;
38
39        #[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
40        #[unsafe(method(currentAppearance))]
41        #[unsafe(method_family = none)]
42        pub fn currentAppearance() -> Option<Retained<NSAppearance>>;
43
44        /// Setter for [`currentAppearance`][Self::currentAppearance].
45        ///
46        /// # Safety
47        ///
48        /// `current_appearance` might not allow `None`.
49        #[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
50        #[unsafe(method(setCurrentAppearance:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setCurrentAppearance(current_appearance: Option<&NSAppearance>);
53
54        #[unsafe(method(currentDrawingAppearance))]
55        #[unsafe(method_family = none)]
56        pub fn currentDrawingAppearance() -> Retained<NSAppearance>;
57
58        #[cfg(feature = "block2")]
59        #[unsafe(method(performAsCurrentDrawingAppearance:))]
60        #[unsafe(method_family = none)]
61        pub fn performAsCurrentDrawingAppearance(&self, block: &block2::DynBlock<dyn Fn() + '_>);
62
63        #[unsafe(method(appearanceNamed:))]
64        #[unsafe(method_family = none)]
65        pub fn appearanceNamed(name: &NSAppearanceName) -> Option<Retained<NSAppearance>>;
66
67        #[unsafe(method(initWithAppearanceNamed:bundle:))]
68        #[unsafe(method_family = init)]
69        pub fn initWithAppearanceNamed_bundle(
70            this: Allocated<Self>,
71            name: &NSAppearanceName,
72            bundle: Option<&NSBundle>,
73        ) -> Option<Retained<Self>>;
74
75        /// # Safety
76        ///
77        /// `coder` possibly has further requirements.
78        #[unsafe(method(initWithCoder:))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initWithCoder(
81            this: Allocated<Self>,
82            coder: &NSCoder,
83        ) -> Option<Retained<Self>>;
84
85        #[unsafe(method(allowsVibrancy))]
86        #[unsafe(method_family = none)]
87        pub fn allowsVibrancy(&self) -> bool;
88
89        #[unsafe(method(bestMatchFromAppearancesWithNames:))]
90        #[unsafe(method_family = none)]
91        pub fn bestMatchFromAppearancesWithNames(
92            &self,
93            appearances: &NSArray<NSAppearanceName>,
94        ) -> Option<Retained<NSAppearanceName>>;
95    );
96}
97
98/// Methods declared on superclass `NSObject`.
99impl NSAppearance {
100    extern_methods!(
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub fn init(this: Allocated<Self>) -> Retained<Self>;
104
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub fn new() -> Retained<Self>;
108    );
109}
110
111impl DefaultRetained for NSAppearance {
112    #[inline]
113    fn default_retained() -> Retained<Self> {
114        Self::new()
115    }
116}
117
118extern "C" {
119    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaqua?language=objc)
120    pub static NSAppearanceNameAqua: &'static NSAppearanceName;
121}
122
123extern "C" {
124    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamedarkaqua?language=objc)
125    pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
126}
127
128extern "C" {
129    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamelightcontent?language=objc)
130    #[deprecated = "Light content should use the default Aqua apppearance."]
131    pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
132}
133
134extern "C" {
135    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamevibrantdark?language=objc)
136    pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
137}
138
139extern "C" {
140    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamevibrantlight?language=objc)
141    pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
142}
143
144extern "C" {
145    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastaqua?language=objc)
146    pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
147}
148
149extern "C" {
150    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastdarkaqua?language=objc)
151    pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
152}
153
154extern "C" {
155    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastvibrantlight?language=objc)
156    pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
157}
158
159extern "C" {
160    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastvibrantdark?language=objc)
161    pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
162}
163
164extern_protocol!(
165    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancecustomization?language=objc)
166    pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
167        #[unsafe(method(appearance))]
168        #[unsafe(method_family = none)]
169        fn appearance(&self) -> Option<Retained<NSAppearance>>;
170
171        /// Setter for [`appearance`][Self::appearance].
172        #[unsafe(method(setAppearance:))]
173        #[unsafe(method_family = none)]
174        fn setAppearance(&self, appearance: Option<&NSAppearance>);
175
176        #[unsafe(method(effectiveAppearance))]
177        #[unsafe(method_family = none)]
178        fn effectiveAppearance(&self) -> Retained<NSAppearance>;
179    }
180);