1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationBarNSToolbarSection(pub NSInteger);
impl UINavigationBarNSToolbarSection {
    #[doc(alias = "UINavigationBarNSToolbarSectionNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UINavigationBarNSToolbarSectionSidebar")]
    pub const Sidebar: Self = Self(1);
    #[doc(alias = "UINavigationBarNSToolbarSectionSupplementary")]
    pub const Supplementary: Self = Self(2);
    #[doc(alias = "UINavigationBarNSToolbarSectionContent")]
    pub const Content: Self = Self(3);
}

unsafe impl Encode for UINavigationBarNSToolbarSection {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UINavigationBarNSToolbarSection {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UINavigationBar;

    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl ClassType for UINavigationBar {
        #[inherits(UIResponder, NSObject)]
        type Super = UIView;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
unsafe impl CALayerDelegate for UINavigationBar {}

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
unsafe impl NSCoding for UINavigationBar {}

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
unsafe impl NSObjectProtocol for UINavigationBar {}

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIAppearance for UINavigationBar {}

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIAppearanceContainer for UINavigationBar {}

#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIBarPositioning for UINavigationBar {}

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
unsafe impl UICoordinateSpace for UINavigationBar {}

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIDynamicItem for UINavigationBar {}

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusEnvironment for UINavigationBar {}

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusItem for UINavigationBar {}

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIFocusItemContainer for UINavigationBar {}

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
unsafe impl UIResponderStandardEditActions for UINavigationBar {}

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
unsafe impl UITraitEnvironment for UINavigationBar {}

extern_methods!(
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UINavigationBar {
        #[cfg(feature = "UIInterface")]
        #[method(barStyle)]
        pub unsafe fn barStyle(&self) -> UIBarStyle;

        #[cfg(feature = "UIInterface")]
        #[method(setBarStyle:)]
        pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);

        #[cfg(feature = "UIBarCommon")]
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UINavigationBarDelegate>>>;

        #[cfg(feature = "UIBarCommon")]
        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UINavigationBarDelegate>>,
        );

        #[method(isTranslucent)]
        pub unsafe fn isTranslucent(&self) -> bool;

        #[method(setTranslucent:)]
        pub unsafe fn setTranslucent(&self, translucent: bool);

        #[cfg(feature = "UINavigationItem")]
        #[method(pushNavigationItem:animated:)]
        pub unsafe fn pushNavigationItem_animated(&self, item: &UINavigationItem, animated: bool);

        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other popNavigationItemAnimated:)]
        pub unsafe fn popNavigationItemAnimated(
            &self,
            animated: bool,
        ) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other topItem)]
        pub unsafe fn topItem(&self) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other backItem)]
        pub unsafe fn backItem(&self) -> Option<Retained<UINavigationItem>>;

        #[cfg(feature = "UINavigationItem")]
        #[method_id(@__retain_semantics Other items)]
        pub unsafe fn items(&self) -> Option<Retained<NSArray<UINavigationItem>>>;

        #[cfg(feature = "UINavigationItem")]
        #[method(setItems:)]
        pub unsafe fn setItems(&self, items: Option<&NSArray<UINavigationItem>>);

        #[cfg(feature = "UINavigationItem")]
        #[method(setItems:animated:)]
        pub unsafe fn setItems_animated(
            &self,
            items: Option<&NSArray<UINavigationItem>>,
            animated: bool,
        );

        #[method(prefersLargeTitles)]
        pub unsafe fn prefersLargeTitles(&self) -> bool;

        #[method(setPrefersLargeTitles:)]
        pub unsafe fn setPrefersLargeTitles(&self, prefers_large_titles: bool);

        #[method(currentNSToolbarSection)]
        pub unsafe fn currentNSToolbarSection(&self) -> UINavigationBarNSToolbarSection;

        #[cfg(feature = "UIBehavioralStyle")]
        #[method(behavioralStyle)]
        pub unsafe fn behavioralStyle(&self) -> UIBehavioralStyle;

        #[cfg(feature = "UIBehavioralStyle")]
        #[method(preferredBehavioralStyle)]
        pub unsafe fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;

        #[cfg(feature = "UIBehavioralStyle")]
        #[method(setPreferredBehavioralStyle:)]
        pub unsafe fn setPreferredBehavioralStyle(
            &self,
            preferred_behavioral_style: UIBehavioralStyle,
        );

        #[cfg(feature = "UIColor")]
        #[method_id(@__retain_semantics Other tintColor)]
        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        #[method(setTintColor:)]
        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);

        #[cfg(feature = "UIColor")]
        #[method_id(@__retain_semantics Other barTintColor)]
        pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        #[method(setBarTintColor:)]
        pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method(setBackgroundImage:forBarPosition:barMetrics:)]
        pub unsafe fn setBackgroundImage_forBarPosition_barMetrics(
            &self,
            background_image: Option<&UIImage>,
            bar_position: UIBarPosition,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method_id(@__retain_semantics Other backgroundImageForBarPosition:barMetrics:)]
        pub unsafe fn backgroundImageForBarPosition_barMetrics(
            &self,
            bar_position: UIBarPosition,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method(setBackgroundImage:forBarMetrics:)]
        pub unsafe fn setBackgroundImage_forBarMetrics(
            &self,
            background_image: Option<&UIImage>,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
        #[method_id(@__retain_semantics Other backgroundImageForBarMetrics:)]
        pub unsafe fn backgroundImageForBarMetrics(
            &self,
            bar_metrics: UIBarMetrics,
        ) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other shadowImage)]
        pub unsafe fn shadowImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method(setShadowImage:)]
        pub unsafe fn setShadowImage(&self, shadow_image: Option<&UIImage>);

        #[method_id(@__retain_semantics Other titleTextAttributes)]
        pub unsafe fn titleTextAttributes(
            &self,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        #[method(setTitleTextAttributes:)]
        pub unsafe fn setTitleTextAttributes(
            &self,
            title_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[method_id(@__retain_semantics Other largeTitleTextAttributes)]
        pub unsafe fn largeTitleTextAttributes(
            &self,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        #[method(setLargeTitleTextAttributes:)]
        pub unsafe fn setLargeTitleTextAttributes(
            &self,
            large_title_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[cfg(feature = "UIBarCommon")]
        #[method(setTitleVerticalPositionAdjustment:forBarMetrics:)]
        pub unsafe fn setTitleVerticalPositionAdjustment_forBarMetrics(
            &self,
            adjustment: CGFloat,
            bar_metrics: UIBarMetrics,
        );

        #[cfg(feature = "UIBarCommon")]
        #[method(titleVerticalPositionAdjustmentForBarMetrics:)]
        pub unsafe fn titleVerticalPositionAdjustmentForBarMetrics(
            &self,
            bar_metrics: UIBarMetrics,
        ) -> CGFloat;

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other backIndicatorImage)]
        pub unsafe fn backIndicatorImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method(setBackIndicatorImage:)]
        pub unsafe fn setBackIndicatorImage(&self, back_indicator_image: Option<&UIImage>);

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other backIndicatorTransitionMaskImage)]
        pub unsafe fn backIndicatorTransitionMaskImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method(setBackIndicatorTransitionMaskImage:)]
        pub unsafe fn setBackIndicatorTransitionMaskImage(
            &self,
            back_indicator_transition_mask_image: Option<&UIImage>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other standardAppearance)]
        pub unsafe fn standardAppearance(&self) -> Retained<UINavigationBarAppearance>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setStandardAppearance:)]
        pub unsafe fn setStandardAppearance(&self, standard_appearance: &UINavigationBarAppearance);

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other compactAppearance)]
        pub unsafe fn compactAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setCompactAppearance:)]
        pub unsafe fn setCompactAppearance(
            &self,
            compact_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other scrollEdgeAppearance)]
        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setScrollEdgeAppearance:)]
        pub unsafe fn setScrollEdgeAppearance(
            &self,
            scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other compactScrollEdgeAppearance)]
        pub unsafe fn compactScrollEdgeAppearance(
            &self,
        ) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setCompactScrollEdgeAppearance:)]
        pub unsafe fn setCompactScrollEdgeAppearance(
            &self,
            compact_scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `UIView`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UINavigationBar {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UINavigationBar {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_protocol!(
    #[cfg(feature = "UIBarCommon")]
    pub unsafe trait UINavigationBarDelegate:
        UIBarPositioningDelegate + IsMainThreadOnly
    {
        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(navigationBar:shouldPushItem:)]
        unsafe fn navigationBar_shouldPushItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        ) -> bool;

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(navigationBar:didPushItem:)]
        unsafe fn navigationBar_didPushItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        );

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(navigationBar:shouldPopItem:)]
        unsafe fn navigationBar_shouldPopItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        ) -> bool;

        #[cfg(all(
            feature = "UINavigationItem",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(navigationBar:didPopItem:)]
        unsafe fn navigationBar_didPopItem(
            &self,
            navigation_bar: &UINavigationBar,
            item: &UINavigationItem,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(navigationBarNSToolbarSection:)]
        unsafe fn navigationBarNSToolbarSection(
            &self,
            navigation_bar: &UINavigationBar,
        ) -> UINavigationBarNSToolbarSection;
    }

    #[cfg(feature = "UIBarCommon")]
    unsafe impl ProtocolType for dyn UINavigationBarDelegate {}
);