objc2_ui_kit/generated/
UIColorPickerViewController.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_protocol!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontrollerdelegate?language=objc)
14    pub unsafe trait UIColorPickerViewControllerDelegate:
15        NSObjectProtocol + MainThreadOnly
16    {
17        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
18        /// Called when the `selectedColor` changes.
19        #[deprecated]
20        #[optional]
21        #[unsafe(method(colorPickerViewControllerDidSelectColor:))]
22        #[unsafe(method_family = none)]
23        fn colorPickerViewControllerDidSelectColor(
24            &self,
25            view_controller: &UIColorPickerViewController,
26        );
27
28        #[cfg(all(
29            feature = "UIColor",
30            feature = "UIResponder",
31            feature = "UIViewController"
32        ))]
33        /// Called when the selected color changes.
34        ///
35        ///
36        /// Parameter `viewController`: This color picker.
37        ///
38        /// Parameter `color`: The new selected color
39        ///
40        /// Parameter `continuously`: YES, if this update is part of a continuous user interaction (e.g. dragging through the spectrum). It's recommended
41        /// to show these updates in your UI but to not include them in any undo operations.
42        #[optional]
43        #[unsafe(method(colorPickerViewController:didSelectColor:continuously:))]
44        #[unsafe(method_family = none)]
45        fn colorPickerViewController_didSelectColor_continuously(
46            &self,
47            view_controller: &UIColorPickerViewController,
48            color: &UIColor,
49            continuously: bool,
50        );
51
52        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
53        /// In presentations (except popovers) the color picker shows a close button. If the close button is tapped,
54        /// the view controller is dismissed and `colorPickerViewControllerDidFinish:` is called. Can be used to
55        /// animate alongside the dismissal.
56        #[optional]
57        #[unsafe(method(colorPickerViewControllerDidFinish:))]
58        #[unsafe(method_family = none)]
59        fn colorPickerViewControllerDidFinish(&self, view_controller: &UIColorPickerViewController);
60    }
61);
62
63extern_class!(
64    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontroller?language=objc)
65    #[unsafe(super(UIViewController, UIResponder, NSObject))]
66    #[thread_kind = MainThreadOnly]
67    #[derive(Debug, PartialEq, Eq, Hash)]
68    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
69    pub struct UIColorPickerViewController;
70);
71
72#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
73extern_conformance!(
74    unsafe impl NSCoding for UIColorPickerViewController {}
75);
76
77#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
78extern_conformance!(
79    unsafe impl NSObjectProtocol for UIColorPickerViewController {}
80);
81
82#[cfg(all(
83    feature = "UIAppearance",
84    feature = "UIResponder",
85    feature = "UIViewController"
86))]
87extern_conformance!(
88    unsafe impl UIAppearanceContainer for UIColorPickerViewController {}
89);
90
91#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
92extern_conformance!(
93    unsafe impl UIContentContainer for UIColorPickerViewController {}
94);
95
96#[cfg(all(
97    feature = "UIFocus",
98    feature = "UIResponder",
99    feature = "UIViewController"
100))]
101extern_conformance!(
102    unsafe impl UIFocusEnvironment for UIColorPickerViewController {}
103);
104
105#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
106extern_conformance!(
107    unsafe impl UIResponderStandardEditActions for UIColorPickerViewController {}
108);
109
110#[cfg(all(
111    feature = "UIResponder",
112    feature = "UITraitCollection",
113    feature = "UIViewController"
114))]
115extern_conformance!(
116    unsafe impl UITraitEnvironment for UIColorPickerViewController {}
117);
118
119#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
120impl UIColorPickerViewController {
121    extern_methods!(
122        #[unsafe(method(delegate))]
123        #[unsafe(method_family = none)]
124        pub fn delegate(
125            &self,
126        ) -> Option<Retained<ProtocolObject<dyn UIColorPickerViewControllerDelegate>>>;
127
128        /// Setter for [`delegate`][Self::delegate].
129        ///
130        /// This is a [weak property][objc2::topics::weak_property].
131        #[unsafe(method(setDelegate:))]
132        #[unsafe(method_family = none)]
133        pub fn setDelegate(
134            &self,
135            delegate: Option<&ProtocolObject<dyn UIColorPickerViewControllerDelegate>>,
136        );
137
138        #[cfg(feature = "UIColor")]
139        /// Sets the selected color on the color picker and is updated when the user changes the selection.
140        /// Does support KVO.
141        #[unsafe(method(selectedColor))]
142        #[unsafe(method_family = none)]
143        pub fn selectedColor(&self) -> Retained<UIColor>;
144
145        #[cfg(feature = "UIColor")]
146        /// Setter for [`selectedColor`][Self::selectedColor].
147        #[unsafe(method(setSelectedColor:))]
148        #[unsafe(method_family = none)]
149        pub fn setSelectedColor(&self, selected_color: &UIColor);
150
151        /// Controls whether the color picker shows an alpha slider or not.
152        ///
153        /// If set to `NO` users are only able to pick fully opaque colors.
154        #[unsafe(method(supportsAlpha))]
155        #[unsafe(method_family = none)]
156        pub fn supportsAlpha(&self) -> bool;
157
158        /// Setter for [`supportsAlpha`][Self::supportsAlpha].
159        #[unsafe(method(setSupportsAlpha:))]
160        #[unsafe(method_family = none)]
161        pub fn setSupportsAlpha(&self, supports_alpha: bool);
162
163        /// If set to `NO` the eyedropper functionality is not supported for this color picker.
164        #[unsafe(method(supportsEyedropper))]
165        #[unsafe(method_family = none)]
166        pub fn supportsEyedropper(&self) -> bool;
167
168        /// Setter for [`supportsEyedropper`][Self::supportsEyedropper].
169        #[unsafe(method(setSupportsEyedropper:))]
170        #[unsafe(method_family = none)]
171        pub fn setSupportsEyedropper(&self, supports_eyedropper: bool);
172
173        #[cfg(feature = "objc2-core-foundation")]
174        /// The maximum exposure to apply to a color when returned by the color picker.
175        #[unsafe(method(maximumLinearExposure))]
176        #[unsafe(method_family = none)]
177        pub fn maximumLinearExposure(&self) -> CGFloat;
178
179        #[cfg(feature = "objc2-core-foundation")]
180        /// Setter for [`maximumLinearExposure`][Self::maximumLinearExposure].
181        #[unsafe(method(setMaximumLinearExposure:))]
182        #[unsafe(method_family = none)]
183        pub fn setMaximumLinearExposure(&self, maximum_linear_exposure: CGFloat);
184
185        #[unsafe(method(initWithNibName:bundle:))]
186        #[unsafe(method_family = init)]
187        pub unsafe fn initWithNibName_bundle(
188            this: Allocated<Self>,
189            nib_name_or_nil: Option<&NSString>,
190            nib_bundle_or_nil: Option<&NSBundle>,
191        ) -> Retained<Self>;
192
193        #[unsafe(method(init))]
194        #[unsafe(method_family = init)]
195        pub fn init(this: Allocated<Self>) -> Retained<Self>;
196    );
197}
198
199/// Methods declared on superclass `UIViewController`.
200#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
201impl UIColorPickerViewController {
202    extern_methods!(
203        /// # Safety
204        ///
205        /// `coder` possibly has further requirements.
206        #[unsafe(method(initWithCoder:))]
207        #[unsafe(method_family = init)]
208        pub unsafe fn initWithCoder(
209            this: Allocated<Self>,
210            coder: &NSCoder,
211        ) -> Option<Retained<Self>>;
212    );
213}
214
215/// Methods declared on superclass `NSObject`.
216#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
217impl UIColorPickerViewController {
218    extern_methods!(
219        #[unsafe(method(new))]
220        #[unsafe(method_family = new)]
221        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
222    );
223}