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 unsafe 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 unsafe 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 unsafe fn items(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
120
121        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
122        /// Setter for [`items`][Self::items].
123        #[unsafe(method(setItems:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setItems(&self, items: Option<&NSArray<UIBarButtonItem>>);
126
127        #[unsafe(method(isTranslucent))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn isTranslucent(&self) -> bool;
130
131        /// Setter for [`isTranslucent`][Self::isTranslucent].
132        #[unsafe(method(setTranslucent:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setTranslucent(&self, translucent: bool);
135
136        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
137        #[unsafe(method(setItems:animated:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setItems_animated(
140            &self,
141            items: Option<&NSArray<UIBarButtonItem>>,
142            animated: bool,
143        );
144
145        #[cfg(feature = "UIColor")]
146        #[unsafe(method(tintColor))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
149
150        #[cfg(feature = "UIColor")]
151        /// Setter for [`tintColor`][Self::tintColor].
152        #[unsafe(method(setTintColor:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
155
156        #[cfg(feature = "UIColor")]
157        #[unsafe(method(barTintColor))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
160
161        #[cfg(feature = "UIColor")]
162        /// Setter for [`barTintColor`][Self::barTintColor].
163        #[unsafe(method(setBarTintColor:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
166
167        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
168        #[unsafe(method(setBackgroundImage:forToolbarPosition:barMetrics:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setBackgroundImage_forToolbarPosition_barMetrics(
171            &self,
172            background_image: Option<&UIImage>,
173            top_or_bottom: UIBarPosition,
174            bar_metrics: UIBarMetrics,
175        );
176
177        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
178        #[unsafe(method(backgroundImageForToolbarPosition:barMetrics:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn backgroundImageForToolbarPosition_barMetrics(
181            &self,
182            top_or_bottom: UIBarPosition,
183            bar_metrics: UIBarMetrics,
184        ) -> Option<Retained<UIImage>>;
185
186        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
187        #[unsafe(method(setShadowImage:forToolbarPosition:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setShadowImage_forToolbarPosition(
190            &self,
191            shadow_image: Option<&UIImage>,
192            top_or_bottom: UIBarPosition,
193        );
194
195        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
196        #[unsafe(method(shadowImageForToolbarPosition:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn shadowImageForToolbarPosition(
199            &self,
200            top_or_bottom: UIBarPosition,
201        ) -> Option<Retained<UIImage>>;
202
203        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
204        /// Describes the appearance attributes for the toolbar to use when it is displayed with its standard height.
205        #[unsafe(method(standardAppearance))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn standardAppearance(&self) -> Retained<UIToolbarAppearance>;
208
209        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
210        /// Setter for [`standardAppearance`][Self::standardAppearance].
211        #[unsafe(method(setStandardAppearance:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setStandardAppearance(&self, standard_appearance: &UIToolbarAppearance);
214
215        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
216        /// 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.
217        #[unsafe(method(compactAppearance))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn compactAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
220
221        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
222        /// Setter for [`compactAppearance`][Self::compactAppearance].
223        #[unsafe(method(setCompactAppearance:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setCompactAppearance(&self, compact_appearance: Option<&UIToolbarAppearance>);
226
227        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
228        /// 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.
229        #[unsafe(method(scrollEdgeAppearance))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
232
233        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
234        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
235        #[unsafe(method(setScrollEdgeAppearance:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn setScrollEdgeAppearance(
238            &self,
239            scroll_edge_appearance: Option<&UIToolbarAppearance>,
240        );
241
242        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
243        /// 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.
244        #[unsafe(method(compactScrollEdgeAppearance))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn compactScrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
247
248        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
249        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
250        #[unsafe(method(setCompactScrollEdgeAppearance:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setCompactScrollEdgeAppearance(
253            &self,
254            compact_scroll_edge_appearance: Option<&UIToolbarAppearance>,
255        );
256
257        #[cfg(feature = "UIBarCommon")]
258        #[unsafe(method(delegate))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIToolbarDelegate>>>;
261
262        #[cfg(feature = "UIBarCommon")]
263        /// This is a [weak property][objc2::topics::weak_property].
264        /// Setter for [`delegate`][Self::delegate].
265        #[unsafe(method(setDelegate:))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIToolbarDelegate>>);
268    );
269}
270
271/// Methods declared on superclass `UIView`.
272#[cfg(all(feature = "UIResponder", feature = "UIView"))]
273impl UIToolbar {
274    extern_methods!(
275        #[cfg(feature = "objc2-core-foundation")]
276        #[unsafe(method(initWithFrame:))]
277        #[unsafe(method_family = init)]
278        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
279
280        #[unsafe(method(initWithCoder:))]
281        #[unsafe(method_family = init)]
282        pub unsafe fn initWithCoder(
283            this: Allocated<Self>,
284            coder: &NSCoder,
285        ) -> Option<Retained<Self>>;
286    );
287}
288
289/// Methods declared on superclass `NSObject`.
290#[cfg(all(feature = "UIResponder", feature = "UIView"))]
291impl UIToolbar {
292    extern_methods!(
293        #[unsafe(method(init))]
294        #[unsafe(method_family = init)]
295        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
296
297        #[unsafe(method(new))]
298        #[unsafe(method_family = new)]
299        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
300    );
301}
302
303extern_protocol!(
304    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitoolbardelegate?language=objc)
305    #[cfg(feature = "UIBarCommon")]
306    pub unsafe trait UIToolbarDelegate: UIBarPositioningDelegate + MainThreadOnly {}
307);