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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontrollerdelegate?language=objc)
12    pub unsafe trait UIColorPickerViewControllerDelegate:
13        NSObjectProtocol + MainThreadOnly
14    {
15        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
16        /// Called when the `selectedColor` changes.
17        #[deprecated]
18        #[optional]
19        #[unsafe(method(colorPickerViewControllerDidSelectColor:))]
20        #[unsafe(method_family = none)]
21        unsafe fn colorPickerViewControllerDidSelectColor(
22            &self,
23            view_controller: &UIColorPickerViewController,
24        );
25
26        #[cfg(all(
27            feature = "UIColor",
28            feature = "UIResponder",
29            feature = "UIViewController"
30        ))]
31        /// Called when the selected color changes.
32        ///
33        ///
34        /// Parameter `viewController`: This color picker.
35        ///
36        /// Parameter `color`: The new selected color
37        ///
38        /// Parameter `continuously`: YES, if this update is part of a continuous user interaction (e.g. dragging through the spectrum). It's recommended
39        /// to show these updates in your UI but to not include them in any undo operations.
40        #[optional]
41        #[unsafe(method(colorPickerViewController:didSelectColor:continuously:))]
42        #[unsafe(method_family = none)]
43        unsafe fn colorPickerViewController_didSelectColor_continuously(
44            &self,
45            view_controller: &UIColorPickerViewController,
46            color: &UIColor,
47            continuously: bool,
48        );
49
50        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
51        /// In presentations (except popovers) the color picker shows a close button. If the close button is tapped,
52        /// the view controller is dismissed and `colorPickerViewControllerDidFinish:` is called. Can be used to
53        /// animate alongside the dismissal.
54        #[optional]
55        #[unsafe(method(colorPickerViewControllerDidFinish:))]
56        #[unsafe(method_family = none)]
57        unsafe fn colorPickerViewControllerDidFinish(
58            &self,
59            view_controller: &UIColorPickerViewController,
60        );
61    }
62);
63
64extern_class!(
65    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontroller?language=objc)
66    #[unsafe(super(UIViewController, UIResponder, NSObject))]
67    #[thread_kind = MainThreadOnly]
68    #[derive(Debug, PartialEq, Eq, Hash)]
69    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
70    pub struct UIColorPickerViewController;
71);
72
73#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
74extern_conformance!(
75    unsafe impl NSCoding for UIColorPickerViewController {}
76);
77
78#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
79extern_conformance!(
80    unsafe impl NSObjectProtocol for UIColorPickerViewController {}
81);
82
83#[cfg(all(
84    feature = "UIAppearance",
85    feature = "UIResponder",
86    feature = "UIViewController"
87))]
88extern_conformance!(
89    unsafe impl UIAppearanceContainer for UIColorPickerViewController {}
90);
91
92#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
93extern_conformance!(
94    unsafe impl UIContentContainer for UIColorPickerViewController {}
95);
96
97#[cfg(all(
98    feature = "UIFocus",
99    feature = "UIResponder",
100    feature = "UIViewController"
101))]
102extern_conformance!(
103    unsafe impl UIFocusEnvironment for UIColorPickerViewController {}
104);
105
106#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
107extern_conformance!(
108    unsafe impl UIResponderStandardEditActions for UIColorPickerViewController {}
109);
110
111#[cfg(all(
112    feature = "UIResponder",
113    feature = "UITraitCollection",
114    feature = "UIViewController"
115))]
116extern_conformance!(
117    unsafe impl UITraitEnvironment for UIColorPickerViewController {}
118);
119
120#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
121impl UIColorPickerViewController {
122    extern_methods!(
123        #[unsafe(method(delegate))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn delegate(
126            &self,
127        ) -> Option<Retained<ProtocolObject<dyn UIColorPickerViewControllerDelegate>>>;
128
129        /// This is a [weak property][objc2::topics::weak_property].
130        /// Setter for [`delegate`][Self::delegate].
131        #[unsafe(method(setDelegate:))]
132        #[unsafe(method_family = none)]
133        pub unsafe 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 unsafe 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 unsafe 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 unsafe fn supportsAlpha(&self) -> bool;
157
158        /// Setter for [`supportsAlpha`][Self::supportsAlpha].
159        #[unsafe(method(setSupportsAlpha:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setSupportsAlpha(&self, supports_alpha: bool);
162
163        #[unsafe(method(initWithNibName:bundle:))]
164        #[unsafe(method_family = init)]
165        pub unsafe fn initWithNibName_bundle(
166            this: Allocated<Self>,
167            nib_name_or_nil: Option<&NSString>,
168            nib_bundle_or_nil: Option<&NSBundle>,
169        ) -> Retained<Self>;
170
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174    );
175}
176
177/// Methods declared on superclass `UIViewController`.
178#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
179impl UIColorPickerViewController {
180    extern_methods!(
181        #[unsafe(method(initWithCoder:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithCoder(
184            this: Allocated<Self>,
185            coder: &NSCoder,
186        ) -> Option<Retained<Self>>;
187    );
188}
189
190/// Methods declared on superclass `NSObject`.
191#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
192impl UIColorPickerViewController {
193    extern_methods!(
194        #[unsafe(method(new))]
195        #[unsafe(method_family = new)]
196        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
197    );
198}