1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSButton, NSControl, NSView, NSResponder, NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 #[cfg(all(
18 feature = "NSButton",
19 feature = "NSControl",
20 feature = "NSResponder",
21 feature = "NSView"
22 ))]
23 pub struct NSStatusBarButton;
24);
25
26#[cfg(all(
27 feature = "NSAccessibilityProtocols",
28 feature = "NSButton",
29 feature = "NSControl",
30 feature = "NSResponder",
31 feature = "NSView"
32))]
33extern_conformance!(
34 unsafe impl NSAccessibility for NSStatusBarButton {}
35);
36
37#[cfg(all(
38 feature = "NSAccessibilityProtocols",
39 feature = "NSButton",
40 feature = "NSControl",
41 feature = "NSResponder",
42 feature = "NSView"
43))]
44extern_conformance!(
45 unsafe impl NSAccessibilityButton for NSStatusBarButton {}
46);
47
48#[cfg(all(
49 feature = "NSAccessibilityProtocols",
50 feature = "NSButton",
51 feature = "NSControl",
52 feature = "NSResponder",
53 feature = "NSView"
54))]
55extern_conformance!(
56 unsafe impl NSAccessibilityElementProtocol for NSStatusBarButton {}
57);
58
59#[cfg(all(
60 feature = "NSAnimation",
61 feature = "NSButton",
62 feature = "NSControl",
63 feature = "NSResponder",
64 feature = "NSView"
65))]
66extern_conformance!(
67 unsafe impl NSAnimatablePropertyContainer for NSStatusBarButton {}
68);
69
70#[cfg(all(
71 feature = "NSAppearance",
72 feature = "NSButton",
73 feature = "NSControl",
74 feature = "NSResponder",
75 feature = "NSView"
76))]
77extern_conformance!(
78 unsafe impl NSAppearanceCustomization for NSStatusBarButton {}
79);
80
81#[cfg(all(
82 feature = "NSButton",
83 feature = "NSControl",
84 feature = "NSResponder",
85 feature = "NSView"
86))]
87extern_conformance!(
88 unsafe impl NSCoding for NSStatusBarButton {}
89);
90
91#[cfg(all(
92 feature = "NSButton",
93 feature = "NSControl",
94 feature = "NSDragging",
95 feature = "NSResponder",
96 feature = "NSView"
97))]
98extern_conformance!(
99 unsafe impl NSDraggingDestination for NSStatusBarButton {}
100);
101
102#[cfg(all(
103 feature = "NSButton",
104 feature = "NSControl",
105 feature = "NSResponder",
106 feature = "NSView"
107))]
108extern_conformance!(
109 unsafe impl NSObjectProtocol for NSStatusBarButton {}
110);
111
112#[cfg(all(
113 feature = "NSButton",
114 feature = "NSControl",
115 feature = "NSResponder",
116 feature = "NSUserInterfaceCompression",
117 feature = "NSView"
118))]
119extern_conformance!(
120 unsafe impl NSUserInterfaceCompression for NSStatusBarButton {}
121);
122
123#[cfg(all(
124 feature = "NSButton",
125 feature = "NSControl",
126 feature = "NSResponder",
127 feature = "NSUserInterfaceItemIdentification",
128 feature = "NSView"
129))]
130extern_conformance!(
131 unsafe impl NSUserInterfaceItemIdentification for NSStatusBarButton {}
132);
133
134#[cfg(all(
135 feature = "NSButton",
136 feature = "NSControl",
137 feature = "NSResponder",
138 feature = "NSUserInterfaceValidation",
139 feature = "NSView"
140))]
141extern_conformance!(
142 unsafe impl NSUserInterfaceValidations for NSStatusBarButton {}
143);
144
145#[cfg(all(
146 feature = "NSButton",
147 feature = "NSControl",
148 feature = "NSResponder",
149 feature = "NSView"
150))]
151impl NSStatusBarButton {
152 extern_methods!(
153 #[unsafe(method(appearsDisabled))]
155 #[unsafe(method_family = none)]
156 pub fn appearsDisabled(&self) -> bool;
157
158 #[unsafe(method(setAppearsDisabled:))]
160 #[unsafe(method_family = none)]
161 pub fn setAppearsDisabled(&self, appears_disabled: bool);
162 );
163}
164
165#[cfg(all(
167 feature = "NSButton",
168 feature = "NSControl",
169 feature = "NSResponder",
170 feature = "NSView"
171))]
172impl NSStatusBarButton {
173 extern_methods!(
174 #[cfg(feature = "NSImage")]
175 #[unsafe(method(buttonWithTitle:image:target:action:))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn buttonWithTitle_image_target_action(
194 title: &NSString,
195 image: &NSImage,
196 target: Option<&AnyObject>,
197 action: Option<Sel>,
198 mtm: MainThreadMarker,
199 ) -> Retained<Self>;
200
201 #[unsafe(method(buttonWithTitle:target:action:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn buttonWithTitle_target_action(
218 title: &NSString,
219 target: Option<&AnyObject>,
220 action: Option<Sel>,
221 mtm: MainThreadMarker,
222 ) -> Retained<Self>;
223
224 #[cfg(feature = "NSImage")]
225 #[unsafe(method(buttonWithImage:target:action:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn buttonWithImage_target_action(
242 image: &NSImage,
243 target: Option<&AnyObject>,
244 action: Option<Sel>,
245 mtm: MainThreadMarker,
246 ) -> Retained<Self>;
247
248 #[unsafe(method(checkboxWithTitle:target:action:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn checkboxWithTitle_target_action(
265 title: &NSString,
266 target: Option<&AnyObject>,
267 action: Option<Sel>,
268 mtm: MainThreadMarker,
269 ) -> Retained<Self>;
270
271 #[unsafe(method(radioButtonWithTitle:target:action:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn radioButtonWithTitle_target_action(
288 title: &NSString,
289 target: Option<&AnyObject>,
290 action: Option<Sel>,
291 mtm: MainThreadMarker,
292 ) -> Retained<Self>;
293 );
294}
295
296#[cfg(all(
298 feature = "NSButton",
299 feature = "NSControl",
300 feature = "NSResponder",
301 feature = "NSView"
302))]
303impl NSStatusBarButton {
304 extern_methods!(
305 #[unsafe(method(initWithFrame:))]
306 #[unsafe(method_family = init)]
307 pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
308
309 #[unsafe(method(initWithCoder:))]
313 #[unsafe(method_family = init)]
314 pub unsafe fn initWithCoder(
315 this: Allocated<Self>,
316 coder: &NSCoder,
317 ) -> Option<Retained<Self>>;
318 );
319}
320
321#[cfg(all(
323 feature = "NSButton",
324 feature = "NSControl",
325 feature = "NSResponder",
326 feature = "NSView"
327))]
328impl NSStatusBarButton {
329 extern_methods!(
330 #[unsafe(method(init))]
331 #[unsafe(method_family = init)]
332 pub fn init(this: Allocated<Self>) -> Retained<Self>;
333 );
334}
335
336#[cfg(all(
338 feature = "NSButton",
339 feature = "NSControl",
340 feature = "NSResponder",
341 feature = "NSView"
342))]
343impl NSStatusBarButton {
344 extern_methods!(
345 #[unsafe(method(new))]
346 #[unsafe(method_family = new)]
347 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
348 );
349}