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 unsafe 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 unsafe fn currentAppearance() -> Option<Retained<NSAppearance>>;
43
44        /// Setter for [`currentAppearance`][Self::currentAppearance].
45        #[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
46        #[unsafe(method(setCurrentAppearance:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setCurrentAppearance(current_appearance: Option<&NSAppearance>);
49
50        #[unsafe(method(currentDrawingAppearance))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn currentDrawingAppearance() -> Retained<NSAppearance>;
53
54        #[cfg(feature = "block2")]
55        #[unsafe(method(performAsCurrentDrawingAppearance:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn performAsCurrentDrawingAppearance(
58            &self,
59            block: &block2::DynBlock<dyn Fn() + '_>,
60        );
61
62        #[unsafe(method(appearanceNamed:))]
63        #[unsafe(method_family = none)]
64        pub fn appearanceNamed(name: &NSAppearanceName) -> Option<Retained<NSAppearance>>;
65
66        #[unsafe(method(initWithAppearanceNamed:bundle:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithAppearanceNamed_bundle(
69            this: Allocated<Self>,
70            name: &NSAppearanceName,
71            bundle: Option<&NSBundle>,
72        ) -> Option<Retained<Self>>;
73
74        #[unsafe(method(initWithCoder:))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn initWithCoder(
77            this: Allocated<Self>,
78            coder: &NSCoder,
79        ) -> Option<Retained<Self>>;
80
81        #[unsafe(method(allowsVibrancy))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn allowsVibrancy(&self) -> bool;
84
85        #[unsafe(method(bestMatchFromAppearancesWithNames:))]
86        #[unsafe(method_family = none)]
87        pub fn bestMatchFromAppearancesWithNames(
88            &self,
89            appearances: &NSArray<NSAppearanceName>,
90        ) -> Option<Retained<NSAppearanceName>>;
91    );
92}
93
94/// Methods declared on superclass `NSObject`.
95impl NSAppearance {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new() -> Retained<Self>;
104    );
105}
106
107extern "C" {
108    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaqua?language=objc)
109    pub static NSAppearanceNameAqua: &'static NSAppearanceName;
110}
111
112extern "C" {
113    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamedarkaqua?language=objc)
114    pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
115}
116
117extern "C" {
118    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamelightcontent?language=objc)
119    pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
120}
121
122extern "C" {
123    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamevibrantdark?language=objc)
124    pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
125}
126
127extern "C" {
128    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenamevibrantlight?language=objc)
129    pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
130}
131
132extern "C" {
133    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastaqua?language=objc)
134    pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
135}
136
137extern "C" {
138    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastdarkaqua?language=objc)
139    pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
140}
141
142extern "C" {
143    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastvibrantlight?language=objc)
144    pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
145}
146
147extern "C" {
148    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancenameaccessibilityhighcontrastvibrantdark?language=objc)
149    pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
150}
151
152extern_protocol!(
153    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappearancecustomization?language=objc)
154    pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
155        #[unsafe(method(appearance))]
156        #[unsafe(method_family = none)]
157        unsafe fn appearance(&self) -> Option<Retained<NSAppearance>>;
158
159        /// Setter for [`appearance`][Self::appearance].
160        #[unsafe(method(setAppearance:))]
161        #[unsafe(method_family = none)]
162        unsafe fn setAppearance(&self, appearance: Option<&NSAppearance>);
163
164        #[unsafe(method(effectiveAppearance))]
165        #[unsafe(method_family = none)]
166        unsafe fn effectiveAppearance(&self) -> Retained<NSAppearance>;
167    }
168);