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"))]
30unsafe impl CALayerDelegate for UIToolbar {}
31
32#[cfg(all(feature = "UIResponder", feature = "UIView"))]
33unsafe impl NSCoding for UIToolbar {}
34
35#[cfg(all(feature = "UIResponder", feature = "UIView"))]
36unsafe impl NSObjectProtocol for UIToolbar {}
37
38#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
39unsafe impl UIAppearance for UIToolbar {}
40
41#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
42unsafe impl UIAppearanceContainer for UIToolbar {}
43
44#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
45unsafe impl UIBarPositioning for UIToolbar {}
46
47#[cfg(all(feature = "UIResponder", feature = "UIView"))]
48unsafe impl UICoordinateSpace for UIToolbar {}
49
50#[cfg(all(
51    feature = "UIDynamicBehavior",
52    feature = "UIResponder",
53    feature = "UIView"
54))]
55unsafe impl UIDynamicItem for UIToolbar {}
56
57#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
58unsafe impl UIFocusEnvironment for UIToolbar {}
59
60#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
61unsafe impl UIFocusItem for UIToolbar {}
62
63#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
64unsafe impl UIFocusItemContainer for UIToolbar {}
65
66#[cfg(all(feature = "UIResponder", feature = "UIView"))]
67unsafe impl UIResponderStandardEditActions for UIToolbar {}
68
69#[cfg(all(
70    feature = "UIResponder",
71    feature = "UITraitCollection",
72    feature = "UIView"
73))]
74unsafe impl UITraitEnvironment for UIToolbar {}
75
76#[cfg(all(feature = "UIResponder", feature = "UIView"))]
77impl UIToolbar {
78    extern_methods!(
79        #[cfg(feature = "UIInterface")]
80        #[unsafe(method(barStyle))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn barStyle(&self) -> UIBarStyle;
83
84        #[cfg(feature = "UIInterface")]
85        /// Setter for [`barStyle`][Self::barStyle].
86        #[unsafe(method(setBarStyle:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);
89
90        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
91        #[unsafe(method(items))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn items(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
94
95        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
96        /// Setter for [`items`][Self::items].
97        #[unsafe(method(setItems:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setItems(&self, items: Option<&NSArray<UIBarButtonItem>>);
100
101        #[unsafe(method(isTranslucent))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn isTranslucent(&self) -> bool;
104
105        /// Setter for [`isTranslucent`][Self::isTranslucent].
106        #[unsafe(method(setTranslucent:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setTranslucent(&self, translucent: bool);
109
110        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
111        #[unsafe(method(setItems:animated:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setItems_animated(
114            &self,
115            items: Option<&NSArray<UIBarButtonItem>>,
116            animated: bool,
117        );
118
119        #[cfg(feature = "UIColor")]
120        #[unsafe(method(tintColor))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
123
124        #[cfg(feature = "UIColor")]
125        /// Setter for [`tintColor`][Self::tintColor].
126        #[unsafe(method(setTintColor:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
129
130        #[cfg(feature = "UIColor")]
131        #[unsafe(method(barTintColor))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
134
135        #[cfg(feature = "UIColor")]
136        /// Setter for [`barTintColor`][Self::barTintColor].
137        #[unsafe(method(setBarTintColor:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
140
141        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
142        #[unsafe(method(setBackgroundImage:forToolbarPosition:barMetrics:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setBackgroundImage_forToolbarPosition_barMetrics(
145            &self,
146            background_image: Option<&UIImage>,
147            top_or_bottom: UIBarPosition,
148            bar_metrics: UIBarMetrics,
149        );
150
151        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
152        #[unsafe(method(backgroundImageForToolbarPosition:barMetrics:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn backgroundImageForToolbarPosition_barMetrics(
155            &self,
156            top_or_bottom: UIBarPosition,
157            bar_metrics: UIBarMetrics,
158        ) -> Option<Retained<UIImage>>;
159
160        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
161        #[unsafe(method(setShadowImage:forToolbarPosition:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn setShadowImage_forToolbarPosition(
164            &self,
165            shadow_image: Option<&UIImage>,
166            top_or_bottom: UIBarPosition,
167        );
168
169        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
170        #[unsafe(method(shadowImageForToolbarPosition:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn shadowImageForToolbarPosition(
173            &self,
174            top_or_bottom: UIBarPosition,
175        ) -> Option<Retained<UIImage>>;
176
177        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
178        /// Describes the appearance attributes for the toolbar to use when it is displayed with its standard height.
179        #[unsafe(method(standardAppearance))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn standardAppearance(&self) -> Retained<UIToolbarAppearance>;
182
183        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
184        /// Setter for [`standardAppearance`][Self::standardAppearance].
185        #[unsafe(method(setStandardAppearance:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setStandardAppearance(&self, standard_appearance: &UIToolbarAppearance);
188
189        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
190        /// 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.
191        #[unsafe(method(compactAppearance))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn compactAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
194
195        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
196        /// Setter for [`compactAppearance`][Self::compactAppearance].
197        #[unsafe(method(setCompactAppearance:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setCompactAppearance(&self, compact_appearance: Option<&UIToolbarAppearance>);
200
201        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
202        /// 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.
203        #[unsafe(method(scrollEdgeAppearance))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
206
207        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
208        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
209        #[unsafe(method(setScrollEdgeAppearance:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn setScrollEdgeAppearance(
212            &self,
213            scroll_edge_appearance: Option<&UIToolbarAppearance>,
214        );
215
216        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
217        /// 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.
218        #[unsafe(method(compactScrollEdgeAppearance))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn compactScrollEdgeAppearance(&self) -> Option<Retained<UIToolbarAppearance>>;
221
222        #[cfg(all(feature = "UIBarAppearance", feature = "UIToolbarAppearance"))]
223        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
224        #[unsafe(method(setCompactScrollEdgeAppearance:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setCompactScrollEdgeAppearance(
227            &self,
228            compact_scroll_edge_appearance: Option<&UIToolbarAppearance>,
229        );
230
231        #[cfg(feature = "UIBarCommon")]
232        #[unsafe(method(delegate))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIToolbarDelegate>>>;
235
236        #[cfg(feature = "UIBarCommon")]
237        /// This is a [weak property][objc2::topics::weak_property].
238        /// Setter for [`delegate`][Self::delegate].
239        #[unsafe(method(setDelegate:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIToolbarDelegate>>);
242    );
243}
244
245/// Methods declared on superclass `UIView`.
246#[cfg(all(feature = "UIResponder", feature = "UIView"))]
247impl UIToolbar {
248    extern_methods!(
249        #[cfg(feature = "objc2-core-foundation")]
250        #[unsafe(method(initWithFrame:))]
251        #[unsafe(method_family = init)]
252        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
253
254        #[unsafe(method(initWithCoder:))]
255        #[unsafe(method_family = init)]
256        pub unsafe fn initWithCoder(
257            this: Allocated<Self>,
258            coder: &NSCoder,
259        ) -> Option<Retained<Self>>;
260    );
261}
262
263/// Methods declared on superclass `NSObject`.
264#[cfg(all(feature = "UIResponder", feature = "UIView"))]
265impl UIToolbar {
266    extern_methods!(
267        #[unsafe(method(init))]
268        #[unsafe(method_family = init)]
269        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
270
271        #[unsafe(method(new))]
272        #[unsafe(method_family = new)]
273        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
274    );
275}
276
277extern_protocol!(
278    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitoolbardelegate?language=objc)
279    #[cfg(feature = "UIBarCommon")]
280    pub unsafe trait UIToolbarDelegate: UIBarPositioningDelegate + MainThreadOnly {}
281);