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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSButtonType(pub NSUInteger);
impl NSButtonType {
    #[doc(alias = "NSButtonTypeMomentaryLight")]
    pub const MomentaryLight: Self = Self(0);
    #[doc(alias = "NSButtonTypePushOnPushOff")]
    pub const PushOnPushOff: Self = Self(1);
    #[doc(alias = "NSButtonTypeToggle")]
    pub const Toggle: Self = Self(2);
    #[doc(alias = "NSButtonTypeSwitch")]
    pub const Switch: Self = Self(3);
    #[doc(alias = "NSButtonTypeRadio")]
    pub const Radio: Self = Self(4);
    #[doc(alias = "NSButtonTypeMomentaryChange")]
    pub const MomentaryChange: Self = Self(5);
    #[doc(alias = "NSButtonTypeOnOff")]
    pub const OnOff: Self = Self(6);
    #[doc(alias = "NSButtonTypeMomentaryPushIn")]
    pub const MomentaryPushIn: Self = Self(7);
    #[doc(alias = "NSButtonTypeAccelerator")]
    pub const Accelerator: Self = Self(8);
    #[doc(alias = "NSButtonTypeMultiLevelAccelerator")]
    pub const MultiLevelAccelerator: Self = Self(9);
}

unsafe impl Encode for NSButtonType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSButtonType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBezelStyle(pub NSUInteger);
impl NSBezelStyle {
    #[doc(alias = "NSBezelStyleAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "NSBezelStylePush")]
    pub const Push: Self = Self(1);
    #[doc(alias = "NSBezelStyleFlexiblePush")]
    pub const FlexiblePush: Self = Self(2);
    #[doc(alias = "NSBezelStyleDisclosure")]
    pub const Disclosure: Self = Self(5);
    #[doc(alias = "NSBezelStyleCircular")]
    pub const Circular: Self = Self(7);
    #[doc(alias = "NSBezelStyleHelpButton")]
    pub const HelpButton: Self = Self(9);
    #[doc(alias = "NSBezelStyleSmallSquare")]
    pub const SmallSquare: Self = Self(10);
    #[doc(alias = "NSBezelStyleToolbar")]
    pub const Toolbar: Self = Self(11);
    #[doc(alias = "NSBezelStyleAccessoryBarAction")]
    pub const AccessoryBarAction: Self = Self(12);
    #[doc(alias = "NSBezelStyleAccessoryBar")]
    pub const AccessoryBar: Self = Self(13);
    #[doc(alias = "NSBezelStylePushDisclosure")]
    pub const PushDisclosure: Self = Self(14);
    #[doc(alias = "NSBezelStyleBadge")]
    pub const Badge: Self = Self(15);
    #[deprecated]
    #[doc(alias = "NSBezelStyleShadowlessSquare")]
    pub const ShadowlessSquare: Self = Self(6);
    #[deprecated]
    #[doc(alias = "NSBezelStyleTexturedSquare")]
    pub const TexturedSquare: Self = Self(8);
    #[deprecated]
    #[doc(alias = "NSBezelStyleRounded")]
    pub const Rounded: Self = Self(NSBezelStyle::Push.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleRegularSquare")]
    pub const RegularSquare: Self = Self(NSBezelStyle::FlexiblePush.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleTexturedRounded")]
    pub const TexturedRounded: Self = Self(NSBezelStyle::Toolbar.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleRoundRect")]
    pub const RoundRect: Self = Self(NSBezelStyle::AccessoryBarAction.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleRecessed")]
    pub const Recessed: Self = Self(NSBezelStyle::AccessoryBar.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleRoundedDisclosure")]
    pub const RoundedDisclosure: Self = Self(NSBezelStyle::PushDisclosure.0);
    #[deprecated]
    #[doc(alias = "NSBezelStyleInline")]
    pub const Inline: Self = Self(NSBezelStyle::Badge.0);
}

unsafe impl Encode for NSBezelStyle {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBezelStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    pub struct NSButtonCell;

    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    unsafe impl ClassType for NSButtonCell {
        #[inherits(NSCell, NSObject)]
        type Super = NSActionCell;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
unsafe impl NSAccessibility for NSButtonCell {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSButtonCell {}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCoding for NSButtonCell {}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCopying for NSButtonCell {}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSObjectProtocol for NSButtonCell {}

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSButtonCell {}

extern_methods!(
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    unsafe impl NSButtonCell {
        #[method_id(@__retain_semantics Init initTextCell:)]
        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[method_id(@__retain_semantics Init initImageCell:)]
        pub unsafe fn initImageCell(
            this: Allocated<Self>,
            image: Option<&NSImage>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[method(bezelStyle)]
        pub unsafe fn bezelStyle(&self) -> NSBezelStyle;

        #[method(setBezelStyle:)]
        pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);

        #[method(setButtonType:)]
        pub unsafe fn setButtonType(&self, r#type: NSButtonType);

        #[method(highlightsBy)]
        pub unsafe fn highlightsBy(&self) -> NSCellStyleMask;

        #[method(setHighlightsBy:)]
        pub unsafe fn setHighlightsBy(&self, highlights_by: NSCellStyleMask);

        #[method(showsStateBy)]
        pub unsafe fn showsStateBy(&self) -> NSCellStyleMask;

        #[method(setShowsStateBy:)]
        pub unsafe fn setShowsStateBy(&self, shows_state_by: NSCellStyleMask);

        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: Option<&NSString>);

        #[method_id(@__retain_semantics Other attributedTitle)]
        pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;

        #[method(setAttributedTitle:)]
        pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);

        #[method_id(@__retain_semantics Other alternateTitle)]
        pub unsafe fn alternateTitle(&self) -> Retained<NSString>;

        #[method(setAlternateTitle:)]
        pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);

        #[method_id(@__retain_semantics Other attributedAlternateTitle)]
        pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;

        #[method(setAttributedAlternateTitle:)]
        pub unsafe fn setAttributedAlternateTitle(
            &self,
            attributed_alternate_title: &NSAttributedString,
        );

        #[cfg(feature = "NSImage")]
        #[method_id(@__retain_semantics Other alternateImage)]
        pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;

        #[cfg(feature = "NSImage")]
        #[method(setAlternateImage:)]
        pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);

        #[method(imagePosition)]
        pub unsafe fn imagePosition(&self) -> NSCellImagePosition;

        #[method(setImagePosition:)]
        pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);

        #[method(imageScaling)]
        pub unsafe fn imageScaling(&self) -> NSImageScaling;

        #[method(setImageScaling:)]
        pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);

        #[method_id(@__retain_semantics Other keyEquivalent)]
        pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;

        #[method(setKeyEquivalent:)]
        pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);

        #[cfg(feature = "NSEvent")]
        #[method(keyEquivalentModifierMask)]
        pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;

        #[cfg(feature = "NSEvent")]
        #[method(setKeyEquivalentModifierMask:)]
        pub unsafe fn setKeyEquivalentModifierMask(
            &self,
            key_equivalent_modifier_mask: NSEventModifierFlags,
        );

        #[method(isTransparent)]
        pub unsafe fn isTransparent(&self) -> bool;

        #[method(setTransparent:)]
        pub unsafe fn setTransparent(&self, transparent: bool);

        #[method(isOpaque)]
        pub unsafe fn isOpaque(&self) -> bool;

        #[method(imageDimsWhenDisabled)]
        pub unsafe fn imageDimsWhenDisabled(&self) -> bool;

        #[method(setImageDimsWhenDisabled:)]
        pub unsafe fn setImageDimsWhenDisabled(&self, image_dims_when_disabled: bool);

        #[method(showsBorderOnlyWhileMouseInside)]
        pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;

        #[method(setShowsBorderOnlyWhileMouseInside:)]
        pub unsafe fn setShowsBorderOnlyWhileMouseInside(
            &self,
            shows_border_only_while_mouse_inside: bool,
        );

        #[cfg(feature = "NSSound")]
        #[method_id(@__retain_semantics Other sound)]
        pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;

        #[cfg(feature = "NSSound")]
        #[method(setSound:)]
        pub unsafe fn setSound(&self, sound: Option<&NSSound>);

        #[cfg(feature = "NSColor")]
        #[method_id(@__retain_semantics Other backgroundColor)]
        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;

        #[cfg(feature = "NSColor")]
        #[method(setBackgroundColor:)]
        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);

        #[method(setPeriodicDelay:interval:)]
        pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);

        #[method(getPeriodicDelay:interval:)]
        pub unsafe fn getPeriodicDelay_interval(
            &self,
            delay: NonNull<c_float>,
            interval: NonNull<c_float>,
        );

        #[method(performClick:)]
        pub unsafe fn performClick(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "NSEvent")]
        #[method(mouseEntered:)]
        pub unsafe fn mouseEntered(&self, event: &NSEvent);

