objc2_ui_kit/generated/
UITabAccessory.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_class!(
9    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabaccessory?language=objc)
10    #[unsafe(super(NSObject))]
11    #[thread_kind = MainThreadOnly]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct UITabAccessory;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for UITabAccessory {}
18);
19
20impl UITabAccessory {
21    extern_methods!(
22        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
23        /// The content view of the accessory.
24        #[unsafe(method(contentView))]
25        #[unsafe(method_family = none)]
26        pub fn contentView(&self) -> Retained<UIView>;
27
28        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
29        /// Creates a new accessory with the specified content view.
30        #[unsafe(method(initWithContentView:))]
31        #[unsafe(method_family = init)]
32        pub fn initWithContentView(this: Allocated<Self>, content_view: &UIView) -> Retained<Self>;
33
34        #[unsafe(method(init))]
35        #[unsafe(method_family = init)]
36        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
37
38        #[unsafe(method(new))]
39        #[unsafe(method_family = new)]
40        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
41    );
42}
43
44/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabaccessoryenvironment?language=objc)
45// NS_ENUM
46#[repr(transparent)]
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
48pub struct UITabAccessoryEnvironment(pub NSInteger);
49impl UITabAccessoryEnvironment {
50    /// Indicates the absence of any information about whether or not the trait collection is
51    /// from a view that is in a tab accessory.
52    #[doc(alias = "UITabAccessoryEnvironmentUnspecified")]
53    pub const Unspecified: Self = Self(0);
54    /// The trait collection is from a view that is not in an active tab accessory environment.
55    #[doc(alias = "UITabAccessoryEnvironmentNone")]
56    pub const None: Self = Self(1);
57    /// The environment for when the accessory is laid out either:
58    /// - above the bottom tab bar when it is visible; or,
59    /// - at the bottom of the UITabBarController's view.
60    #[doc(alias = "UITabAccessoryEnvironmentRegular")]
61    pub const Regular: Self = Self(2);
62    /// The environment for when the accessory is laid out inline with
63    /// the collapsed bottom tab bar.
64    #[doc(alias = "UITabAccessoryEnvironmentInline")]
65    pub const Inline: Self = Self(3);
66}
67
68unsafe impl Encode for UITabAccessoryEnvironment {
69    const ENCODING: Encoding = NSInteger::ENCODING;
70}
71
72unsafe impl RefEncode for UITabAccessoryEnvironment {
73    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
74}
75
76extern_class!(
77    /// A trait that specifies the UITabAccessoryEnvironment, if any, that a view is in. It is set on views inside
78    /// UITabBarController.bottomAccessory. Defaults to UITabAccessoryEnvironmentUnspecified.
79    ///
80    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uitraittabaccessoryenvironment?language=objc)
81    #[unsafe(super(NSObject))]
82    #[thread_kind = MainThreadOnly]
83    #[derive(Debug, PartialEq, Eq, Hash)]
84    pub struct UITraitTabAccessoryEnvironment;
85);
86
87extern_conformance!(
88    unsafe impl NSObjectProtocol for UITraitTabAccessoryEnvironment {}
89);
90
91#[cfg(feature = "UITrait")]
92extern_conformance!(
93    unsafe impl UINSIntegerTraitDefinition for UITraitTabAccessoryEnvironment {}
94);
95
96#[cfg(feature = "UITrait")]
97extern_conformance!(
98    unsafe impl UITraitDefinition for UITraitTabAccessoryEnvironment {}
99);
100
101impl UITraitTabAccessoryEnvironment {
102    extern_methods!();
103}
104
105/// Methods declared on superclass `NSObject`.
106impl UITraitTabAccessoryEnvironment {
107    extern_methods!(
108        #[unsafe(method(init))]
109        #[unsafe(method_family = init)]
110        pub fn init(this: Allocated<Self>) -> Retained<Self>;
111
112        #[unsafe(method(new))]
113        #[unsafe(method_family = new)]
114        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
115    );
116}