objc2_ui_kit/generated/
UIBarButtonItemAppearance.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/uibarbuttonitemstateappearance?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIBarButtonItemStateAppearance;
16);
17
18extern_conformance!(
19    unsafe impl NSObjectProtocol for UIBarButtonItemStateAppearance {}
20);
21
22impl UIBarButtonItemStateAppearance {
23    extern_methods!(
24        #[unsafe(method(init))]
25        #[unsafe(method_family = init)]
26        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
27
28        #[unsafe(method(new))]
29        #[unsafe(method_family = new)]
30        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
31
32        /// Text attributes to be used for rendering title text. If the font or color are unspecified, appropriate defaults are supplied.
33        #[unsafe(method(titleTextAttributes))]
34        #[unsafe(method_family = none)]
35        pub fn titleTextAttributes(
36            &self,
37        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
38
39        /// Setter for [`titleTextAttributes`][Self::titleTextAttributes].
40        ///
41        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
42        ///
43        /// # Safety
44        ///
45        /// `title_text_attributes` generic should be of the correct type.
46        #[unsafe(method(setTitleTextAttributes:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setTitleTextAttributes(
49            &self,
50            title_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
51        );
52
53        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
54        /// An offset to apply to the button's title position
55        #[unsafe(method(titlePositionAdjustment))]
56        #[unsafe(method_family = none)]
57        pub fn titlePositionAdjustment(&self) -> UIOffset;
58
59        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
60        /// Setter for [`titlePositionAdjustment`][Self::titlePositionAdjustment].
61        #[unsafe(method(setTitlePositionAdjustment:))]
62        #[unsafe(method_family = none)]
63        pub fn setTitlePositionAdjustment(&self, title_position_adjustment: UIOffset);
64
65        #[cfg(feature = "UIImage")]
66        /// A background image to display around the button
67        #[unsafe(method(backgroundImage))]
68        #[unsafe(method_family = none)]
69        pub fn backgroundImage(&self) -> Option<Retained<UIImage>>;
70
71        #[cfg(feature = "UIImage")]
72        /// Setter for [`backgroundImage`][Self::backgroundImage].
73        #[unsafe(method(setBackgroundImage:))]
74        #[unsafe(method_family = none)]
75        pub fn setBackgroundImage(&self, background_image: Option<&UIImage>);
76
77        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
78        /// An offset to apply to the backgroundImage.
79        #[unsafe(method(backgroundImagePositionAdjustment))]
80        #[unsafe(method_family = none)]
81        pub fn backgroundImagePositionAdjustment(&self) -> UIOffset;
82
83        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
84        /// Setter for [`backgroundImagePositionAdjustment`][Self::backgroundImagePositionAdjustment].
85        #[unsafe(method(setBackgroundImagePositionAdjustment:))]
86        #[unsafe(method_family = none)]
87        pub fn setBackgroundImagePositionAdjustment(
88            &self,
89            background_image_position_adjustment: UIOffset,
90        );
91    );
92}
93
94extern_class!(
95    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitemappearance?language=objc)
96    #[unsafe(super(NSObject))]
97    #[thread_kind = MainThreadOnly]
98    #[derive(Debug, PartialEq, Eq, Hash)]
99    pub struct UIBarButtonItemAppearance;
100);
101
102extern_conformance!(
103    unsafe impl NSCoding for UIBarButtonItemAppearance {}
104);
105
106extern_conformance!(
107    unsafe impl NSCopying for UIBarButtonItemAppearance {}
108);
109
110unsafe impl CopyingHelper for UIBarButtonItemAppearance {
111    type Result = Self;
112}
113
114extern_conformance!(
115    unsafe impl NSObjectProtocol for UIBarButtonItemAppearance {}
116);
117
118extern_conformance!(
119    unsafe impl NSSecureCoding for UIBarButtonItemAppearance {}
120);
121
122impl UIBarButtonItemAppearance {
123    extern_methods!(
124        /// Construct an appearance for the UIBarButtonItemStylePlain style.
125        #[unsafe(method(init))]
126        #[unsafe(method_family = init)]
127        pub fn init(this: Allocated<Self>) -> Retained<Self>;
128
129        #[cfg(feature = "UIBarButtonItem")]
130        /// Construct an appearance with default values for the given style.
131        #[unsafe(method(initWithStyle:))]
132        #[unsafe(method_family = init)]
133        pub fn initWithStyle(this: Allocated<Self>, style: UIBarButtonItemStyle) -> Retained<Self>;
134
135        /// # Safety
136        ///
137        /// `coder` possibly has further requirements.
138        #[unsafe(method(initWithCoder:))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
141
142        #[unsafe(method(copy))]
143        #[unsafe(method_family = copy)]
144        pub fn copy(&self) -> Retained<Self>;
145
146        #[cfg(feature = "UIBarButtonItem")]
147        /// Reset this appearance to that of a given style.
148        #[unsafe(method(configureWithDefaultForStyle:))]
149        #[unsafe(method_family = none)]
150        pub fn configureWithDefaultForStyle(&self, style: UIBarButtonItemStyle);
151
152        /// The appearance when the bar button item is in the normal control state.
153        #[unsafe(method(normal))]
154        #[unsafe(method_family = none)]
155        pub fn normal(&self) -> Retained<UIBarButtonItemStateAppearance>;
156
157        /// The appearance when the bar button item is in the highlighted control state. If unspecified, then synthesized from the normal state.
158        #[unsafe(method(highlighted))]
159        #[unsafe(method_family = none)]
160        pub fn highlighted(&self) -> Retained<UIBarButtonItemStateAppearance>;
161
162        /// The appearance when the bar button item is in the disabled control state. If unspecified, then synthesized from the normal state.
163        #[unsafe(method(disabled))]
164        #[unsafe(method_family = none)]
165        pub fn disabled(&self) -> Retained<UIBarButtonItemStateAppearance>;
166
167        /// The appearance when the bar button item is in the focused control state. If unspecified, then synthesized from the highlighted state.
168        #[unsafe(method(focused))]
169        #[unsafe(method_family = none)]
170        pub fn focused(&self) -> Retained<UIBarButtonItemStateAppearance>;
171    );
172}
173
174/// Methods declared on superclass `NSObject`.
175impl UIBarButtonItemAppearance {
176    extern_methods!(
177        #[unsafe(method(new))]
178        #[unsafe(method_family = new)]
179        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
180    );
181}