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))]
24extern_conformance!(
25    unsafe impl NSAccessibility for NSButton {}
26);
27
28#[cfg(all(
29    feature = "NSAccessibilityProtocols",
30    feature = "NSControl",
31    feature = "NSResponder",
32    feature = "NSView"
33))]
34extern_conformance!(
35    unsafe impl NSAccessibilityButton for NSButton {}
36);
37
38#[cfg(all(
39    feature = "NSAccessibilityProtocols",
40    feature = "NSControl",
41    feature = "NSResponder",
42    feature = "NSView"
43))]
44extern_conformance!(
45    unsafe impl NSAccessibilityElementProtocol for NSButton {}
46);
47
48#[cfg(all(
49    feature = "NSAnimation",
50    feature = "NSControl",
51    feature = "NSResponder",
52    feature = "NSView"
53))]
54extern_conformance!(
55    unsafe impl NSAnimatablePropertyContainer for NSButton {}
56);
57
58#[cfg(all(
59    feature = "NSAppearance",
60    feature = "NSControl",
61    feature = "NSResponder",
62    feature = "NSView"
63))]
64extern_conformance!(
65    unsafe impl NSAppearanceCustomization for NSButton {}
66);
67
68#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
69extern_conformance!(
70    unsafe impl NSCoding for NSButton {}
71);
72
73#[cfg(all(
74    feature = "NSControl",
75    feature = "NSDragging",
76    feature = "NSResponder",
77    feature = "NSView"
78))]
79extern_conformance!(
80    unsafe impl NSDraggingDestination for NSButton {}
81);
82
83#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
84extern_conformance!(
85    unsafe impl NSObjectProtocol for NSButton {}
86);
87
88#[cfg(all(
89    feature = "NSControl",
90    feature = "NSResponder",
91    feature = "NSUserInterfaceCompression",
92    feature = "NSView"
93))]
94extern_conformance!(
95    unsafe impl NSUserInterfaceCompression for NSButton {}
96);
97
98#[cfg(all(
99    feature = "NSControl",
100    feature = "NSResponder",
101    feature = "NSUserInterfaceItemIdentification",
102    feature = "NSView"
103))]
104extern_conformance!(
105    unsafe impl NSUserInterfaceItemIdentification for NSButton {}
106);
107
108#[cfg(all(
109    feature = "NSControl",
110    feature = "NSResponder",
111    feature = "NSUserInterfaceValidation",
112    feature = "NSView"
113))]
114extern_conformance!(
115    unsafe impl NSUserInterfaceValidations for NSButton {}
116);
117
118#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
119impl NSButton {
120    extern_methods!(
121        #[cfg(feature = "NSImage")]
122        /// Creates a standard push button with a title and image.
123        ///
124        /// Parameter `title`: The localized title string that is displayed on the button.
125        ///
126        /// 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.
127        ///
128        /// Parameter `target`: The target object that receives action messages from the control.
129        ///
130        /// Parameter `action`: The action message sent by the control.
131        ///
132        /// Returns: An initialized button object.
133        #[unsafe(method(buttonWithTitle:image:target:action:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn buttonWithTitle_image_target_action(
136            title: &NSString,
137            image: &NSImage,
138            target: Option<&AnyObject>,
139            action: Option<Sel>,
140            mtm: MainThreadMarker,
141        ) -> Retained<Self>;
142
143        /// Creates a standard push button with the provided title.
144        ///
145        /// Parameter `title`: The localized title string that is displayed on the button.
146        ///
147        /// Parameter `target`: The target object that receives action messages from the control.
148        ///
149        /// Parameter `action`: The action message sent by the control.
150        ///
151        /// Returns: An initialized button object.
152        #[unsafe(method(buttonWithTitle:target:action:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn buttonWithTitle_target_action(
155            title: &NSString,
156            target: Option<&AnyObject>,
157            action: Option<Sel>,
158            mtm: MainThreadMarker,
159        ) -> Retained<Self>;
160
161        #[cfg(feature = "NSImage")]
162        /// Creates a standard push button with the provided image. Set the image's accessibilityDescription property to ensure accessibility for this control.
163        ///
164        /// Parameter `image`: The image to display in the body of the button.
165        ///
166        /// Parameter `target`: The target object that receives action messages from the control.
167        ///
168        /// Parameter `action`: The action message sent by the control.
169        ///
170        /// Returns: An initialized button object.
171        #[unsafe(method(buttonWithImage:target:action:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn buttonWithImage_target_action(
174            image: &NSImage,
175            target: Option<&AnyObject>,
176            action: Option<Sel>,
177            mtm: MainThreadMarker,
178        ) -> Retained<Self>;
179
180        /// Creates a standard checkbox with the provided title.
181        ///
182        /// Parameter `title`: The localized title string that is displayed alongside the checkbox.
183        ///
184        /// Parameter `target`: The target object that receives action messages from the control.
185        ///
186        /// Parameter `action`: The action message sent by the control.
187        ///
188        /// Returns: An initialized button object.
189        #[unsafe(method(checkboxWithTitle:target:action:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn checkboxWithTitle_target_action(
192            title: &NSString,
193            target: Option<&AnyObject>,
194            action: Option<Sel>,
195            mtm: MainThreadMarker,
196        ) -> Retained<Self>;
197
198        /// Creates a standard radio button with the provided title.
199        ///
200        /// Parameter `title`: The localized title string that is displayed alongside the radio button.
201        ///
202        /// Parameter `target`: The target object that receives action messages from the control.
203        ///
204        /// Parameter `action`: The action message sent by the control.
205        ///
206        /// Returns: An initialized button object.
207        #[unsafe(method(radioButtonWithTitle:target:action:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn radioButtonWithTitle_target_action(
210            title: &NSString,
211            target: Option<&AnyObject>,
212            action: Option<Sel>,
213            mtm: MainThreadMarker,
214        ) -> Retained<Self>;
215
216        #[cfg(feature = "NSButtonCell")]
217        /// Sets the button’s type, which affects its user interface and behavior when clicked. See the NSButtonType enumeration for possible options and their behaviors.
218        #[unsafe(method(setButtonType:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn setButtonType(&self, r#type: NSButtonType);
221
222        /// 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".
223        #[unsafe(method(title))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn title(&self) -> Retained<NSString>;
226
227        /// Setter for [`title`][Self::title].
228        #[unsafe(method(setTitle:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn setTitle(&self, title: &NSString);
231
232        /// The button's title, expressed as an attributed string.
233        #[unsafe(method(attributedTitle))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
236
237        /// Setter for [`attributedTitle`][Self::attributedTitle].
238        #[unsafe(method(setAttributedTitle:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
241
242        /// 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.
243        #[unsafe(method(alternateTitle))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
246
247        /// Setter for [`alternateTitle`][Self::alternateTitle].
248        #[unsafe(method(setAlternateTitle:))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
251
252        /// The alternate title, expressed as an attributed string.
253        #[unsafe(method(attributedAlternateTitle))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
256
257        /// Setter for [`attributedAlternateTitle`][Self::attributedAlternateTitle].
258        #[unsafe(method(setAttributedAlternateTitle:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn setAttributedAlternateTitle(
261            &self,
262            attributed_alternate_title: &NSAttributedString,
263        );
264
265        /// 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.
266        #[unsafe(method(hasDestructiveAction))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn hasDestructiveAction(&self) -> bool;
269
270        /// Setter for [`hasDestructiveAction`][Self::hasDestructiveAction].
271        #[unsafe(method(setHasDestructiveAction:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setHasDestructiveAction(&self, has_destructive_action: bool);
274
275        #[cfg(feature = "NSSound")]
276        /// 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.
277        #[unsafe(method(sound))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;
280
281        #[cfg(feature = "NSSound")]
282        /// Setter for [`sound`][Self::sound].
283        #[unsafe(method(setSound:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn setSound(&self, sound: Option<&NSSound>);
286
287        /// Sends action on deep-press or extended hover while dragging. Defaults to NO.
288        #[unsafe(method(isSpringLoaded))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn isSpringLoaded(&self) -> bool;
291
292        /// Setter for [`isSpringLoaded`][Self::isSpringLoaded].
293        #[unsafe(method(setSpringLoaded:))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn setSpringLoaded(&self, spring_loaded: bool);
296
297        /// Configures the maximum allowed level for an NSMultiLevelAcceleratorButton, allowed values range from [1,5]. Defaults to 2.
298        #[unsafe(method(maxAcceleratorLevel))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn maxAcceleratorLevel(&self) -> NSInteger;
301
302        /// Setter for [`maxAcceleratorLevel`][Self::maxAcceleratorLevel].
303        #[unsafe(method(setMaxAcceleratorLevel:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn setMaxAcceleratorLevel(&self, max_accelerator_level: NSInteger);
306
307        /// Sets the initial delay and repeat interval, in seconds, for repeated action messages sent when `continuous` is YES.
308        #[unsafe(method(setPeriodicDelay:interval:))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
311
312        /// 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.
313        #[unsafe(method(getPeriodicDelay:interval:))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn getPeriodicDelay_interval(
316            &self,
317            delay: NonNull<c_float>,
318            interval: NonNull<c_float>,
319        );
320
321        #[cfg(feature = "NSButtonCell")]
322        /// 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`.
323        #[unsafe(method(bezelStyle))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn bezelStyle(&self) -> NSBezelStyle;
326
327        #[cfg(feature = "NSButtonCell")]
328        /// Setter for [`bezelStyle`][Self::bezelStyle].
329        #[unsafe(method(setBezelStyle:))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);
332
333        /// A Boolean value that determines whether the button draws a border.
334        #[unsafe(method(isBordered))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn isBordered(&self) -> bool;
337
338        /// Setter for [`isBordered`][Self::isBordered].
339        #[unsafe(method(setBordered:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn setBordered(&self, bordered: bool);
342
343        /// 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.
344        #[unsafe(method(isTransparent))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn isTransparent(&self) -> bool;
347
348        /// Setter for [`isTransparent`][Self::isTransparent].
349        #[unsafe(method(setTransparent:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn setTransparent(&self, transparent: bool);
352
353        #[unsafe(method(showsBorderOnlyWhileMouseInside))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;
356
357        /// Setter for [`showsBorderOnlyWhileMouseInside`][Self::showsBorderOnlyWhileMouseInside].
358        #[unsafe(method(setShowsBorderOnlyWhileMouseInside:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setShowsBorderOnlyWhileMouseInside(
361            &self,
362            shows_border_only_while_mouse_inside: bool,
363        );
364
365        #[cfg(feature = "NSColor")]
366        /// 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.
367        #[unsafe(method(bezelColor))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn bezelColor(&self) -> Option<Retained<NSColor>>;
370
371        #[cfg(feature = "NSColor")]
372        /// Setter for [`bezelColor`][Self::bezelColor].
373        #[unsafe(method(setBezelColor:))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn setBezelColor(&self, bezel_color: Option<&NSColor>);
376
377        #[cfg(feature = "NSColor")]
378        /// 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.
379        #[unsafe(method(contentTintColor))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn contentTintColor(&self) -> Option<Retained<NSColor>>;
382
383        #[cfg(feature = "NSColor")]
384        /// Setter for [`contentTintColor`][Self::contentTintColor].
385        #[unsafe(method(setContentTintColor:))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn setContentTintColor(&self, content_tint_color: Option<&NSColor>);
388
389        #[cfg(feature = "NSImage")]
390        /// The image that appears on the button when it’s in an off state, or nil if there is no such image.
391        #[unsafe(method(image))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
394
395        #[cfg(feature = "NSImage")]
396        /// Setter for [`image`][Self::image].
397        #[unsafe(method(setImage:))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn setImage(&self, image: Option<&NSImage>);
400
401        #[cfg(feature = "NSImage")]
402        /// 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.
403        #[unsafe(method(alternateImage))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
406
407        #[cfg(feature = "NSImage")]
408        /// Setter for [`alternateImage`][Self::alternateImage].
409        #[unsafe(method(setAlternateImage:))]
410        #[unsafe(method_family = none)]
411        pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
412
413        #[cfg(feature = "NSCell")]
414        /// The position of the button's image relative to its title. See the NSCellImagePosition enumeration for possible values.
415        #[unsafe(method(imagePosition))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn imagePosition(&self) -> NSCellImagePosition;
418
419        #[cfg(feature = "NSCell")]
420        /// Setter for [`imagePosition`][Self::imagePosition].
421        #[unsafe(method(setImagePosition:))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);
424
425        #[cfg(feature = "NSCell")]
426        /// The scaling mode applied to make the button's image fit within its bounds.
427        #[unsafe(method(imageScaling))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn imageScaling(&self) -> NSImageScaling;
430
431        #[cfg(feature = "NSCell")]
432        /// Setter for [`imageScaling`][Self::imageScaling].
433        #[unsafe(method(setImageScaling:))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
436
437        /// 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.
438        #[unsafe(method(imageHugsTitle))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn imageHugsTitle(&self) -> bool;
441
442        /// Setter for [`imageHugsTitle`][Self::imageHugsTitle].
443        #[unsafe(method(setImageHugsTitle:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn setImageHugsTitle(&self, image_hugs_title: bool);
446
447        #[cfg(feature = "NSImage")]
448        /// 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.
449        #[unsafe(method(symbolConfiguration))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn symbolConfiguration(&self) -> Option<Retained<NSImageSymbolConfiguration>>;
452
453        #[cfg(feature = "NSImage")]
454        /// Setter for [`symbolConfiguration`][Self::symbolConfiguration].
455        #[unsafe(method(setSymbolConfiguration:))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn setSymbolConfiguration(
458            &self,
459            symbol_configuration: Option<&NSImageSymbolConfiguration>,
460        );
461
462        #[cfg(feature = "NSCell")]
463        /// The button's state. Buttons support the off and on states, and an additional mixed state depending on the value of the `allowsMixedState` property.
464        #[unsafe(method(state))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn state(&self) -> NSControlStateValue;
467
468        #[cfg(feature = "NSCell")]
469        /// Setter for [`state`][Self::state].
470        #[unsafe(method(setState:))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn setState(&self, state: NSControlStateValue);
473
474        /// 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.
475        #[unsafe(method(allowsMixedState))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn allowsMixedState(&self) -> bool;
478
479        /// Setter for [`allowsMixedState`][Self::allowsMixedState].
480        #[unsafe(method(setAllowsMixedState:))]
481        #[unsafe(method_family = none)]
482        pub unsafe fn setAllowsMixedState(&self, allows_mixed_state: bool);
483
484        /// 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.
485        #[unsafe(method(setNextState))]
486        #[unsafe(method_family = none)]
487        pub unsafe fn setNextState(&self);
488
489        /// 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.
490        #[unsafe(method(highlight:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn highlight(&self, flag: bool);
493
494        /// 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.
495        #[unsafe(method(keyEquivalent))]
496        #[unsafe(method_family = none)]
497        pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
498
499        /// Setter for [`keyEquivalent`][Self::keyEquivalent].
500        #[unsafe(method(setKeyEquivalent:))]
501        #[unsafe(method_family = none)]
502        pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
503
504        #[cfg(feature = "NSEvent")]
505        /// 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.
506        #[unsafe(method(keyEquivalentModifierMask))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
509
510        #[cfg(feature = "NSEvent")]
511        /// Setter for [`keyEquivalentModifierMask`][Self::keyEquivalentModifierMask].
512        #[unsafe(method(setKeyEquivalentModifierMask:))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn setKeyEquivalentModifierMask(
515            &self,
516            key_equivalent_modifier_mask: NSEventModifierFlags,
517        );
518
519        #[cfg(feature = "NSEvent")]
520        /// 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.
521        #[unsafe(method(performKeyEquivalent:))]
522        #[unsafe(method_family = none)]
523        pub unsafe fn performKeyEquivalent(&self, key: &NSEvent) -> bool;
524
525        #[cfg(feature = "NSUserInterfaceCompression")]
526        #[unsafe(method(compressWithPrioritizedCompressionOptions:))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn compressWithPrioritizedCompressionOptions(
529            &self,
530            prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
531        );
532
533        #[cfg(feature = "NSUserInterfaceCompression")]
534        #[unsafe(method(minimumSizeWithPrioritizedCompressionOptions:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn minimumSizeWithPrioritizedCompressionOptions(
537            &self,
538            prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
539        ) -> NSSize;
540
541        #[cfg(feature = "NSUserInterfaceCompression")]
542        #[unsafe(method(activeCompressionOptions))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn activeCompressionOptions(
545            &self,
546        ) -> Retained<NSUserInterfaceCompressionOptions>;
547    );
548}
549
550/// Methods declared on superclass `NSControl`.
551#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
552impl NSButton {
553    extern_methods!(
554        #[unsafe(method(initWithFrame:))]
555        #[unsafe(method_family = init)]
556        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
557
558        #[unsafe(method(initWithCoder:))]
559        #[unsafe(method_family = init)]
560        pub unsafe fn initWithCoder(
561            this: Allocated<Self>,
562            coder: &NSCoder,
563        ) -> Option<Retained<Self>>;
564    );
565}
566
567/// Methods declared on superclass `NSResponder`.
568#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
569impl NSButton {
570    extern_methods!(
571        #[unsafe(method(init))]
572        #[unsafe(method_family = init)]
573        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
574    );
575}
576
577/// Methods declared on superclass `NSObject`.
578#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
579impl NSButton {
580    extern_methods!(
581        #[unsafe(method(new))]
582        #[unsafe(method_family = new)]
583        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
584    );
585}
586
587/// NSButtonDeprecated.
588#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
589impl NSButton {
590    extern_methods!(
591        #[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
592        #[unsafe(method(setTitleWithMnemonic:))]
593        #[unsafe(method_family = none)]
594        pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
595    );
596}