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