objc2_app_kit/generated/
NSColorPickerTouchBarItem.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/nscolorpickertouchbaritem?language=objc)
12    #[unsafe(super(NSTouchBarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSTouchBarItem")]
15    pub struct NSColorPickerTouchBarItem;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19extern_conformance!(
20    unsafe impl NSCoding for NSColorPickerTouchBarItem {}
21);
22
23#[cfg(feature = "NSTouchBarItem")]
24extern_conformance!(
25    unsafe impl NSObjectProtocol for NSColorPickerTouchBarItem {}
26);
27
28#[cfg(feature = "NSTouchBarItem")]
29impl NSColorPickerTouchBarItem {
30    extern_methods!(
31        /// Creates a bar item containing a button with the standard color picker icon that invokes the color picker.
32        #[unsafe(method(colorPickerWithIdentifier:))]
33        #[unsafe(method_family = none)]
34        pub fn colorPickerWithIdentifier(
35            identifier: &NSTouchBarItemIdentifier,
36            mtm: MainThreadMarker,
37        ) -> Retained<Self>;
38
39        /// Creates a bar item containing a button with the standard text color picker icon that invokes the color picker. Should be used when the item is used for picking text colors.
40        #[unsafe(method(textColorPickerWithIdentifier:))]
41        #[unsafe(method_family = none)]
42        pub fn textColorPickerWithIdentifier(
43            identifier: &NSTouchBarItemIdentifier,
44            mtm: MainThreadMarker,
45        ) -> Retained<Self>;
46
47        /// Creates a bar item containing a button with the standard stroke color picker icon that invokes the color picker. Should be used when the item is used for picking stroke colors.
48        #[unsafe(method(strokeColorPickerWithIdentifier:))]
49        #[unsafe(method_family = none)]
50        pub fn strokeColorPickerWithIdentifier(
51            identifier: &NSTouchBarItemIdentifier,
52            mtm: MainThreadMarker,
53        ) -> Retained<Self>;
54
55        #[cfg(feature = "NSImage")]
56        #[unsafe(method(colorPickerWithIdentifier:buttonImage:))]
57        #[unsafe(method_family = none)]
58        pub fn colorPickerWithIdentifier_buttonImage(
59            identifier: &NSTouchBarItemIdentifier,
60            image: &NSImage,
61            mtm: MainThreadMarker,
62        ) -> Retained<Self>;
63
64        #[cfg(feature = "NSColor")]
65        #[unsafe(method(color))]
66        #[unsafe(method_family = none)]
67        pub fn color(&self) -> Retained<NSColor>;
68
69        #[cfg(feature = "NSColor")]
70        /// Setter for [`color`][Self::color].
71        ///
72        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
73        #[unsafe(method(setColor:))]
74        #[unsafe(method_family = none)]
75        pub fn setColor(&self, color: &NSColor);
76
77        /// Whether or not the picker should allow picking a color with non-1.0 alpha. Defaults to `!NSColor.ignoresAlpha`.
78        #[unsafe(method(showsAlpha))]
79        #[unsafe(method_family = none)]
80        pub fn showsAlpha(&self) -> bool;
81
82        /// Setter for [`showsAlpha`][Self::showsAlpha].
83        #[unsafe(method(setShowsAlpha:))]
84        #[unsafe(method_family = none)]
85        pub fn setShowsAlpha(&self, shows_alpha: bool);
86
87        #[cfg(feature = "NSColorSpace")]
88        /// Controls the color spaces that the receiver is able to produce. If a color outside of the allowed spaces are displayed or selected, it will first be converted to the first color space in the array. `nil` signifies any color space is allowed. Empty array is an invalid value and will raise an exception if set. Defaults to `nil`.
89        #[unsafe(method(allowedColorSpaces))]
90        #[unsafe(method_family = none)]
91        pub fn allowedColorSpaces(&self) -> Option<Retained<NSArray<NSColorSpace>>>;
92
93        #[cfg(feature = "NSColorSpace")]
94        /// Setter for [`allowedColorSpaces`][Self::allowedColorSpaces].
95        ///
96        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
97        #[unsafe(method(setAllowedColorSpaces:))]
98        #[unsafe(method_family = none)]
99        pub fn setAllowedColorSpaces(&self, allowed_color_spaces: Option<&NSArray<NSColorSpace>>);
100
101        #[cfg(feature = "NSColorList")]
102        /// The color list displayed in the list color picker. Defaults to the standard system color list. Setting a custom color list will disable the additional tints/shades that appear on long-press.
103        #[unsafe(method(colorList))]
104        #[unsafe(method_family = none)]
105        pub fn colorList(&self) -> Option<Retained<NSColorList>>;
106
107        #[cfg(feature = "NSColorList")]
108        /// Setter for [`colorList`][Self::colorList].
109        ///
110        /// # Safety
111        ///
112        /// `color_list` might not allow `None`.
113        #[unsafe(method(setColorList:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setColorList(&self, color_list: Option<&NSColorList>);
116
117        /// The localized string labelling this item during user customization. The default value is the localized string of "Color Picker".
118        #[unsafe(method(customizationLabel))]
119        #[unsafe(method_family = none)]
120        pub fn customizationLabel(&self) -> Retained<NSString>;
121
122        /// Setter for [`customizationLabel`][Self::customizationLabel].
123        ///
124        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
125        #[unsafe(method(setCustomizationLabel:))]
126        #[unsafe(method_family = none)]
127        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
128
129        #[unsafe(method(target))]
130        #[unsafe(method_family = none)]
131        pub fn target(&self) -> Option<Retained<AnyObject>>;
132
133        /// Setter for [`target`][Self::target].
134        ///
135        /// This is a [weak property][objc2::topics::weak_property].
136        ///
137        /// # Safety
138        ///
139        /// `target` should be of the correct type.
140        #[unsafe(method(setTarget:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
143
144        #[unsafe(method(action))]
145        #[unsafe(method_family = none)]
146        pub fn action(&self) -> Option<Sel>;
147
148        /// Setter for [`action`][Self::action].
149        ///
150        /// # Safety
151        ///
152        /// `action` must be a valid selector.
153        #[unsafe(method(setAction:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setAction(&self, action: Option<Sel>);
156
157        /// Enables or disabled the color picker. If it is currently being shown in a popover, it will be dismissed.
158        #[unsafe(method(isEnabled))]
159        #[unsafe(method_family = none)]
160        pub fn isEnabled(&self) -> bool;
161
162        /// Setter for [`isEnabled`][Self::isEnabled].
163        #[unsafe(method(setEnabled:))]
164        #[unsafe(method_family = none)]
165        pub fn setEnabled(&self, enabled: bool);
166    );
167}
168
169/// Methods declared on superclass `NSTouchBarItem`.
170#[cfg(feature = "NSTouchBarItem")]
171impl NSColorPickerTouchBarItem {
172    extern_methods!(
173        #[unsafe(method(initWithIdentifier:))]
174        #[unsafe(method_family = init)]
175        pub fn initWithIdentifier(
176            this: Allocated<Self>,
177            identifier: &NSTouchBarItemIdentifier,
178        ) -> Retained<Self>;
179
180        /// # Safety
181        ///
182        /// `coder` possibly has further requirements.
183        #[unsafe(method(initWithCoder:))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn initWithCoder(
186            this: Allocated<Self>,
187            coder: &NSCoder,
188        ) -> Option<Retained<Self>>;
189
190        #[unsafe(method(init))]
191        #[unsafe(method_family = init)]
192        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
193    );
194}
195
196/// Methods declared on superclass `NSObject`.
197#[cfg(feature = "NSTouchBarItem")]
198impl NSColorPickerTouchBarItem {
199    extern_methods!(
200        #[unsafe(method(new))]
201        #[unsafe(method_family = new)]
202        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
203    );
204}