objc2_ui_kit/generated/
UIBarItem.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibaritem?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIBarItem;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for UIBarItem {}
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for UIBarItem {}
24);
25
26#[cfg(feature = "UIAppearance")]
27extern_conformance!(
28    unsafe impl UIAppearance for UIBarItem {}
29);
30
31impl UIBarItem {
32    extern_methods!(
33        #[unsafe(method(init))]
34        #[unsafe(method_family = init)]
35        pub fn init(this: Allocated<Self>) -> Retained<Self>;
36
37        /// # Safety
38        ///
39        /// `coder` possibly has further requirements.
40        #[unsafe(method(initWithCoder:))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn initWithCoder(
43            this: Allocated<Self>,
44            coder: &NSCoder,
45        ) -> Option<Retained<Self>>;
46
47        #[unsafe(method(isEnabled))]
48        #[unsafe(method_family = none)]
49        pub fn isEnabled(&self) -> bool;
50
51        /// Setter for [`isEnabled`][Self::isEnabled].
52        #[unsafe(method(setEnabled:))]
53        #[unsafe(method_family = none)]
54        pub fn setEnabled(&self, enabled: bool);
55
56        #[unsafe(method(title))]
57        #[unsafe(method_family = none)]
58        pub fn title(&self) -> Option<Retained<NSString>>;
59
60        /// Setter for [`title`][Self::title].
61        ///
62        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
63        #[unsafe(method(setTitle:))]
64        #[unsafe(method_family = none)]
65        pub fn setTitle(&self, title: Option<&NSString>);
66
67        #[cfg(feature = "UIImage")]
68        #[unsafe(method(image))]
69        #[unsafe(method_family = none)]
70        pub fn image(&self) -> Option<Retained<UIImage>>;
71
72        #[cfg(feature = "UIImage")]
73        /// Setter for [`image`][Self::image].
74        #[unsafe(method(setImage:))]
75        #[unsafe(method_family = none)]
76        pub fn setImage(&self, image: Option<&UIImage>);
77
78        #[cfg(feature = "UIImage")]
79        #[unsafe(method(landscapeImagePhone))]
80        #[unsafe(method_family = none)]
81        pub fn landscapeImagePhone(&self) -> Option<Retained<UIImage>>;
82
83        #[cfg(feature = "UIImage")]
84        /// Setter for [`landscapeImagePhone`][Self::landscapeImagePhone].
85        #[unsafe(method(setLandscapeImagePhone:))]
86        #[unsafe(method_family = none)]
87        pub fn setLandscapeImagePhone(&self, landscape_image_phone: Option<&UIImage>);
88
89        #[cfg(feature = "UIImage")]
90        #[unsafe(method(largeContentSizeImage))]
91        #[unsafe(method_family = none)]
92        pub fn largeContentSizeImage(&self) -> Option<Retained<UIImage>>;
93
94        #[cfg(feature = "UIImage")]
95        /// Setter for [`largeContentSizeImage`][Self::largeContentSizeImage].
96        #[unsafe(method(setLargeContentSizeImage:))]
97        #[unsafe(method_family = none)]
98        pub fn setLargeContentSizeImage(&self, large_content_size_image: Option<&UIImage>);
99
100        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
101        #[unsafe(method(imageInsets))]
102        #[unsafe(method_family = none)]
103        pub fn imageInsets(&self) -> UIEdgeInsets;
104
105        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
106        /// Setter for [`imageInsets`][Self::imageInsets].
107        #[unsafe(method(setImageInsets:))]
108        #[unsafe(method_family = none)]
109        pub fn setImageInsets(&self, image_insets: UIEdgeInsets);
110
111        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
112        #[unsafe(method(landscapeImagePhoneInsets))]
113        #[unsafe(method_family = none)]
114        pub fn landscapeImagePhoneInsets(&self) -> UIEdgeInsets;
115
116        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
117        /// Setter for [`landscapeImagePhoneInsets`][Self::landscapeImagePhoneInsets].
118        #[unsafe(method(setLandscapeImagePhoneInsets:))]
119        #[unsafe(method_family = none)]
120        pub fn setLandscapeImagePhoneInsets(&self, landscape_image_phone_insets: UIEdgeInsets);
121
122        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
123        #[unsafe(method(largeContentSizeImageInsets))]
124        #[unsafe(method_family = none)]
125        pub fn largeContentSizeImageInsets(&self) -> UIEdgeInsets;
126
127        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
128        /// Setter for [`largeContentSizeImageInsets`][Self::largeContentSizeImageInsets].
129        #[unsafe(method(setLargeContentSizeImageInsets:))]
130        #[unsafe(method_family = none)]
131        pub fn setLargeContentSizeImageInsets(&self, large_content_size_image_insets: UIEdgeInsets);
132
133        #[unsafe(method(tag))]
134        #[unsafe(method_family = none)]
135        pub fn tag(&self) -> NSInteger;
136
137        /// Setter for [`tag`][Self::tag].
138        #[unsafe(method(setTag:))]
139        #[unsafe(method_family = none)]
140        pub fn setTag(&self, tag: NSInteger);
141
142        #[cfg(feature = "UIControl")]
143        /// # Safety
144        ///
145        /// `attributes` generic should be of the correct type.
146        #[unsafe(method(setTitleTextAttributes:forState:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setTitleTextAttributes_forState(
149            &self,
150            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
151            state: UIControlState,
152        );
153
154        #[cfg(feature = "UIControl")]
155        #[unsafe(method(titleTextAttributesForState:))]
156        #[unsafe(method_family = none)]
157        pub fn titleTextAttributesForState(
158            &self,
159            state: UIControlState,
160        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
161    );
162}
163
164/// Methods declared on superclass `NSObject`.
165impl UIBarItem {
166    extern_methods!(
167        #[unsafe(method(new))]
168        #[unsafe(method_family = new)]
169        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
170    );
171}