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"))]
74unsafe impl NSCoding for UIColorPickerViewController {}
75
76#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
77unsafe impl NSObjectProtocol for UIColorPickerViewController {}
78
79#[cfg(all(
80    feature = "UIAppearance",
81    feature = "UIResponder",
82    feature = "UIViewController"
83))]
84unsafe impl UIAppearanceContainer for UIColorPickerViewController {}
85
86#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
87unsafe impl UIContentContainer for UIColorPickerViewController {}
88
89#[cfg(all(
90    feature = "UIFocus",
91    feature = "UIResponder",
92    feature = "UIViewController"
93))]
94unsafe impl UIFocusEnvironment for UIColorPickerViewController {}
95
96#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
97unsafe impl UIResponderStandardEditActions for UIColorPickerViewController {}
98
99#[cfg(all(
100    feature = "UIResponder",
101    feature = "UITraitCollection",
102    feature = "UIViewController"
103))]
104unsafe impl UITraitEnvironment for UIColorPickerViewController {}
105
106#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
107impl UIColorPickerViewController {
108    extern_methods!(
109        #[unsafe(method(delegate))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn delegate(
112            &self,
113        ) -> Option<Retained<ProtocolObject<dyn UIColorPickerViewControllerDelegate>>>;
114
115        /// This is a [weak property][objc2::topics::weak_property].
116        /// Setter for [`delegate`][Self::delegate].
117        #[unsafe(method(setDelegate:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setDelegate(
120            &self,
121            delegate: Option<&ProtocolObject<dyn UIColorPickerViewControllerDelegate>>,
122        );
123
124        #[cfg(feature = "UIColor")]
125        /// Sets the selected color on the color picker and is updated when the user changes the selection.
126        /// Does support KVO.
127        #[unsafe(method(selectedColor))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn selectedColor(&self) -> Retained<UIColor>;
130
131        #[cfg(feature = "UIColor")]
132        /// Setter for [`selectedColor`][Self::selectedColor].
133        #[unsafe(method(setSelectedColor:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setSelectedColor(&self, selected_color: &UIColor);
136
137        /// Controls whether the color picker shows an alpha slider or not.
138        ///
139        /// If set to `NO` users are only able to pick fully opaque colors.
140        #[unsafe(method(supportsAlpha))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn supportsAlpha(&self) -> bool;
143
144        /// Setter for [`supportsAlpha`][Self::supportsAlpha].
145        #[unsafe(method(setSupportsAlpha:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setSupportsAlpha(&self, supports_alpha: bool);
148
149        #[unsafe(method(initWithNibName:bundle:))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn initWithNibName_bundle(
152            this: Allocated<Self>,
153            nib_name_or_nil: Option<&NSString>,
154            nib_bundle_or_nil: Option<&NSBundle>,
155        ) -> Retained<Self>;
156
157        #[unsafe(method(init))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160    );
161}
162
163/// Methods declared on superclass `UIViewController`.
164#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
165impl UIColorPickerViewController {
166    extern_methods!(
167        #[unsafe(method(initWithCoder:))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn initWithCoder(
170            this: Allocated<Self>,
171            coder: &NSCoder,
172        ) -> Option<Retained<Self>>;
173    );
174}
175
176/// Methods declared on superclass `NSObject`.
177#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
178impl UIColorPickerViewController {
179    extern_methods!(
180        #[unsafe(method(new))]
181        #[unsafe(method_family = new)]
182        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
183    );
184}