objc2_app_kit/generated/
NSAppearance.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type NSAppearanceName = NSString;
13
14extern_class!(
15 #[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 #[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 #[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
98impl 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 pub static NSAppearanceNameAqua: &'static NSAppearanceName;
121}
122
123extern "C" {
124 pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
126}
127
128extern "C" {
129 #[deprecated = "Light content should use the default Aqua apppearance."]
131 pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
132}
133
134extern "C" {
135 pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
137}
138
139extern "C" {
140 pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
142}
143
144extern "C" {
145 pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
147}
148
149extern "C" {
150 pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
152}
153
154extern "C" {
155 pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
157}
158
159extern "C" {
160 pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
162}
163
164extern_protocol!(
165 pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
167 #[unsafe(method(appearance))]
168 #[unsafe(method_family = none)]
169 fn appearance(&self) -> Option<Retained<NSAppearance>>;
170
171 #[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);