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
21unsafe impl NSCoding for NSAppearance {}
22
23unsafe impl NSObjectProtocol for NSAppearance {}
24
25unsafe impl NSSecureCoding for NSAppearance {}
26
27impl NSAppearance {
28 extern_methods!(
29 #[unsafe(method(name))]
30 #[unsafe(method_family = none)]
31 pub unsafe fn name(&self) -> Retained<NSAppearanceName>;
32
33 #[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
34 #[unsafe(method(currentAppearance))]
35 #[unsafe(method_family = none)]
36 pub unsafe fn currentAppearance() -> Option<Retained<NSAppearance>>;
37
38 #[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
40 #[unsafe(method(setCurrentAppearance:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn setCurrentAppearance(current_appearance: Option<&NSAppearance>);
43
44 #[unsafe(method(currentDrawingAppearance))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn currentDrawingAppearance() -> Retained<NSAppearance>;
47
48 #[cfg(feature = "block2")]
49 #[unsafe(method(performAsCurrentDrawingAppearance:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn performAsCurrentDrawingAppearance(
52 &self,
53 block: &block2::Block<dyn Fn() + '_>,
54 );
55
56 #[unsafe(method(appearanceNamed:))]
57 #[unsafe(method_family = none)]
58 pub fn appearanceNamed(name: &NSAppearanceName) -> Option<Retained<NSAppearance>>;
59
60 #[unsafe(method(initWithAppearanceNamed:bundle:))]
61 #[unsafe(method_family = init)]
62 pub unsafe fn initWithAppearanceNamed_bundle(
63 this: Allocated<Self>,
64 name: &NSAppearanceName,
65 bundle: Option<&NSBundle>,
66 ) -> Option<Retained<Self>>;
67
68 #[unsafe(method(initWithCoder:))]
69 #[unsafe(method_family = init)]
70 pub unsafe fn initWithCoder(
71 this: Allocated<Self>,
72 coder: &NSCoder,
73 ) -> Option<Retained<Self>>;
74
75 #[unsafe(method(allowsVibrancy))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn allowsVibrancy(&self) -> bool;
78
79 #[unsafe(method(bestMatchFromAppearancesWithNames:))]
80 #[unsafe(method_family = none)]
81 pub fn bestMatchFromAppearancesWithNames(
82 &self,
83 appearances: &NSArray<NSAppearanceName>,
84 ) -> Option<Retained<NSAppearanceName>>;
85 );
86}
87
88impl NSAppearance {
90 extern_methods!(
91 #[unsafe(method(init))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95 #[unsafe(method(new))]
96 #[unsafe(method_family = new)]
97 pub unsafe fn new() -> Retained<Self>;
98 );
99}
100
101extern "C" {
102 pub static NSAppearanceNameAqua: &'static NSAppearanceName;
104}
105
106extern "C" {
107 pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
109}
110
111extern "C" {
112 pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
114}
115
116extern "C" {
117 pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
119}
120
121extern "C" {
122 pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
124}
125
126extern "C" {
127 pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
129}
130
131extern "C" {
132 pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
134}
135
136extern "C" {
137 pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
139}
140
141extern "C" {
142 pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
144}
145
146extern_protocol!(
147 pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
149 #[unsafe(method(appearance))]
150 #[unsafe(method_family = none)]
151 unsafe fn appearance(&self) -> Option<Retained<NSAppearance>>;
152
153 #[unsafe(method(setAppearance:))]
155 #[unsafe(method_family = none)]
156 unsafe fn setAppearance(&self, appearance: Option<&NSAppearance>);
157
158 #[unsafe(method(effectiveAppearance))]
159 #[unsafe(method_family = none)]
160 unsafe fn effectiveAppearance(&self) -> Retained<NSAppearance>;
161 }
162);