objc2_app_kit/generated/
NSColorWell.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorwellstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSColorWellStyle(pub NSInteger);
15impl NSColorWellStyle {
16    #[doc(alias = "NSColorWellStyleDefault")]
17    pub const Default: Self = Self(0);
18    /// The default `colorWellStyle`. A well that accepts drag/drop of colors as well as reveals the color panel when clicked.
19    #[doc(alias = "NSColorWellStyleMinimal")]
20    pub const Minimal: Self = Self(1);
21    /// A minimally adorned well. By default shows a popover color picker when clicked; this interaction behavior can be customized.
22    #[doc(alias = "NSColorWellStyleExpanded")]
23    pub const Expanded: Self = Self(2);
24}
25
26unsafe impl Encode for NSColorWellStyle {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSColorWellStyle {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorwell?language=objc)
36    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
39    pub struct NSColorWell;
40);
41
42#[cfg(all(
43    feature = "NSAccessibilityProtocols",
44    feature = "NSControl",
45    feature = "NSResponder",
46    feature = "NSView"
47))]
48extern_conformance!(
49    unsafe impl NSAccessibility for NSColorWell {}
50);
51
52#[cfg(all(
53    feature = "NSAccessibilityProtocols",
54    feature = "NSControl",
55    feature = "NSResponder",
56    feature = "NSView"
57))]
58extern_conformance!(
59    unsafe impl NSAccessibilityElementProtocol for NSColorWell {}
60);
61
62#[cfg(all(
63    feature = "NSAnimation",
64    feature = "NSControl",
65    feature = "NSResponder",
66    feature = "NSView"
67))]
68extern_conformance!(
69    unsafe impl NSAnimatablePropertyContainer for NSColorWell {}
70);
71
72#[cfg(all(
73    feature = "NSAppearance",
74    feature = "NSControl",
75    feature = "NSResponder",
76    feature = "NSView"
77))]
78extern_conformance!(
79    unsafe impl NSAppearanceCustomization for NSColorWell {}
80);
81
82#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
83extern_conformance!(
84    unsafe impl NSCoding for NSColorWell {}
85);
86
87#[cfg(all(
88    feature = "NSControl",
89    feature = "NSDragging",
90    feature = "NSResponder",
91    feature = "NSView"
92))]
93extern_conformance!(
94    unsafe impl NSDraggingDestination for NSColorWell {}
95);
96
97#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
98extern_conformance!(
99    unsafe impl NSObjectProtocol for NSColorWell {}
100);
101
102#[cfg(all(
103    feature = "NSControl",
104    feature = "NSResponder",
105    feature = "NSUserInterfaceItemIdentification",
106    feature = "NSView"
107))]
108extern_conformance!(
109    unsafe impl NSUserInterfaceItemIdentification for NSColorWell {}
110);
111
112#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
113impl NSColorWell {
114    extern_methods!(
115        #[unsafe(method(colorWellWithStyle:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn colorWellWithStyle(
118            style: NSColorWellStyle,
119            mtm: MainThreadMarker,
120        ) -> Retained<Self>;
121
122        /// Instantiates a well in the given style with a default configuration.
123        #[unsafe(method(deactivate))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn deactivate(&self);
126
127        #[unsafe(method(activate:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn activate(&self, exclusive: bool);
130
131        #[unsafe(method(isActive))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn isActive(&self) -> bool;
134
135        #[unsafe(method(drawWellInside:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn drawWellInside(&self, inside_rect: NSRect);
138
139        #[deprecated = "This property will be deprecated in a future release."]
140        #[unsafe(method(isBordered))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn isBordered(&self) -> bool;
143
144        /// Setter for [`isBordered`][Self::isBordered].
145        #[deprecated = "This property will be deprecated in a future release."]
146        #[unsafe(method(setBordered:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setBordered(&self, bordered: bool);
149
150        #[unsafe(method(takeColorFrom:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn takeColorFrom(&self, sender: Option<&AnyObject>);
153
154        #[cfg(feature = "NSColor")]
155        #[unsafe(method(color))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn color(&self) -> Retained<NSColor>;
158
159        #[cfg(feature = "NSColor")]
160        /// Setter for [`color`][Self::color].
161        #[unsafe(method(setColor:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setColor(&self, color: &NSColor);
164
165        #[unsafe(method(colorWellStyle))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn colorWellStyle(&self) -> NSColorWellStyle;
168
169        /// Setter for [`colorWellStyle`][Self::colorWellStyle].
170        #[unsafe(method(setColorWellStyle:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setColorWellStyle(&self, color_well_style: NSColorWellStyle);
173
174        #[cfg(feature = "NSImage")]
175        #[unsafe(method(image))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
178
179        #[cfg(feature = "NSImage")]
180        /// Setter for [`image`][Self::image].
181        #[unsafe(method(setImage:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn setImage(&self, image: Option<&NSImage>);
184
185        /// The image that appears on the button portion of the expanded control. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded`.
186        #[unsafe(method(pulldownTarget))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn pulldownTarget(&self) -> Option<Retained<AnyObject>>;
189
190        /// This is a [weak property][objc2::topics::weak_property].
191        /// Setter for [`pulldownTarget`][Self::pulldownTarget].
192        #[unsafe(method(setPulldownTarget:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setPulldownTarget(&self, pulldown_target: Option<&AnyObject>);
195
196        /// The target which `pulldownAction` is sent to. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded` or `NSColorWellStyleMinimal`.
197        #[unsafe(method(pulldownAction))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn pulldownAction(&self) -> Option<Sel>;
200
201        /// Setter for [`pulldownAction`][Self::pulldownAction].
202        #[unsafe(method(setPulldownAction:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn setPulldownAction(&self, pulldown_action: Option<Sel>);
205
206        /// Controls alpha support for the current color well, and the visibility of alpha slider in the color panel.
207        /// When `NSColor.ignoresAlpha` (deprecated) is set to `YES`, this property will always return `NO` and alpha is not supported globally.
208        #[unsafe(method(supportsAlpha))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn supportsAlpha(&self) -> bool;
211
212        /// Setter for [`supportsAlpha`][Self::supportsAlpha].
213        #[unsafe(method(setSupportsAlpha:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setSupportsAlpha(&self, supports_alpha: bool);
216    );
217}
218
219/// Methods declared on superclass `NSControl`.
220#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
221impl NSColorWell {
222    extern_methods!(
223        #[unsafe(method(initWithFrame:))]
224        #[unsafe(method_family = init)]
225        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
226
227        #[unsafe(method(initWithCoder:))]
228        #[unsafe(method_family = init)]
229        pub unsafe fn initWithCoder(
230            this: Allocated<Self>,
231            coder: &NSCoder,
232        ) -> Option<Retained<Self>>;
233    );
234}
235
236/// Methods declared on superclass `NSResponder`.
237#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
238impl NSColorWell {
239    extern_methods!(
240        #[unsafe(method(init))]
241        #[unsafe(method_family = init)]
242        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
243    );
244}
245
246/// Methods declared on superclass `NSObject`.
247#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
248impl NSColorWell {
249    extern_methods!(
250        #[unsafe(method(new))]
251        #[unsafe(method_family = new)]
252        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
253    );
254}