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