objc2_ui_kit/generated/
UITextFormattingViewController.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/uitextformattingviewcontrollerdelegate?language=objc)
12    pub unsafe trait UITextFormattingViewControllerDelegate:
13        NSObjectProtocol + MainThreadOnly
14    {
15        #[cfg(all(
16            feature = "UIResponder",
17            feature = "UITextFormattingViewControllerChangeValue",
18            feature = "UIViewController"
19        ))]
20        /// Delegate method that will be invoked on any text formatting changes.
21        ///
22        /// - Parameters:
23        /// - viewController: Text formatting controller in which action was performed.
24        /// - changeValue: Object describing the change made via view controller.
25        #[unsafe(method(textFormattingViewController:didChangeValue:))]
26        #[unsafe(method_family = none)]
27        unsafe fn textFormattingViewController_didChangeValue(
28            &self,
29            view_controller: &UITextFormattingViewController,
30            change_value: &UITextFormattingViewControllerChangeValue,
31        );
32
33        #[cfg(all(
34            feature = "UIFontPickerViewController",
35            feature = "UIResponder",
36            feature = "UIViewController"
37        ))]
38        /// If implemented, text formatting will call this method before presenting font picker controller.
39        /// Use this method to make any presentation modifications or to prevent presentation altogether.
40        ///
41        /// If you decide to prevent presentation of font picker via text formatting controller, you may present provided font picker yourself.
42        /// In this case, you will have to handle any font picker actions independently.
43        ///
44        /// - Parameters:
45        /// - viewController: Text formatting controller that is attempting to present font picker controller
46        /// - fontPicker: Font picker controller that will be presented.
47        /// - Returns: Flag indicating if text formatting controller should present font picker.
48        #[optional]
49        #[unsafe(method(textFormattingViewController:shouldPresentFontPicker:))]
50        #[unsafe(method_family = none)]
51        unsafe fn textFormattingViewController_shouldPresentFontPicker(
52            &self,
53            view_controller: &UITextFormattingViewController,
54            font_picker: &UIFontPickerViewController,
55        ) -> bool;
56
57        #[cfg(all(
58            feature = "UIColorPickerViewController",
59            feature = "UIResponder",
60            feature = "UIViewController"
61        ))]
62        /// If implemented, text formatting will call this method before presenting color picker controller.
63        /// Use this method to make any presentation modifications or to prevent presentation altogether.
64        ///
65        /// You may decide to prevent presentation of color picker via text formatting controller.
66        /// In that case, you may present provided color picker controller yourself, but you will have to handle any actions in that controller separately.
67        ///
68        /// - Parameters:
69        /// - viewController: Text formatting controller that is attempting to present font picker controller
70        /// - colorPicker: Color picker controller that will be presented.
71        /// - Returns: Flag indicating if text formatting controller should present font picker.
72        #[optional]
73        #[unsafe(method(textFormattingViewController:shouldPresentColorPicker:))]
74        #[unsafe(method_family = none)]
75        unsafe fn textFormattingViewController_shouldPresentColorPicker(
76            &self,
77            view_controller: &UITextFormattingViewController,
78            color_picker: &UIColorPickerViewController,
79        ) -> bool;
80
81        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
82        /// Informs the delegate that user has dismissed text formatting view controller.
83        #[optional]
84        #[unsafe(method(textFormattingDidFinish:))]
85        #[unsafe(method_family = none)]
86        unsafe fn textFormattingDidFinish(&self, view_controller: &UITextFormattingViewController);
87    }
88);
89
90extern_class!(
91    /// A view controller that manages the interface for common text formatting options.
92    ///
93    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextformattingviewcontroller?language=objc)
94    #[unsafe(super(UIViewController, UIResponder, NSObject))]
95    #[thread_kind = MainThreadOnly]
96    #[derive(Debug, PartialEq, Eq, Hash)]
97    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
98    pub struct UITextFormattingViewController;
99);
100
101#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
102extern_conformance!(
103    unsafe impl NSCoding for UITextFormattingViewController {}
104);
105
106#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
107extern_conformance!(
108    unsafe impl NSObjectProtocol for UITextFormattingViewController {}
109);
110
111#[cfg(all(
112    feature = "UIAppearance",
113    feature = "UIResponder",
114    feature = "UIViewController"
115))]
116extern_conformance!(
117    unsafe impl UIAppearanceContainer for UITextFormattingViewController {}
118);
119
120#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
121extern_conformance!(
122    unsafe impl UIContentContainer for UITextFormattingViewController {}
123);
124
125#[cfg(all(
126    feature = "UIFocus",
127    feature = "UIResponder",
128    feature = "UIViewController"
129))]
130extern_conformance!(
131    unsafe impl UIFocusEnvironment for UITextFormattingViewController {}
132);
133
134#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
135extern_conformance!(
136    unsafe impl UIResponderStandardEditActions for UITextFormattingViewController {}
137);
138
139#[cfg(all(
140    feature = "UIResponder",
141    feature = "UITraitCollection",
142    feature = "UIViewController"
143))]
144extern_conformance!(
145    unsafe impl UITraitEnvironment for UITextFormattingViewController {}
146);
147
148#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
149impl UITextFormattingViewController {
150    extern_methods!(
151        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
152        /// Current text formatting configuration object.
153        #[unsafe(method(configuration))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn configuration(&self)
156            -> Retained<UITextFormattingViewControllerConfiguration>;
157
158        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
159        /// Current formatting descriptor.
160        #[unsafe(method(formattingDescriptor))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn formattingDescriptor(
163            &self,
164        ) -> Option<Retained<UITextFormattingViewControllerFormattingDescriptor>>;
165
166        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
167        /// Setter for [`formattingDescriptor`][Self::formattingDescriptor].
168        #[unsafe(method(setFormattingDescriptor:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setFormattingDescriptor(
171            &self,
172            formatting_descriptor: Option<&UITextFormattingViewControllerFormattingDescriptor>,
173        );
174
175        /// Text formatting delegate.
176        #[unsafe(method(delegate))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn delegate(
179            &self,
180        ) -> Option<Retained<ProtocolObject<dyn UITextFormattingViewControllerDelegate>>>;
181
182        /// This is a [weak property][objc2::topics::weak_property].
183        /// Setter for [`delegate`][Self::delegate].
184        #[unsafe(method(setDelegate:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setDelegate(
187            &self,
188            delegate: Option<&ProtocolObject<dyn UITextFormattingViewControllerDelegate>>,
189        );
190
191        #[unsafe(method(init))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
194
195        #[unsafe(method(initWithNibName:bundle:))]
196        #[unsafe(method_family = init)]
197        pub unsafe fn initWithNibName_bundle(
198            this: Allocated<Self>,
199            nib_name_or_nil: Option<&NSString>,
200            nib_bundle_or_nil: Option<&NSBundle>,
201        ) -> Retained<Self>;
202
203        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
204        #[unsafe(method(initWithConfiguration:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithConfiguration(
207            this: Allocated<Self>,
208            configuration: &UITextFormattingViewControllerConfiguration,
209        ) -> Retained<Self>;
210    );
211}
212
213/// Methods declared on superclass `UIViewController`.
214#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
215impl UITextFormattingViewController {
216    extern_methods!(
217        #[unsafe(method(initWithCoder:))]
218        #[unsafe(method_family = init)]
219        pub unsafe fn initWithCoder(
220            this: Allocated<Self>,
221            coder: &NSCoder,
222        ) -> Option<Retained<Self>>;
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
228impl UITextFormattingViewController {
229    extern_methods!(
230        #[unsafe(method(new))]
231        #[unsafe(method_family = new)]
232        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
233    );
234}