objc2_app_kit/generated/
NSButtonTouchBarItem.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/nsbuttontouchbaritem?language=objc)
12    #[unsafe(super(NSTouchBarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSTouchBarItem")]
15    pub struct NSButtonTouchBarItem;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19unsafe impl NSCoding for NSButtonTouchBarItem {}
20
21#[cfg(feature = "NSTouchBarItem")]
22unsafe impl NSObjectProtocol for NSButtonTouchBarItem {}
23
24#[cfg(feature = "NSTouchBarItem")]
25impl NSButtonTouchBarItem {
26    extern_methods!(
27        #[unsafe(method(buttonTouchBarItemWithIdentifier:title:target:action:))]
28        #[unsafe(method_family = none)]
29        pub unsafe fn buttonTouchBarItemWithIdentifier_title_target_action(
30            identifier: &NSTouchBarItemIdentifier,
31            title: &NSString,
32            target: Option<&AnyObject>,
33            action: Option<Sel>,
34            mtm: MainThreadMarker,
35        ) -> Retained<Self>;
36
37        #[cfg(feature = "NSImage")]
38        #[unsafe(method(buttonTouchBarItemWithIdentifier:image:target:action:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn buttonTouchBarItemWithIdentifier_image_target_action(
41            identifier: &NSTouchBarItemIdentifier,
42            image: &NSImage,
43            target: Option<&AnyObject>,
44            action: Option<Sel>,
45            mtm: MainThreadMarker,
46        ) -> Retained<Self>;
47
48        #[cfg(feature = "NSImage")]
49        #[unsafe(method(buttonTouchBarItemWithIdentifier:title:image:target:action:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn buttonTouchBarItemWithIdentifier_title_image_target_action(
52            identifier: &NSTouchBarItemIdentifier,
53            title: &NSString,
54            image: &NSImage,
55            target: Option<&AnyObject>,
56            action: Option<Sel>,
57            mtm: MainThreadMarker,
58        ) -> Retained<Self>;
59
60        #[unsafe(method(title))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn title(&self) -> Retained<NSString>;
63
64        /// Setter for [`title`][Self::title].
65        #[unsafe(method(setTitle:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setTitle(&self, title: &NSString);
68
69        #[cfg(feature = "NSImage")]
70        #[unsafe(method(image))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
73
74        #[cfg(feature = "NSImage")]
75        /// Setter for [`image`][Self::image].
76        #[unsafe(method(setImage:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn setImage(&self, image: Option<&NSImage>);
79
80        #[cfg(feature = "NSColor")]
81        #[unsafe(method(bezelColor))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn bezelColor(&self) -> Option<Retained<NSColor>>;
84
85        #[cfg(feature = "NSColor")]
86        /// Setter for [`bezelColor`][Self::bezelColor].
87        #[unsafe(method(setBezelColor:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setBezelColor(&self, bezel_color: Option<&NSColor>);
90
91        #[unsafe(method(target))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
94
95        /// This is a [weak property][objc2::topics::weak_property].
96        /// Setter for [`target`][Self::target].
97        #[unsafe(method(setTarget:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
100
101        #[unsafe(method(action))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn action(&self) -> Option<Sel>;
104
105        /// Setter for [`action`][Self::action].
106        #[unsafe(method(setAction:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setAction(&self, action: Option<Sel>);
109
110        #[unsafe(method(isEnabled))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn isEnabled(&self) -> bool;
113
114        /// Setter for [`isEnabled`][Self::isEnabled].
115        #[unsafe(method(setEnabled:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setEnabled(&self, enabled: bool);
118
119        /// The localized string labelling this item during user customization. The default value is empty string.
120        #[unsafe(method(customizationLabel))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
123
124        /// Setter for [`customizationLabel`][Self::customizationLabel].
125        #[unsafe(method(setCustomizationLabel:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
128    );
129}
130
131/// Methods declared on superclass `NSTouchBarItem`.
132#[cfg(feature = "NSTouchBarItem")]
133impl NSButtonTouchBarItem {
134    extern_methods!(
135        #[unsafe(method(initWithIdentifier:))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn initWithIdentifier(
138            this: Allocated<Self>,
139            identifier: &NSTouchBarItemIdentifier,
140        ) -> Retained<Self>;
141
142        #[unsafe(method(initWithCoder:))]
143        #[unsafe(method_family = init)]
144        pub unsafe fn initWithCoder(
145            this: Allocated<Self>,
146            coder: &NSCoder,
147        ) -> Option<Retained<Self>>;
148
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152    );
153}
154
155/// Methods declared on superclass `NSObject`.
156#[cfg(feature = "NSTouchBarItem")]
157impl NSButtonTouchBarItem {
158    extern_methods!(
159        #[unsafe(method(new))]
160        #[unsafe(method_family = new)]
161        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
162    );
163}