objc2_app_kit/generated/
NSStatusBarButton.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
10extern_class!(
11    /// Status bar buttons are the visual representation of `NSStatusItem`s, and are primarily displayed on the right side of the menu bar.
12    /// When a template image is set as the `image` property of the status bar button, it is rendered with the correct menu bar style. This guarantees that the button will look correct in various button states and appearances (such as dark menu bar).
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstatusbarbutton?language=objc)
15    #[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))]
33unsafe impl NSAccessibility for NSStatusBarButton {}
34
35#[cfg(all(
36    feature = "NSAccessibilityProtocols",
37    feature = "NSButton",
38    feature = "NSControl",
39    feature = "NSResponder",
40    feature = "NSView"
41))]
42unsafe impl NSAccessibilityButton for NSStatusBarButton {}
43
44#[cfg(all(
45    feature = "NSAccessibilityProtocols",
46    feature = "NSButton",
47    feature = "NSControl",
48    feature = "NSResponder",
49    feature = "NSView"
50))]
51unsafe impl NSAccessibilityElementProtocol for NSStatusBarButton {}
52
53#[cfg(all(
54    feature = "NSAnimation",
55    feature = "NSButton",
56    feature = "NSControl",
57    feature = "NSResponder",
58    feature = "NSView"
59))]
60unsafe impl NSAnimatablePropertyContainer for NSStatusBarButton {}
61
62#[cfg(all(
63    feature = "NSAppearance",
64    feature = "NSButton",
65    feature = "NSControl",
66    feature = "NSResponder",
67    feature = "NSView"
68))]
69unsafe impl NSAppearanceCustomization for NSStatusBarButton {}
70
71#[cfg(all(
72    feature = "NSButton",
73    feature = "NSControl",
74    feature = "NSResponder",
75    feature = "NSView"
76))]
77unsafe impl NSCoding for NSStatusBarButton {}
78
79#[cfg(all(
80    feature = "NSButton",
81    feature = "NSControl",
82    feature = "NSDragging",
83    feature = "NSResponder",
84    feature = "NSView"
85))]
86unsafe impl NSDraggingDestination for NSStatusBarButton {}
87
88#[cfg(all(
89    feature = "NSButton",
90    feature = "NSControl",
91    feature = "NSResponder",
92    feature = "NSView"
93))]
94unsafe impl NSObjectProtocol for NSStatusBarButton {}
95
96#[cfg(all(
97    feature = "NSButton",
98    feature = "NSControl",
99    feature = "NSResponder",
100    feature = "NSUserInterfaceCompression",
101    feature = "NSView"
102))]
103unsafe impl NSUserInterfaceCompression for NSStatusBarButton {}
104
105#[cfg(all(
106    feature = "NSButton",
107    feature = "NSControl",
108    feature = "NSResponder",
109    feature = "NSUserInterfaceItemIdentification",
110    feature = "NSView"
111))]
112unsafe impl NSUserInterfaceItemIdentification for NSStatusBarButton {}
113
114#[cfg(all(
115    feature = "NSButton",
116    feature = "NSControl",
117    feature = "NSResponder",
118    feature = "NSUserInterfaceValidation",
119    feature = "NSView"
120))]
121unsafe impl NSUserInterfaceValidations for NSStatusBarButton {}
122
123#[cfg(all(
124    feature = "NSButton",
125    feature = "NSControl",
126    feature = "NSResponder",
127    feature = "NSView"
128))]
129impl NSStatusBarButton {
130    extern_methods!(
131        /// If `YES`, the status bar icon has a disabled/off appearance while still being functional, such as allowing selection and actions. Defaults to `NO`.
132        #[unsafe(method(appearsDisabled))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn appearsDisabled(&self) -> bool;
135
136        /// Setter for [`appearsDisabled`][Self::appearsDisabled].
137        #[unsafe(method(setAppearsDisabled:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setAppearsDisabled(&self, appears_disabled: bool);
140    );
141}
142
143/// Methods declared on superclass `NSButton`.
144#[cfg(all(
145    feature = "NSButton",
146    feature = "NSControl",
147    feature = "NSResponder",
148    feature = "NSView"
149))]
150impl NSStatusBarButton {
151    extern_methods!(
152        #[cfg(feature = "NSImage")]
153        /// Creates a standard push button with a title and image.
154        ///
155        /// Parameter `title`: The localized title string that is displayed on the button.
156        ///
157        /// Parameter `image`: The image that is displayed alongside the title. In left-to-right localizations, the image is displayed to the left of the title. In right-to-left localizations, it is displayed to the right.
158        ///
159        /// Parameter `target`: The target object that receives action messages from the control.
160        ///
161        /// Parameter `action`: The action message sent by the control.
162        ///
163        /// Returns: An initialized button object.
164        #[unsafe(method(buttonWithTitle:image:target:action:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn buttonWithTitle_image_target_action(
167            title: &NSString,
168            image: &NSImage,
169            target: Option<&AnyObject>,
170            action: Option<Sel>,
171            mtm: MainThreadMarker,
172        ) -> Retained<Self>;
173
174        /// Creates a standard push button with the provided title.
175        ///
176        /// Parameter `title`: The localized title string that is displayed on the button.
177        ///
178        /// Parameter `target`: The target object that receives action messages from the control.
179        ///
180        /// Parameter `action`: The action message sent by the control.
181        ///
182        /// Returns: An initialized button object.
183        #[unsafe(method(buttonWithTitle:target:action:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn buttonWithTitle_target_action(
186            title: &NSString,
187            target: Option<&AnyObject>,
188            action: Option<Sel>,
189            mtm: MainThreadMarker,
190        ) -> Retained<Self>;
191
192        #[cfg(feature = "NSImage")]
193        /// Creates a standard push button with the provided image. Set the image's accessibilityDescription property to ensure accessibility for this control.
194        ///
195        /// Parameter `image`: The image to display in the body of the button.
196        ///
197        /// Parameter `target`: The target object that receives action messages from the control.
198        ///
199        /// Parameter `action`: The action message sent by the control.
200        ///
201        /// Returns: An initialized button object.
202        #[unsafe(method(buttonWithImage:target:action:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn buttonWithImage_target_action(
205            image: &NSImage,
206            target: Option<&AnyObject>,
207            action: Option<Sel>,
208            mtm: MainThreadMarker,
209        ) -> Retained<Self>;
210
211        /// Creates a standard checkbox with the provided title.
212        ///
213        /// Parameter `title`: The localized title string that is displayed alongside the checkbox.
214        ///
215        /// Parameter `target`: The target object that receives action messages from the control.
216        ///
217        /// Parameter `action`: The action message sent by the control.
218        ///
219        /// Returns: An initialized button object.
220        #[unsafe(method(checkboxWithTitle:target:action:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn checkboxWithTitle_target_action(
223            title: &NSString,
224            target: Option<&AnyObject>,
225            action: Option<Sel>,
226            mtm: MainThreadMarker,
227        ) -> Retained<Self>;
228
229        /// Creates a standard radio button with the provided title.
230        ///
231        /// Parameter `title`: The localized title string that is displayed alongside the radio button.
232        ///
233        /// Parameter `target`: The target object that receives action messages from the control.
234        ///
235        /// Parameter `action`: The action message sent by the control.
236        ///
237        /// Returns: An initialized button object.
238        #[unsafe(method(radioButtonWithTitle:target:action:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn radioButtonWithTitle_target_action(
241            title: &NSString,
242            target: Option<&AnyObject>,
243            action: Option<Sel>,
244            mtm: MainThreadMarker,
245        ) -> Retained<Self>;
246    );
247}
248
249/// Methods declared on superclass `NSControl`.
250#[cfg(all(
251    feature = "NSButton",
252    feature = "NSControl",
253    feature = "NSResponder",
254    feature = "NSView"
255))]
256impl NSStatusBarButton {
257    extern_methods!(
258        #[unsafe(method(initWithFrame:))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
261
262        #[unsafe(method(initWithCoder:))]
263        #[unsafe(method_family = init)]
264        pub unsafe fn initWithCoder(
265            this: Allocated<Self>,
266            coder: &NSCoder,
267        ) -> Option<Retained<Self>>;
268    );
269}
270
271/// Methods declared on superclass `NSResponder`.
272#[cfg(all(
273    feature = "NSButton",
274    feature = "NSControl",
275    feature = "NSResponder",
276    feature = "NSView"
277))]
278impl NSStatusBarButton {
279    extern_methods!(
280        #[unsafe(method(init))]
281        #[unsafe(method_family = init)]
282        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
283    );
284}
285
286/// Methods declared on superclass `NSObject`.
287#[cfg(all(
288    feature = "NSButton",
289    feature = "NSControl",
290    feature = "NSResponder",
291    feature = "NSView"
292))]
293impl NSStatusBarButton {
294    extern_methods!(
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
298    );
299}