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