objc2_app_kit/generated/
NSButton.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    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbutton?language=objc)
12    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
15    pub struct NSButton;
16);
17
18#[cfg(all(
19    feature = "NSAccessibilityProtocols",
20    feature = "NSControl",
21    feature = "NSResponder",
22    feature = "NSView"
23))]
24unsafe impl NSAccessibility for NSButton {}
25
26#[cfg(all(
27    feature = "NSAccessibilityProtocols",
28    feature = "NSControl",
29    feature = "NSResponder",
30    feature = "NSView"
31))]
32unsafe impl NSAccessibilityButton for NSButton {}
33
34#[cfg(all(
35    feature = "NSAccessibilityProtocols",
36    feature = "NSControl",
37    feature = "NSResponder",
38    feature = "NSView"
39))]
40unsafe impl NSAccessibilityElementProtocol for NSButton {}
41
42#[cfg(all(
43    feature = "NSAnimation",
44    feature = "NSControl",
45    feature = "NSResponder",
46    feature = "NSView"
47))]
48unsafe impl NSAnimatablePropertyContainer for NSButton {}
49
50#[cfg(all(
51    feature = "NSAppearance",
52    feature = "NSControl",
53    feature = "NSResponder",
54    feature = "NSView"
55))]
56unsafe impl NSAppearanceCustomization for NSButton {}
57
58#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
59unsafe impl NSCoding for NSButton {}
60
61#[cfg(all(
62    feature = "NSControl",
63    feature = "NSDragging",
64    feature = "NSResponder",
65    feature = "NSView"
66))]
67unsafe impl NSDraggingDestination for NSButton {}
68
69#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
70unsafe impl NSObjectProtocol for NSButton {}
71
72#[cfg(all(
73    feature = "NSControl",
74    feature = "NSResponder",
75    feature = "NSUserInterfaceCompression",
76    feature = "NSView"
77))]
78unsafe impl NSUserInterfaceCompression for NSButton {}
79
80#[cfg(all(
81    feature = "NSControl",
82    feature = "NSResponder",
83    feature = "NSUserInterfaceItemIdentification",
84    feature = "NSView"
85))]
86unsafe impl NSUserInterfaceItemIdentification for NSButton {}
87
88#[cfg(all(
89    feature = "NSControl",
90    feature = "NSResponder",
91    feature = "NSUserInterfaceValidation",
92    feature = "NSView"
93))]
94unsafe impl NSUserInterfaceValidations for NSButton {}
95
96#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
97impl NSButton {
98    extern_methods!(
99        #[cfg(feature = "NSImage")]
100        /// Creates a standard push button with a title and image.
101        ///
102        /// Parameter `title`: The localized title string that is displayed on the button.
103        ///
104        /// 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.
105        ///
106        /// Parameter `target`: The target object that receives action messages from the control.
107        ///
108        /// Parameter `action`: The action message sent by the control.
109        ///
110        /// Returns: An initialized button object.
111        #[unsafe(method(buttonWithTitle:image:target:action:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn buttonWithTitle_image_target_action(
114            title: &NSString,
115            image: &NSImage,
116            target: Option<&AnyObject>,
117            action: Option<Sel>,
118            mtm: MainThreadMarker,
119        ) -> Retained<Self>;
120
121        /// Creates a standard push button with the provided title.
122        ///
123        /// Parameter `title`: The localized title string that is displayed on the button.
124        ///
125        /// Parameter `target`: The target object that receives action messages from the control.
126        ///
127        /// Parameter `action`: The action message sent by the control.
128        ///
129        /// Returns: An initialized button object.
130        #[unsafe(method(buttonWithTitle:target:action:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn buttonWithTitle_target_action(
133            title: &NSString,
134            target: Option<&AnyObject>,
135            action: Option<Sel>,
136            mtm: MainThreadMarker,
137        ) -> Retained<Self>;
138
139        #[cfg(feature = "NSImage")]
140        /// Creates a standard push button with the provided image. Set the image's accessibilityDescription property to ensure accessibility for this control.
141        ///
142        /// Parameter `image`: The image to display in the body of the button.
143        ///
144        /// Parameter `target`: The target object that receives action messages from the control.
145        ///
146        /// Parameter `action`: The action message sent by the control.
147        ///
148        /// Returns: An initialized button object.
149        #[unsafe(method(buttonWithImage:target:action:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn buttonWithImage_target_action(
152            image: &NSImage,
153            target: Option<&AnyObject>,
154            action: Option<Sel>,
155            mtm: MainThreadMarker,
156        ) -> Retained<Self>;
157
158        /// Creates a standard checkbox with the provided title.
159        ///
160        /// Parameter `title`: The localized title string that is displayed alongside the checkbox.
161        ///
162        /// Parameter `target`: The target object that receives action messages from the control.
163        ///
164        /// Parameter `action`: The action message sent by the control.
165        ///
166        /// Returns: An initialized button object.
167        #[unsafe(method(checkboxWithTitle:target:action:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn checkboxWithTitle_target_action(
170            title: &NSString,
171            target: Option<&AnyObject>,
172            action: Option<Sel>,
173            mtm: MainThreadMarker,
174        ) -> Retained<Self>;
175
176        /// Creates a standard radio button with the provided title.
177        ///
178        /// Parameter `title`: The localized title string that is displayed alongside the radio button.
179        ///
180        /// Parameter `target`: The target object that receives action messages from the control.
181        ///
182        /// Parameter `action`: The action message sent by the control.
183        ///
184        /// Returns: An initialized button object.
185        #[unsafe(method(radioButtonWithTitle:target:action:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn radioButtonWithTitle_target_action(
188            title: &NSString,
189            target: Option<&AnyObject>,
190            action: Option<Sel>,
191            mtm: MainThreadMarker,
192        ) -> Retained<Self>;
193
194        #[cfg(feature = "NSButtonCell")]
195        /// Sets the button’s type, which affects its user interface and behavior when clicked. See the NSButtonType enumeration for possible options and their behaviors.
196        #[unsafe(method(setButtonType:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setButtonType(&self, r#type: NSButtonType);
199
200        /// The title displayed on the button when it’s in an off state, or an empty string if the button does not display a title. By default, a button's title is "Button".
201        #[unsafe(method(title))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn title(&self) -> Retained<NSString>;
204
205        /// Setter for [`title`][Self::title].
206        #[unsafe(method(setTitle:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setTitle(&self, title: &NSString);
209
210        /// The button's title, expressed as an attributed string.
211        #[unsafe(method(attributedTitle))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
214
215        /// Setter for [`attributedTitle`][Self::attributedTitle].
216        #[unsafe(method(setAttributedTitle:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
219
220        /// The title that the button displays when the button is in an on state, or an empty string if there is no such title. Note that some button types do not display an alternate title.
221        #[unsafe(method(alternateTitle))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
224
225        /// Setter for [`alternateTitle`][Self::alternateTitle].
226        #[unsafe(method(setAlternateTitle:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
229
230        /// The alternate title, expressed as an attributed string.
231        #[unsafe(method(attributedAlternateTitle))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
234
235        /// Setter for [`attributedAlternateTitle`][Self::attributedAlternateTitle].
236        #[unsafe(method(setAttributedAlternateTitle:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn setAttributedAlternateTitle(
239            &self,
240            attributed_alternate_title: &NSAttributedString,
241        );
242
243        /// Indicates whether the button's action has a destructive effect on user data.  AppKit may guard a destructive-actioned button against accidental presses, and may give the button a special appearance in certain contexts to caution against unintentional use.  Defaults to NO.
244        #[unsafe(method(hasDestructiveAction))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn hasDestructiveAction(&self) -> bool;
247
248        /// Setter for [`hasDestructiveAction`][Self::hasDestructiveAction].
249        #[unsafe(method(setHasDestructiveAction:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn setHasDestructiveAction(&self, has_destructive_action: bool);
252
253        #[cfg(feature = "NSSound")]
254        /// The sound that plays when the user clicks the button, or nil if the button should not play a sound. The default value is nil.
255        #[unsafe(method(sound))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;
258
259        #[cfg(feature = "NSSound")]
260        /// Setter for [`sound`][Self::sound].
261        #[unsafe(method(setSound:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn setSound(&self, sound: Option<&NSSound>);
264
265        /// Sends action on deep-press or extended hover while dragging. Defaults to NO.
266        #[unsafe(method(isSpringLoaded))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn isSpringLoaded(&self) -> bool;
269
270        /// Setter for [`isSpringLoaded`][Self::isSpringLoaded].
271        #[unsafe(method(setSpringLoaded:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setSpringLoaded(&self, spring_loaded: bool);
274
275        /// Configures the maximum allowed level for an NSMultiLevelAcceleratorButton, allowed values range from [1,5]. Defaults to 2.
276        #[unsafe(method(maxAcceleratorLevel))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn maxAcceleratorLevel(&self) -> NSInteger;
279
280        /// Setter for [`maxAcceleratorLevel`][Self::maxAcceleratorLevel].
281        #[unsafe(method(setMaxAcceleratorLevel:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setMaxAcceleratorLevel(&self, max_accelerator_level: NSInteger);
284
285        /// Sets the initial delay and repeat interval, in seconds, for repeated action messages sent when `continuous` is YES.
286        #[unsafe(method(setPeriodicDelay:interval:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
289
290        /// Gets the initial delay and repeat interval, in seconds, for repeated action messages sent when `continuous` is YES. Both parameters to this method must not be NULL.
291        #[unsafe(method(getPeriodicDelay:interval:))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn getPeriodicDelay_interval(
294            &self,
295            delay: NonNull<c_float>,
296            interval: NonNull<c_float>,
297        );
298
299        #[cfg(feature = "NSButtonCell")]
300        /// The bezel style of the button, which provides a set of bezel artwork, layout metrics, and content styling from a set of system-provided styles. See the NSBezelStyle enumeration for a list of available styles. The bezel style is not used if the `bordered` property is set to `NO`.
301        #[unsafe(method(bezelStyle))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn bezelStyle(&self) -> NSBezelStyle;
304
305        #[cfg(feature = "NSButtonCell")]
306        /// Setter for [`bezelStyle`][Self::bezelStyle].
307        #[unsafe(method(setBezelStyle:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);
310
311        /// A Boolean value that determines whether the button draws a border.
312        #[unsafe(method(isBordered))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn isBordered(&self) -> bool;
315
316        /// Setter for [`isBordered`][Self::isBordered].
317        #[unsafe(method(setBordered:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn setBordered(&self, bordered: bool);
320
321        /// A Boolean value that indicates whether the button is transparent. A transparent button never draws itself, but it receives mouse events, sends its action, and tracks the mouse properly.
322        #[unsafe(method(isTransparent))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn isTransparent(&self) -> bool;
325
326        /// Setter for [`isTransparent`][Self::isTransparent].
327        #[unsafe(method(setTransparent:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn setTransparent(&self, transparent: bool);
330
331        #[unsafe(method(showsBorderOnlyWhileMouseInside))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;
334
335        /// Setter for [`showsBorderOnlyWhileMouseInside`][Self::showsBorderOnlyWhileMouseInside].
336        #[unsafe(method(setShowsBorderOnlyWhileMouseInside:))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn setShowsBorderOnlyWhileMouseInside(
339            &self,
340            shows_border_only_while_mouse_inside: bool,
341        );
342
343        #[cfg(feature = "NSColor")]
344        /// Applies a custom color to the button's bezel, in appearances that support it. A nil value indicates an unmodified button appearance. The default value is nil.
345        #[unsafe(method(bezelColor))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn bezelColor(&self) -> Option<Retained<NSColor>>;
348
349        #[cfg(feature = "NSColor")]
350        /// Setter for [`bezelColor`][Self::bezelColor].
351        #[unsafe(method(setBezelColor:))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn setBezelColor(&self, bezel_color: Option<&NSColor>);
354
355        #[cfg(feature = "NSColor")]
356        /// Applies a tint color to template image and text content, in combination with other theme-appropriate effects. Only applicable to borderless buttons. A nil value indicates the standard set of effects without color modification. The default value is nil. Non-template images and attributed string values are not affected by the contentTintColor.
357        #[unsafe(method(contentTintColor))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn contentTintColor(&self) -> Option<Retained<NSColor>>;
360
361        #[cfg(feature = "NSColor")]
362        /// Setter for [`contentTintColor`][Self::contentTintColor].
363        #[unsafe(method(setContentTintColor:))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn setContentTintColor(&self, content_tint_color: Option<&NSColor>);
366
367        #[cfg(feature = "NSImage")]
368        /// The image that appears on the button when it’s in an off state, or nil if there is no such image.
369        #[unsafe(method(image))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
372
373        #[cfg(feature = "NSImage")]
374        /// Setter for [`image`][Self::image].
375        #[unsafe(method(setImage:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setImage(&self, image: Option<&NSImage>);
378
379        #[cfg(feature = "NSImage")]
380        /// An alternate image that appears on the button when the button is in an on state, or nil if there is no such image. Note that some button types do not display an alternate image.
381        #[unsafe(method(alternateImage))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
384
385        #[cfg(feature = "NSImage")]
386        /// Setter for [`alternateImage`][Self::alternateImage].
387        #[unsafe(method(setAlternateImage:))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
390
391        #[cfg(feature = "NSCell")]
392        /// The position of the button's image relative to its title. See the NSCellImagePosition enumeration for possible values.
393        #[unsafe(method(imagePosition))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn imagePosition(&self) -> NSCellImagePosition;
396
397        #[cfg(feature = "NSCell")]
398        /// Setter for [`imagePosition`][Self::imagePosition].
399        #[unsafe(method(setImagePosition:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);
402
403        #[cfg(feature = "NSCell")]
404        /// The scaling mode applied to make the button's image fit within its bounds.
405        #[unsafe(method(imageScaling))]
406        #[unsafe(method_family = none)]
407        pub unsafe fn imageScaling(&self) -> NSImageScaling;
408
409        #[cfg(feature = "NSCell")]
410        /// Setter for [`imageScaling`][Self::imageScaling].
411        #[unsafe(method(setImageScaling:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
414
415        /// A Boolean value that determines how the button's image and title are positioned together within the button bezel. If false, the image is positioned according to the imagePosition property at the edge of the button bezel, and the title is positioned within the remaining space. If true, the button’s image is positioned directly adjacent to the title based on the imagePosition property, and the image and title are positioned within the button bezel as a single unit.
416        #[unsafe(method(imageHugsTitle))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn imageHugsTitle(&self) -> bool;
419
420        /// Setter for [`imageHugsTitle`][Self::imageHugsTitle].
421        #[unsafe(method(setImageHugsTitle:))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn setImageHugsTitle(&self, image_hugs_title: bool);
424
425        #[cfg(feature = "NSImage")]
426        /// Specifies a combination of point size, weight, and scale to use when sizing and displaying symbol images. If a symbol configuration isn't provided, the symbol is matched to the button's `font` property. The default value is nil.
427        #[unsafe(method(symbolConfiguration))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn symbolConfiguration(&self) -> Option<Retained<NSImageSymbolConfiguration>>;
430
431        #[cfg(feature = "NSImage")]
432        /// Setter for [`symbolConfiguration`][Self::symbolConfiguration].
433        #[unsafe(method(setSymbolConfiguration:))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn setSymbolConfiguration(
436            &self,
437            symbol_configuration: Option<&NSImageSymbolConfiguration>,
438        );
439
440        #[cfg(feature = "NSCell")]
441        /// The button's state. Buttons support the off and on states, and an additional mixed state depending on the value of the `allowsMixedState` property.
442        #[unsafe(method(state))]
443        #[unsafe(method_family = none)]
444        pub unsafe fn state(&self) -> NSControlStateValue;
445
446        #[cfg(feature = "NSCell")]
447        /// Setter for [`state`][Self::state].
448        #[unsafe(method(setState:))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn setState(&self, state: NSControlStateValue);
451
452        /// A Boolean value that indicates whether the button allows a mixed state. If NO, the button has two states (on and off), and if YES, the button has three states (on, off, and mixed). The mixed state is commonly used with checkboxes and radio buttons to indicate a value which is partially on.
453        #[unsafe(method(allowsMixedState))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn allowsMixedState(&self) -> bool;
456
457        /// Setter for [`allowsMixedState`][Self::allowsMixedState].
458        #[unsafe(method(setAllowsMixedState:))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn setAllowsMixedState(&self, allows_mixed_state: bool);
461
462        /// Sets the button to its next eligible state. If the button allows mixed state, this cycles through the states in the order: on, off, mixed, on, etc. If the button does not allow mixed state, it toggles between off and on.
463        #[unsafe(method(setNextState))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn setNextState(&self);
466
467        /// Highlights, or un-highlights, the button. Highlighting makes the button appear "pressed", which may include showing an illuminated bezel, or showing the alternate image or title, depending on the type of button.
468        #[unsafe(method(highlight:))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn highlight(&self, flag: bool);
471
472        /// This property contains the button's key equivalent, or the empty string if no equivalent has been defined. Buttons don’t have a default key equivalent. Setting the key equivalent to the Return character causes it to act as the default button for its window.
473        #[unsafe(method(keyEquivalent))]
474        #[unsafe(method_family = none)]
475        pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
476
477        /// Setter for [`keyEquivalent`][Self::keyEquivalent].
478        #[unsafe(method(setKeyEquivalent:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
481
482        #[cfg(feature = "NSEvent")]
483        /// A bitmask specifying the modifier keys that are applied to the button's key equivalent. Mask bits are defined by the NSEventModifierFlags option set. The only mask bits relevant in button key-equivalent modifier masks are NSEventModifierFlagControl, NSEventModifierFlagOption, and NSEventModifierFlagCommand.
484        #[unsafe(method(keyEquivalentModifierMask))]
485        #[unsafe(method_family = none)]
486        pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
487
488        #[cfg(feature = "NSEvent")]
489        /// Setter for [`keyEquivalentModifierMask`][Self::keyEquivalentModifierMask].
490        #[unsafe(method(setKeyEquivalentModifierMask:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn setKeyEquivalentModifierMask(
493            &self,
494            key_equivalent_modifier_mask: NSEventModifierFlags,
495        );
496
497        #[cfg(feature = "NSEvent")]
498        /// If the event parameter matches the button's key equivalent, the button briefly highlights and performs its action, and then returns YES. Otherwise, returns NO.
499        #[unsafe(method(performKeyEquivalent:))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn performKeyEquivalent(&self, key: &NSEvent) -> bool;
502
503        #[cfg(feature = "NSUserInterfaceCompression")]
504        #[unsafe(method(compressWithPrioritizedCompressionOptions:))]
505        #[unsafe(method_family = none)]
506        pub unsafe fn compressWithPrioritizedCompressionOptions(
507            &self,
508            prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
509        );
510
511        #[cfg(feature = "NSUserInterfaceCompression")]
512        #[unsafe(method(minimumSizeWithPrioritizedCompressionOptions:))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn minimumSizeWithPrioritizedCompressionOptions(
515            &self,
516            prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
517        ) -> NSSize;
518
519        #[cfg(feature = "NSUserInterfaceCompression")]
520        #[unsafe(method(activeCompressionOptions))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn activeCompressionOptions(
523            &self,
524        ) -> Retained<NSUserInterfaceCompressionOptions>;
525    );
526}
527
528/// Methods declared on superclass `NSControl`.
529#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
530impl NSButton {
531    extern_methods!(
532        #[unsafe(method(initWithFrame:))]
533        #[unsafe(method_family = init)]
534        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
535
536        #[unsafe(method(initWithCoder:))]
537        #[unsafe(method_family = init)]
538        pub unsafe fn initWithCoder(
539            this: Allocated<Self>,
540            coder: &NSCoder,
541        ) -> Option<Retained<Self>>;
542    );
543}
544
545/// Methods declared on superclass `NSResponder`.
546#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
547impl NSButton {
548    extern_methods!(
549        #[unsafe(method(init))]
550        #[unsafe(method_family = init)]
551        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
552    );
553}
554
555/// Methods declared on superclass `NSObject`.
556#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
557impl NSButton {
558    extern_methods!(
559        #[unsafe(method(new))]
560        #[unsafe(method_family = new)]
561        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
562    );
563}
564
565/// NSButtonDeprecated.
566#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
567impl NSButton {
568    extern_methods!(
569        #[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
570        #[unsafe(method(setTitleWithMnemonic:))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
573    );
574}