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