objc2_ui_kit/generated/
UIToolbar.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitoolbar?language=objc)
17    #[unsafe(super(UIView, UIResponder, NSObject))]
18    #[thread_kind = MainThreadOnly]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
21    pub struct UIToolbar;
22);
23
24#[cfg(all(
25    feature = "UIResponder",
26    feature = "UIView",
27    feature = "objc2-quartz-core"
28))]
29#[cfg(not(target_os = "watchos"))]
30extern_conformance!(
31    unsafe impl CALayerDelegate for UIToolbar {}
32);
33
34#[cfg(all(feature = "UIResponder", feature = "UIView"))]
35extern_conformance!(
36    unsafe impl NSCoding for UIToolbar {}
37);
38
39#[cfg(all(feature = "UIResponder", feature = "UIView"))]
40extern_conformance!(
41    unsafe impl NSObjectProtocol for UIToolbar {}
42);
43
44#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
45extern_conformance!(
46    unsafe impl UIAppearance for UIToolbar {}
47);
48
49#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
50extern_conformance!(
51    unsafe impl UIAppearanceContainer for UIToolbar {}
52);
53
54#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
55extern_conformance!(
56    unsafe impl UIBarPositioning for UIToolbar {}
57);
58
59#[cfg(all(feature = "UIResponder", feature = "UIView"))]
60extern_conformance!(
61    unsafe impl UICoordinateSpace for UIToolbar {}
62);
63
64#[cfg(all(
65    feature = "UIDynamicBehavior",
66    feature = "UIResponder",
67    feature = "UIView"
68))]
69extern_conformance!(
70    unsafe impl UIDynamicItem for UIToolbar {}
71);
72
73#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
74extern_conformance!(
75    unsafe impl UIFocusEnvironment for UIToolbar {}
76);
77
78#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
79extern_conformance!(
80    unsafe impl UIFocusItem for UIToolbar {}
81);
82
83#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
84extern_conformance!(
85    unsafe impl UIFocusItemContainer for UIToolbar {}
86);
87
88#[cfg(all(feature = "UIResponder", feature = "UIView"))]
89extern_conformance!(
90    unsafe impl UIResponderStandardEditActions for UIToolbar {}
91);
92
93#[cfg(all(
94    feature = "UIResponder",
95    feature = "UITraitCollection",
96    feature = "UIView"
97))]
98extern_conformance!(
99    unsafe impl UITraitEnvironment for UIToolbar {}
100);
101
102#[cfg(all(feature = "UIResponder", feature = "UIView"))]
103impl UIToolbar {
104    extern_methods!(
105        #[cfg(feature = "UIInterface")]
106        #[unsafe(method(barStyle))]
107        #[unsafe(method_family = none)]
108        pub fn barStyle(&self) -> UIBarStyle;
109
110        #[cfg(feature = "UIInterface")]
111        /// Setter for [`barStyle`][Self::barStyle].
112        #[unsafe(method(setBarStyle:))]
113        #[unsafe(method_family = none)]
114        pub fn setBarStyle(&self, bar_style: UIBarStyle);
115
116        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
117        #[unsafe(method(items))]
118        #[unsafe(method_family = none)]
119        pub fn items(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
120
121        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
122        /// Setter for [`items`][Self::items].
123        ///
124        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
125        #[unsafe(method(setItems:))]
126        #[unsafe(method_family = none)]
127        pub fn setItems(&self, items: Option<&NSArray<UIBarButtonItem>>);
128
129        #[unsafe(method(isTranslucent))]
130        #[unsafe(method_family = none)]
131        pub fn isTranslucent(&self) -> bool;
132
133        /// Setter for [`isTranslucent`][Self::isTranslucent].
134        #[unsafe(method(setTranslucent:))]
135        #[unsafe(method_family = none)]
136        pub fn setTranslucent(&self, translucent: bool);
137
138        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
139        #[unsafe(method(setItems:animated:))]
140        #[unsafe(method_family = none)]
141        pub fn setItems_animated(&self, items: Option<&NSArray<UIBarButtonItem>>, animated: bool);
142
143        #[cfg(feature = "UIColor")]
144        #[unsafe(method(tintColor))]
145        #[unsafe(method_family = none)]
146        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
147
148        #[cfg(feature = "UIColor")]
149        /// Setter for [`tintColor`][Self::tintColor].
150        ///
151        /// # Safety
152        ///
153        /// `tint_color` might not allow `None`.
154        #[unsafe(method(setTintColor:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
157
158        #[cfg(feature = "UIColor")]
159        #[unsafe(method(barTintColor))]
160        #[unsafe(method_family = none)]
161        pub fn barTintColor(&self) -> Option<Retained<UIColor>>;
162
163        #[cfg(feature = "UIColor")]
164        /// Setter for [`barTintColor`][Self::barTintColor].
165        #[unsafe(method(setBarTintColor:))]
166        #[unsafe(method_family = none)]
167        pub fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
168
169        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
170        #[unsafe(method(setBackgroundImage:forToolbarPosition:barMetrics:))]
171        #[unsafe(method_family = none)]
172        pub fn setBackgroundImage_forToolbarPosition_barMetrics(
173            &self,
174            background_image: Option<&UIImage>,
175            top_or_bottom: UIBarPosition,
176            bar_metrics: UIBarMetrics,
177        );
178
179        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
180        #[unsafe(method(backgroundImageForToolbarPosition:barMetrics:))]
181        #[unsafe(method_family = none)]
182        pub fn backgroundImageForToolbarPosition_barMetrics(
183            &self,
184            top_or_bottom: UIBarPosition,
185            bar_metrics: UIBarMetrics,
186        ) -> Option<Retained<UIImage>>;
187
188        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
189        #[unsafe(method(setShadowImage:forToolbarPosition:))]
190        #[unsafe(method_family = none)]
191        pub fn setShadowImage_forToolbarPosition(
192            &self,
193            shadow_image: Option<&UIImage>,
194            top_or_bottom: UIBarPosition,
195        );
196
197        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
198        #[unsafe(method(shadowImageForToolbarPosition:))]
199        #[unsafe(method_family = none)]
200        pub fn shadowImageForToolbarPosition(
201            &self,
202            top_or_bottom: UIBarPosition,
203        ) -> Option<Retained<UIImage>>;
204
205        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
206        /// Describes the appearance attributes for the toolbar to use when it is displayed with its standard height.
207        #[unsafe(method(standardAppearance))]
208        #[unsafe(method_family = none)]
209        pub fn standardAppearance(&self) -> Retained<UIToolbarAppearance>;
210
211        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
212        /// Setter for [`standardAppearance`][Self::standardAppearance].
213        ///
214        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
215        #[unsafe(method(setStandardAppearance:))]
216        #[unsafe(method_family = none)]
217        pub fn setStandardAppearance(&self, standard_appearance: &UIToolbarAppearance);
218
219        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
220        /// Describes the appearance attributes for the toolbar to use when it is displayed with its compact height. If not set, the standardAppearance will be used instead.
221        #[unsafe(method(compactAppearance))]
222        #[unsafe(method_family = none)]
223        pub fn compactAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
224
225        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
226        /// Setter for [`compactAppearance`][Self::compactAppearance].
227        ///
228        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
229        #[unsafe(method(setCompactAppearance:))]
230        #[unsafe(method_family = none)]
231        pub fn setCompactAppearance(&self, compact_appearance: Option<&UIToolbarAppearance>);
232
233        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
234        /// Describes the appearance attributes for the toolbar to use at standard height when an observable scroll view is scrolled to the bottom. If not set, standardAppearance will be used instead.
235        #[unsafe(method(scrollEdgeAppearance))]
236        #[unsafe(method_family = none)]
237        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
238
239        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
240        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
241        ///
242        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
243        #[unsafe(method(setScrollEdgeAppearance:))]
244        #[unsafe(method_family = none)]
245        pub fn setScrollEdgeAppearance(&self, scroll_edge_appearance: Option<&UIToolbarAppearance>);
246
247        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
248        /// Describes the appearance attributes for the toolbar to use at compact height when an observable scroll view is scrolled to the bottom. If not set, will fall back to scrollEdgeAppearance followed by compactAppearance and finally standardAppearance.
249        #[unsafe(method(compactScrollEdgeAppearance))]
250        #[unsafe(method_family = none)]
251        pub fn compactScrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
252
253        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
254        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
255        ///
256        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
257        #[unsafe(method(setCompactScrollEdgeAppearance:))]
258        #[unsafe(method_family = none)]
259        pub fn setCompactScrollEdgeAppearance(
260            &self,
261            compact_scroll_edge_appearance: Option<&UIToolbarAppearance>,
262        );
263
264        #[cfg(feature = "UIBarCommon")]
265        #[unsafe(method(delegate))]
266        #[unsafe(method_family = none)]
267        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIToolbarDelegate>>>;
268
269        #[cfg(feature = "UIBarCommon")]
270        /// Setter for [`delegate`][Self::delegate].
271        ///
272        /// This is a [weak property][objc2::topics::weak_property].
273        #[unsafe(method(setDelegate:))]
274        #[unsafe(method_family = none)]
275        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIToolbarDelegate>>);
276    );
277}
278
279/// Methods declared on superclass `UIView`.
280#[cfg(all(feature = "UIResponder", feature = "UIView"))]
281impl UIToolbar {
282    extern_methods!(
283        #[cfg(feature = "objc2-core-foundation")]
284        #[unsafe(method(initWithFrame:))]
285        #[unsafe(method_family = init)]
286        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
287
288        /// # Safety
289        ///
290        /// `coder` possibly has further requirements.
291        #[unsafe(method(initWithCoder:))]
292        #[unsafe(method_family = init)]
293        pub unsafe fn initWithCoder(
294            this: Allocated<Self>,
295            coder: &NSCoder,
296        ) -> Option<Retained<Self>>;
297
298        #[unsafe(method(init))]
299        #[unsafe(method_family = init)]
300        pub fn init(this: Allocated<Self>) -> Retained<Self>;
301    );
302}
303
304/// Methods declared on superclass `NSObject`.
305#[cfg(all(feature = "UIResponder", feature = "UIView"))]
306impl UIToolbar {
307    extern_methods!(
308        #[unsafe(method(new))]
309        #[unsafe(method_family = new)]
310        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
311    );
312}
313
314extern_protocol!(
315    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitoolbardelegate?language=objc)
316    #[cfg(feature = "UIBarCommon")]
317    pub unsafe trait UIToolbarDelegate: UIBarPositioningDelegate + MainThreadOnly {}
318);