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"))]
102unsafe impl NSCoding for UITextFormattingViewController {}
103
104#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
105unsafe impl NSObjectProtocol for UITextFormattingViewController {}
106
107#[cfg(all(
108    feature = "UIAppearance",
109    feature = "UIResponder",
110    feature = "UIViewController"
111))]
112unsafe impl UIAppearanceContainer for UITextFormattingViewController {}
113
114#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
115unsafe impl UIContentContainer for UITextFormattingViewController {}
116
117#[cfg(all(
118    feature = "UIFocus",
119    feature = "UIResponder",
120    feature = "UIViewController"
121))]
122unsafe impl UIFocusEnvironment for UITextFormattingViewController {}
123
124#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
125unsafe impl UIResponderStandardEditActions for UITextFormattingViewController {}
126
127#[cfg(all(
128    feature = "UIResponder",
129    feature = "UITraitCollection",
130    feature = "UIViewController"
131))]
132unsafe impl UITraitEnvironment for UITextFormattingViewController {}
133
134#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
135impl UITextFormattingViewController {
136    extern_methods!(
137        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
138        /// Current text formatting configuration object.
139        #[unsafe(method(configuration))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn configuration(&self)
142            -> Retained<UITextFormattingViewControllerConfiguration>;
143
144        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
145        /// Current formatting descriptor.
146        #[unsafe(method(formattingDescriptor))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn formattingDescriptor(
149            &self,
150        ) -> Option<Retained<UITextFormattingViewControllerFormattingDescriptor>>;
151
152        #[cfg(feature = "UITextFormattingViewControllerFormattingDescriptor")]
153        /// Setter for [`formattingDescriptor`][Self::formattingDescriptor].
154        #[unsafe(method(setFormattingDescriptor:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setFormattingDescriptor(
157            &self,
158            formatting_descriptor: Option<&UITextFormattingViewControllerFormattingDescriptor>,
159        );
160
161        /// Text formatting delegate.
162        #[unsafe(method(delegate))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn delegate(
165            &self,
166        ) -> Option<Retained<ProtocolObject<dyn UITextFormattingViewControllerDelegate>>>;
167
168        /// This is a [weak property][objc2::topics::weak_property].
169        /// Setter for [`delegate`][Self::delegate].
170        #[unsafe(method(setDelegate:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setDelegate(
173            &self,
174            delegate: Option<&ProtocolObject<dyn UITextFormattingViewControllerDelegate>>,
175        );
176
177        #[unsafe(method(init))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181        #[unsafe(method(initWithNibName:bundle:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithNibName_bundle(
184            this: Allocated<Self>,
185            nib_name_or_nil: Option<&NSString>,
186            nib_bundle_or_nil: Option<&NSBundle>,
187        ) -> Retained<Self>;
188
189        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
190        #[unsafe(method(initWithConfiguration:))]
191        #[unsafe(method_family = init)]
192        pub unsafe fn initWithConfiguration(
193            this: Allocated<Self>,
194            configuration: &UITextFormattingViewControllerConfiguration,
195        ) -> Retained<Self>;
196    );
197}
198
199/// Methods declared on superclass `UIViewController`.
200#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
201impl UITextFormattingViewController {
202    extern_methods!(
203        #[unsafe(method(initWithCoder:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithCoder(
206            this: Allocated<Self>,
207            coder: &NSCoder,
208        ) -> Option<Retained<Self>>;
209    );
210}
211
212/// Methods declared on superclass `NSObject`.
213#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
214impl UITextFormattingViewController {
215    extern_methods!(
216        #[unsafe(method(new))]
217        #[unsafe(method_family = new)]
218        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219    );
220}