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