        #[cfg(feature = "NSEvent")]
        #[method(mouseExited:)]
        pub unsafe fn mouseExited(&self, event: &NSEvent);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[method(drawBezelWithFrame:inView:)]
        pub unsafe fn drawBezelWithFrame_inView(&self, frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSImage", feature = "NSResponder", feature = "NSView"))]
        #[method(drawImage:withFrame:inView:)]
        pub unsafe fn drawImage_withFrame_inView(
            &self,
            image: &NSImage,
            frame: NSRect,
            control_view: &NSView,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[method(drawTitle:withFrame:inView:)]
        pub unsafe fn drawTitle_withFrame_inView(
            &self,
            title: &NSAttributedString,
            frame: NSRect,
            control_view: &NSView,
        ) -> NSRect;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSCell`
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    unsafe impl NSButtonCell {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    unsafe impl NSButtonCell {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

// NS_ENUM
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGradientType(pub NSUInteger);
impl NSGradientType {
    pub const NSGradientNone: Self = Self(0);
    pub const NSGradientConcaveWeak: Self = Self(1);
    pub const NSGradientConcaveStrong: Self = Self(2);
    pub const NSGradientConvexWeak: Self = Self(3);
    pub const NSGradientConvexStrong: Self = Self(4);
}

unsafe impl Encode for NSGradientType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSGradientType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

pub static NSMomentaryLightButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);

pub static NSPushOnPushOffButton: NSButtonType = NSButtonType(NSButtonType::PushOnPushOff.0);

pub static NSToggleButton: NSButtonType = NSButtonType(NSButtonType::Toggle.0);

pub static NSSwitchButton: NSButtonType = NSButtonType(NSButtonType::Switch.0);

pub static NSRadioButton: NSButtonType = NSButtonType(NSButtonType::Radio.0);

pub static NSMomentaryChangeButton: NSButtonType = NSButtonType(NSButtonType::MomentaryChange.0);

pub static NSOnOffButton: NSButtonType = NSButtonType(NSButtonType::OnOff.0);

pub static NSMomentaryPushInButton: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);

pub static NSAcceleratorButton: NSButtonType = NSButtonType(NSButtonType::Accelerator.0);

pub static NSMultiLevelAcceleratorButton: NSButtonType =
    NSButtonType(NSButtonType::MultiLevelAccelerator.0);

pub static NSMomentaryPushButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);

pub static NSMomentaryLight: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);

pub static NSRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Push.0);

pub static NSRegularSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::FlexiblePush.0);

pub static NSDisclosureBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Disclosure.0);

pub static NSShadowlessSquareBezelStyle: NSBezelStyle =
    NSBezelStyle(NSBezelStyle::ShadowlessSquare.0);

pub static NSCircularBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Circular.0);

pub static NSTexturedSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::TexturedSquare.0);

pub static NSHelpButtonBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::HelpButton.0);

pub static NSSmallSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::SmallSquare.0);

pub static NSTexturedRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Toolbar.0);

pub static NSRoundRectBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBarAction.0);

pub static NSRecessedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBar.0);

pub static NSRoundedDisclosureBezelStyle: NSBezelStyle =
    NSBezelStyle(NSBezelStyle::PushDisclosure.0);

pub static NSInlineBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Badge.0);

pub static NSSmallIconButtonBezelStyle: NSBezelStyle = NSBezelStyle(2);

pub static NSThickSquareBezelStyle: NSBezelStyle = NSBezelStyle(3);

pub static NSThickerSquareBezelStyle: NSBezelStyle = NSBezelStyle(4);

extern_methods!(
    /// NSDeprecated
    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
    unsafe impl NSButtonCell {
        #[deprecated = "The gradientType property is unused, and setting it has no effect."]
        #[method(gradientType)]
        pub unsafe fn gradientType(&self) -> NSGradientType;

        #[deprecated = "The gradientType property is unused, and setting it has no effect."]
        #[method(setGradientType:)]
        pub unsafe fn setGradientType(&self, gradient_type: NSGradientType);

        #[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
        #[method(setTitleWithMnemonic:)]
        pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);

        #[deprecated = "Mnemonics are not used on macOS. Set the alternateTitle property directly instead."]
        #[method(setAlternateTitleWithMnemonic:)]
        pub unsafe fn setAlternateTitleWithMnemonic(
            &self,
            string_with_ampersand: Option<&NSString>,
        );

        #[deprecated = "Mnemonics are not used on macOS. Calling this method has no effect."]
        #[method(setAlternateMnemonicLocation:)]
        pub unsafe fn setAlternateMnemonicLocation(&self, location: NSUInteger);

        #[deprecated = "Mnemonics are not used on macOS. This property always returns NSNotFound."]
        #[method(alternateMnemonicLocation)]
        pub unsafe fn alternateMnemonicLocation(&self) -> NSUInteger;

        #[deprecated = "Mnemonics are not used on macOS. This property always returns an empty string."]
        #[method_id(@__retain_semantics Other alternateMnemonic)]
        pub unsafe fn alternateMnemonic(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSFont")]
        #[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
        #[method_id(@__retain_semantics Other keyEquivalentFont)]
        pub unsafe fn keyEquivalentFont(&self) -> Option<Retained<NSFont>>;

        #[cfg(feature = "NSFont")]
        #[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
        #[method(setKeyEquivalentFont:)]
        pub unsafe fn setKeyEquivalentFont(&self, key_equivalent_font: Option<&NSFont>);

        #[deprecated = "The keyEquivalentFont property is no longer used. Setting it has no effect."]
        #[method(setKeyEquivalentFont:size:)]
        pub unsafe fn setKeyEquivalentFont_size(&self, font_name: &NSString, font_size: CGFloat);
    }
);