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")]
19unsafe impl NSCoding for NSColorPickerTouchBarItem {}
20
21#[cfg(feature = "NSTouchBarItem")]
22unsafe impl NSObjectProtocol for NSColorPickerTouchBarItem {}
23
24#[cfg(feature = "NSTouchBarItem")]
25impl NSColorPickerTouchBarItem {
26    extern_methods!(
27        /// Creates a bar item containing a button with the standard color picker icon that invokes the color picker.
28        #[unsafe(method(colorPickerWithIdentifier:))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn colorPickerWithIdentifier(
31            identifier: &NSTouchBarItemIdentifier,
32            mtm: MainThreadMarker,
33        ) -> Retained<Self>;
34
35        /// 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.
36        #[unsafe(method(textColorPickerWithIdentifier:))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn textColorPickerWithIdentifier(
39            identifier: &NSTouchBarItemIdentifier,
40            mtm: MainThreadMarker,
41        ) -> Retained<Self>;
42
43        /// 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.
44        #[unsafe(method(strokeColorPickerWithIdentifier:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn strokeColorPickerWithIdentifier(
47            identifier: &NSTouchBarItemIdentifier,
48            mtm: MainThreadMarker,
49        ) -> Retained<Self>;
50
51        #[cfg(feature = "NSImage")]
52        #[unsafe(method(colorPickerWithIdentifier:buttonImage:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn colorPickerWithIdentifier_buttonImage(
55            identifier: &NSTouchBarItemIdentifier,
56            image: &NSImage,
57            mtm: MainThreadMarker,
58        ) -> Retained<Self>;
59
60        #[cfg(feature = "NSColor")]
61        #[unsafe(method(color))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn color(&self) -> Retained<NSColor>;
64
65        #[cfg(feature = "NSColor")]
66        /// Setter for [`color`][Self::color].
67        #[unsafe(method(setColor:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn setColor(&self, color: &NSColor);
70
71        /// Whether or not the picker should allow picking a color with non-1.0 alpha. Defaults to `!NSColor.ignoresAlpha`.
72        #[unsafe(method(showsAlpha))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn showsAlpha(&self) -> bool;
75
76        /// Setter for [`showsAlpha`][Self::showsAlpha].
77        #[unsafe(method(setShowsAlpha:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);
80
81        #[cfg(feature = "NSColorSpace")]
82        /// 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`.
83        #[unsafe(method(allowedColorSpaces))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn allowedColorSpaces(&self) -> Option<Retained<NSArray<NSColorSpace>>>;
86
87        #[cfg(feature = "NSColorSpace")]
88        /// Setter for [`allowedColorSpaces`][Self::allowedColorSpaces].
89        #[unsafe(method(setAllowedColorSpaces:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setAllowedColorSpaces(
92            &self,
93            allowed_color_spaces: Option<&NSArray<NSColorSpace>>,
94        );
95
96        #[cfg(feature = "NSColorList")]
97        /// 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.
98        #[unsafe(method(colorList))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn colorList(&self) -> Option<Retained<NSColorList>>;
101
102        #[cfg(feature = "NSColorList")]
103        /// Setter for [`colorList`][Self::colorList].
104        #[unsafe(method(setColorList:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setColorList(&self, color_list: Option<&NSColorList>);
107
108        /// The localized string labelling this item during user customization. The default value is the localized string of "Color Picker".
109        #[unsafe(method(customizationLabel))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
112
113        /// Setter for [`customizationLabel`][Self::customizationLabel].
114        #[unsafe(method(setCustomizationLabel:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
117
118        #[unsafe(method(target))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
121
122        /// This is a [weak property][objc2::topics::weak_property].
123        /// Setter for [`target`][Self::target].
124        #[unsafe(method(setTarget:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
127
128        #[unsafe(method(action))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn action(&self) -> Option<Sel>;
131
132        /// Setter for [`action`][Self::action].
133        #[unsafe(method(setAction:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setAction(&self, action: Option<Sel>);
136
137        /// Enables or disabled the color picker. If it is currently being shown in a popover, it will be dismissed.
138        #[unsafe(method(isEnabled))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn isEnabled(&self) -> bool;
141
142        /// Setter for [`isEnabled`][Self::isEnabled].
143        #[unsafe(method(setEnabled:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setEnabled(&self, enabled: bool);
146    );
147}
148
149/// Methods declared on superclass `NSTouchBarItem`.
150#[cfg(feature = "NSTouchBarItem")]
151impl NSColorPickerTouchBarItem {
152    extern_methods!(
153        #[unsafe(method(initWithIdentifier:))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn initWithIdentifier(
156            this: Allocated<Self>,
157            identifier: &NSTouchBarItemIdentifier,
158        ) -> Retained<Self>;
159
160        #[unsafe(method(initWithCoder:))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn initWithCoder(
163            this: Allocated<Self>,
164            coder: &NSCoder,
165        ) -> Option<Retained<Self>>;
166
167        #[unsafe(method(init))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
170    );
171}
172
173/// Methods declared on superclass `NSObject`.
174#[cfg(feature = "NSTouchBarItem")]
175impl NSColorPickerTouchBarItem {
176    extern_methods!(
177        #[unsafe(method(new))]
178        #[unsafe(method_family = new)]
179        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
180    );
181}