objc2_car_play/generated/
CPBarButton.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct CPBarButtonStyle(pub NSInteger);
20impl CPBarButtonStyle {
21 #[doc(alias = "CPBarButtonStyleNone")]
22 pub const None: Self = Self(0);
23 #[doc(alias = "CPBarButtonStyleRounded")]
24 pub const Rounded: Self = Self(1);
25}
26
27unsafe impl Encode for CPBarButtonStyle {
28 const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for CPBarButtonStyle {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35#[repr(transparent)]
41#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
42pub struct CPBarButtonType(pub NSUInteger);
43impl CPBarButtonType {
44 #[doc(alias = "CPBarButtonTypeText")]
45 pub const Text: Self = Self(0);
46 #[doc(alias = "CPBarButtonTypeImage")]
47 pub const Image: Self = Self(1);
48}
49
50unsafe impl Encode for CPBarButtonType {
51 const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for CPBarButtonType {
55 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58#[cfg(feature = "block2")]
60pub type CPBarButtonHandler = *mut block2::DynBlock<dyn Fn(NonNull<CPBarButton>)>;
61
62extern_class!(
63 #[unsafe(super(NSObject))]
67 #[derive(Debug, PartialEq, Eq, Hash)]
68 pub struct CPBarButton;
69);
70
71extern_conformance!(
72 unsafe impl NSCoding for CPBarButton {}
73);
74
75extern_conformance!(
76 unsafe impl NSObjectProtocol for CPBarButton {}
77);
78
79extern_conformance!(
80 unsafe impl NSSecureCoding for CPBarButton {}
81);
82
83impl CPBarButton {
84 extern_methods!(
85 #[unsafe(method(new))]
86 #[unsafe(method_family = new)]
87 pub unsafe fn new() -> Retained<Self>;
88
89 #[unsafe(method(init))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
92
93 #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
94 #[unsafe(method(initWithImage:handler:))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn initWithImage_handler(
102 this: Allocated<Self>,
103 image: &UIImage,
104 handler: CPBarButtonHandler,
105 ) -> Retained<Self>;
106
107 #[cfg(feature = "block2")]
108 #[unsafe(method(initWithTitle:handler:))]
114 #[unsafe(method_family = init)]
115 pub unsafe fn initWithTitle_handler(
116 this: Allocated<Self>,
117 title: &NSString,
118 handler: CPBarButtonHandler,
119 ) -> Retained<Self>;
120
121 #[unsafe(method(isEnabled))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn isEnabled(&self) -> bool;
131
132 #[unsafe(method(setEnabled:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn setEnabled(&self, enabled: bool);
136
137 #[unsafe(method(buttonStyle))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn buttonStyle(&self) -> CPBarButtonStyle;
144
145 #[unsafe(method(setButtonStyle:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn setButtonStyle(&self, button_style: CPBarButtonStyle);
149
150 #[cfg(feature = "objc2-ui-kit")]
151 #[unsafe(method(image))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
162
163 #[cfg(feature = "objc2-ui-kit")]
164 #[unsafe(method(setImage:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn setImage(&self, image: Option<&UIImage>);
168
169 #[unsafe(method(title))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
177
178 #[unsafe(method(setTitle:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn setTitle(&self, title: Option<&NSString>);
184
185 #[cfg(feature = "block2")]
186 #[deprecated]
190 #[unsafe(method(initWithType:handler:))]
191 #[unsafe(method_family = init)]
192 pub unsafe fn initWithType_handler(
193 this: Allocated<Self>,
194 r#type: CPBarButtonType,
195 handler: CPBarButtonHandler,
196 ) -> Retained<Self>;
197
198 #[deprecated]
199 #[unsafe(method(buttonType))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn buttonType(&self) -> CPBarButtonType;
202 );
203}