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        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        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        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        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 fn configuration(&self) -> Retained<UITextFormattingViewControllerConfiguration>;
156
157        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
158        /// Current formatting descriptor.
159        #[unsafe(method(formattingDescriptor))]
160        #[unsafe(method_family = none)]
161        pub fn formattingDescriptor(
162            &self,
163        ) -> Option<Retained<UITextFormattingViewControllerFormattingDescriptor>>;
164
165        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
166        /// Setter for [`formattingDescriptor`][Self::formattingDescriptor].
167        ///
168        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
169        #[unsafe(method(setFormattingDescriptor:))]
170        #[unsafe(method_family = none)]
171        pub fn setFormattingDescriptor(
172            &self,
173            formatting_descriptor: Option<&UITextFormattingViewControllerFormattingDescriptor>,
174        );
175
176        /// Text formatting delegate.
177        #[unsafe(method(delegate))]
178        #[unsafe(method_family = none)]
179        pub fn delegate(
180            &self,
181        ) -> Option<Retained<ProtocolObject<dyn UITextFormattingViewControllerDelegate>>>;
182
183        /// Setter for [`delegate`][Self::delegate].
184        ///
185        /// This is a [weak property][objc2::topics::weak_property].
186        #[unsafe(method(setDelegate:))]
187        #[unsafe(method_family = none)]
188        pub fn setDelegate(
189            &self,
190            delegate: Option<&ProtocolObject<dyn UITextFormattingViewControllerDelegate>>,
191        );
192
193        #[unsafe(method(init))]
194        #[unsafe(method_family = init)]
195        pub fn init(this: Allocated<Self>) -> Retained<Self>;
196
197        #[unsafe(method(initWithNibName:bundle:))]
198        #[unsafe(method_family = init)]
199        pub unsafe fn initWithNibName_bundle(
200            this: Allocated<Self>,
201            nib_name_or_nil: Option<&NSString>,
202            nib_bundle_or_nil: Option<&NSBundle>,
203        ) -> Retained<Self>;
204
205        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
206        #[unsafe(method(initWithConfiguration:))]
207        #[unsafe(method_family = init)]
208        pub fn initWithConfiguration(
209            this: Allocated<Self>,
210            configuration: &UITextFormattingViewControllerConfiguration,
211        ) -> Retained<Self>;
212    );
213}
214
215/// Methods declared on superclass `UIViewController`.
216#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
217impl UITextFormattingViewController {
218    extern_methods!(
219        /// # Safety
220        ///
221        /// `coder` possibly has further requirements.
222        #[unsafe(method(initWithCoder:))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn initWithCoder(
225            this: Allocated<Self>,
226            coder: &NSCoder,
227        ) -> Option<Retained<Self>>;
228    );
229}
230
231/// Methods declared on superclass `NSObject`.
232#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
233impl UITextFormattingViewController {
234    extern_methods!(
235        #[unsafe(method(new))]
236        #[unsafe(method_family = new)]
237        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
238    );
239}