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))]
48unsafe impl NSAccessibility for NSColorWell {}
49
50#[cfg(all(
51    feature = "NSAccessibilityProtocols",
52    feature = "NSControl",
53    feature = "NSResponder",
54    feature = "NSView"
55))]
56unsafe impl NSAccessibilityElementProtocol for NSColorWell {}
57
58#[cfg(all(
59    feature = "NSAnimation",
60    feature = "NSControl",
61    feature = "NSResponder",
62    feature = "NSView"
63))]
64unsafe impl NSAnimatablePropertyContainer for NSColorWell {}
65
66#[cfg(all(
67    feature = "NSAppearance",
68    feature = "NSControl",
69    feature = "NSResponder",
70    feature = "NSView"
71))]
72unsafe impl NSAppearanceCustomization for NSColorWell {}
73
74#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
75unsafe impl NSCoding for NSColorWell {}
76
77#[cfg(all(
78    feature = "NSControl",
79    feature = "NSDragging",
80    feature = "NSResponder",
81    feature = "NSView"
82))]
83unsafe impl NSDraggingDestination for NSColorWell {}
84
85#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
86unsafe impl NSObjectProtocol for NSColorWell {}
87
88#[cfg(all(
89    feature = "NSControl",
90    feature = "NSResponder",
91    feature = "NSUserInterfaceItemIdentification",
92    feature = "NSView"
93))]
94unsafe impl NSUserInterfaceItemIdentification for NSColorWell {}
95
96#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
97impl NSColorWell {
98    extern_methods!(
99        #[unsafe(method(colorWellWithStyle:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn colorWellWithStyle(
102            style: NSColorWellStyle,
103            mtm: MainThreadMarker,
104        ) -> Retained<Self>;
105
106        /// Instantiates a well in the given style with a default configuration.
107        #[unsafe(method(deactivate))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn deactivate(&self);
110
111        #[unsafe(method(activate:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn activate(&self, exclusive: bool);
114
115        #[unsafe(method(isActive))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn isActive(&self) -> bool;
118
119        #[unsafe(method(drawWellInside:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn drawWellInside(&self, inside_rect: NSRect);
122
123        #[deprecated = "This property will be deprecated in a future release."]
124        #[unsafe(method(isBordered))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn isBordered(&self) -> bool;
127
128        /// Setter for [`isBordered`][Self::isBordered].
129        #[deprecated = "This property will be deprecated in a future release."]
130        #[unsafe(method(setBordered:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn setBordered(&self, bordered: bool);
133
134        #[unsafe(method(takeColorFrom:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn takeColorFrom(&self, sender: Option<&AnyObject>);
137
138        #[cfg(feature = "NSColor")]
139        #[unsafe(method(color))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn color(&self) -> Retained<NSColor>;
142
143        #[cfg(feature = "NSColor")]
144        /// Setter for [`color`][Self::color].
145        #[unsafe(method(setColor:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setColor(&self, color: &NSColor);
148
149        #[unsafe(method(colorWellStyle))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn colorWellStyle(&self) -> NSColorWellStyle;
152
153        /// Setter for [`colorWellStyle`][Self::colorWellStyle].
154        #[unsafe(method(setColorWellStyle:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setColorWellStyle(&self, color_well_style: NSColorWellStyle);
157
158        #[cfg(feature = "NSImage")]
159        #[unsafe(method(image))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
162
163        #[cfg(feature = "NSImage")]
164        /// Setter for [`image`][Self::image].
165        #[unsafe(method(setImage:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setImage(&self, image: Option<&NSImage>);
168
169        /// The image that appears on the button portion of the expanded control. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded`.
170        #[unsafe(method(pulldownTarget))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn pulldownTarget(&self) -> Option<Retained<AnyObject>>;
173
174        /// This is a [weak property][objc2::topics::weak_property].
175        /// Setter for [`pulldownTarget`][Self::pulldownTarget].
176        #[unsafe(method(setPulldownTarget:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn setPulldownTarget(&self, pulldown_target: Option<&AnyObject>);
179
180        /// The target which `pulldownAction` is sent to. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded` or `NSColorWellStyleMinimal`.
181        #[unsafe(method(pulldownAction))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn pulldownAction(&self) -> Option<Sel>;
184
185        /// Setter for [`pulldownAction`][Self::pulldownAction].
186        #[unsafe(method(setPulldownAction:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setPulldownAction(&self, pulldown_action: Option<Sel>);
189
190        /// Controls alpha support for the current color well, and the visibility of alpha slider in the color panel.
191        /// When `NSColor.ignoresAlpha` (deprecated) is set to `YES`, this property will always return `NO` and alpha is not supported globally.
192        #[unsafe(method(supportsAlpha))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn supportsAlpha(&self) -> bool;
195
196        /// Setter for [`supportsAlpha`][Self::supportsAlpha].
197        #[unsafe(method(setSupportsAlpha:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setSupportsAlpha(&self, supports_alpha: bool);
200    );
201}
202
203/// Methods declared on superclass `NSControl`.
204#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
205impl NSColorWell {
206    extern_methods!(
207        #[unsafe(method(initWithFrame:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
210
211        #[unsafe(method(initWithCoder:))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn initWithCoder(
214            this: Allocated<Self>,
215            coder: &NSCoder,
216        ) -> Option<Retained<Self>>;
217    );
218}
219
220/// Methods declared on superclass `NSResponder`.
221#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
222impl NSColorWell {
223    extern_methods!(
224        #[unsafe(method(init))]
225        #[unsafe(method_family = init)]
226        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
227    );
228}
229
230/// Methods declared on superclass `NSObject`.
231#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
232impl NSColorWell {
233    extern_methods!(
234        #[unsafe(method(new))]
235        #[unsafe(method_family = new)]
236        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
237    );
238}