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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe fn color(&self) -> Retained<NSColor>;
68
69        #[cfg(feature = "NSColor")]
70        /// Setter for [`color`][Self::color].
71        #[unsafe(method(setColor:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setColor(&self, color: &NSColor);
74
75        /// Whether or not the picker should allow picking a color with non-1.0 alpha. Defaults to `!NSColor.ignoresAlpha`.
76        #[unsafe(method(showsAlpha))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn showsAlpha(&self) -> bool;
79
80        /// Setter for [`showsAlpha`][Self::showsAlpha].
81        #[unsafe(method(setShowsAlpha:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);
84
85        #[cfg(feature = "NSColorSpace")]
86        /// 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`.
87        #[unsafe(method(allowedColorSpaces))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn allowedColorSpaces(&self) -> Option<Retained<NSArray<NSColorSpace>>>;
90
91        #[cfg(feature = "NSColorSpace")]
92        /// Setter for [`allowedColorSpaces`][Self::allowedColorSpaces].
93        #[unsafe(method(setAllowedColorSpaces:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setAllowedColorSpaces(
96            &self,
97            allowed_color_spaces: Option<&NSArray<NSColorSpace>>,
98        );
99
100        #[cfg(feature = "NSColorList")]
101        /// 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.
102        #[unsafe(method(colorList))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn colorList(&self) -> Option<Retained<NSColorList>>;
105
106        #[cfg(feature = "NSColorList")]
107        /// Setter for [`colorList`][Self::colorList].
108        #[unsafe(method(setColorList:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setColorList(&self, color_list: Option<&NSColorList>);
111
112        /// The localized string labelling this item during user customization. The default value is the localized string of "Color Picker".
113        #[unsafe(method(customizationLabel))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
116
117        /// Setter for [`customizationLabel`][Self::customizationLabel].
118        #[unsafe(method(setCustomizationLabel:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
121
122        #[unsafe(method(target))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
125
126        /// This is a [weak property][objc2::topics::weak_property].
127        /// Setter for [`target`][Self::target].
128        #[unsafe(method(setTarget:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
131
132        #[unsafe(method(action))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn action(&self) -> Option<Sel>;
135
136        /// Setter for [`action`][Self::action].
137        #[unsafe(method(setAction:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setAction(&self, action: Option<Sel>);
140
141        /// Enables or disabled the color picker. If it is currently being shown in a popover, it will be dismissed.
142        #[unsafe(method(isEnabled))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn isEnabled(&self) -> bool;
145
146        /// Setter for [`isEnabled`][Self::isEnabled].
147        #[unsafe(method(setEnabled:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setEnabled(&self, enabled: bool);
150    );
151}
152
153/// Methods declared on superclass `NSTouchBarItem`.
154#[cfg(feature = "NSTouchBarItem")]
155impl NSColorPickerTouchBarItem {
156    extern_methods!(
157        #[unsafe(method(initWithIdentifier:))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn initWithIdentifier(
160            this: Allocated<Self>,
161            identifier: &NSTouchBarItemIdentifier,
162        ) -> Retained<Self>;
163
164        #[unsafe(method(initWithCoder:))]
165        #[unsafe(method_family = init)]
166        pub unsafe fn initWithCoder(
167            this: Allocated<Self>,
168            coder: &NSCoder,
169        ) -> Option<Retained<Self>>;
170
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174    );
175}
176
177/// Methods declared on superclass `NSObject`.
178#[cfg(feature = "NSTouchBarItem")]
179impl NSColorPickerTouchBarItem {
180    extern_methods!(
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
184    );
185}