objc2_ui_kit/generated/
UICommand.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UIKeyModifierFlags(pub NSInteger);
15bitflags::bitflags! {
16 impl UIKeyModifierFlags: NSInteger {
17 #[doc(alias = "UIKeyModifierAlphaShift")]
18 const AlphaShift = 1<<16;
19 #[doc(alias = "UIKeyModifierShift")]
20 const Shift = 1<<17;
21 #[doc(alias = "UIKeyModifierControl")]
22 const Control = 1<<18;
23 #[doc(alias = "UIKeyModifierAlternate")]
24 const Alternate = 1<<19;
25 #[doc(alias = "UIKeyModifierCommand")]
26 const Command = 1<<20;
27 #[doc(alias = "UIKeyModifierNumericPad")]
28 const NumericPad = 1<<21;
29 }
30}
31
32unsafe impl Encode for UIKeyModifierFlags {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UIKeyModifierFlags {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41 #[unsafe(super(NSObject))]
47 #[thread_kind = MainThreadOnly]
48 #[derive(Debug, PartialEq, Eq, Hash)]
49 pub struct UICommandAlternate;
50);
51
52extern_conformance!(
53 unsafe impl NSCoding for UICommandAlternate {}
54);
55
56extern_conformance!(
57 unsafe impl NSCopying for UICommandAlternate {}
58);
59
60unsafe impl CopyingHelper for UICommandAlternate {
61 type Result = Self;
62}
63
64extern_conformance!(
65 unsafe impl NSObjectProtocol for UICommandAlternate {}
66);
67
68extern_conformance!(
69 unsafe impl NSSecureCoding for UICommandAlternate {}
70);
71
72impl UICommandAlternate {
73 extern_methods!(
74 #[unsafe(method(title))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn title(&self) -> Retained<NSString>;
78
79 #[unsafe(method(action))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn action(&self) -> Sel;
83
84 #[unsafe(method(modifierFlags))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn modifierFlags(&self) -> UIKeyModifierFlags;
88
89 #[unsafe(method(alternateWithTitle:action:modifierFlags:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn alternateWithTitle_action_modifierFlags(
102 title: &NSString,
103 action: Sel,
104 modifier_flags: UIKeyModifierFlags,
105 mtm: MainThreadMarker,
106 ) -> Retained<Self>;
107
108 #[unsafe(method(new))]
109 #[unsafe(method_family = new)]
110 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
111
112 #[unsafe(method(init))]
113 #[unsafe(method_family = init)]
114 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
115
116 #[unsafe(method(initWithCoder:))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn initWithCoder(
119 this: Allocated<Self>,
120 coder: &NSCoder,
121 ) -> Option<Retained<Self>>;
122 );
123}
124
125extern_class!(
126 #[unsafe(super(UIMenuElement, NSObject))]
130 #[thread_kind = MainThreadOnly]
131 #[derive(Debug, PartialEq, Eq, Hash)]
132 #[cfg(feature = "UIMenuElement")]
133 pub struct UICommand;
134);
135
136#[cfg(feature = "UIMenuElement")]
137extern_conformance!(
138 unsafe impl NSCoding for UICommand {}
139);
140
141#[cfg(feature = "UIMenuElement")]
142extern_conformance!(
143 unsafe impl NSCopying for UICommand {}
144);
145
146#[cfg(feature = "UIMenuElement")]
147unsafe impl CopyingHelper for UICommand {
148 type Result = Self;
149}
150
151#[cfg(feature = "UIMenuElement")]
152extern_conformance!(
153 unsafe impl NSObjectProtocol for UICommand {}
154);
155
156#[cfg(feature = "UIMenuElement")]
157extern_conformance!(
158 unsafe impl NSSecureCoding for UICommand {}
159);
160
161#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
162extern_conformance!(
163 unsafe impl UIMenuLeaf for UICommand {}
164);
165
166#[cfg(feature = "UIMenuElement")]
167impl UICommand {
168 extern_methods!(
169 #[unsafe(method(title))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn title(&self) -> Retained<NSString>;
173
174 #[unsafe(method(setTitle:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setTitle(&self, title: &NSString);
178
179 #[cfg(feature = "UIImage")]
180 #[unsafe(method(image))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
184
185 #[cfg(feature = "UIImage")]
186 #[unsafe(method(setImage:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn setImage(&self, image: Option<&UIImage>);
190
191 #[unsafe(method(discoverabilityTitle))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
195
196 #[unsafe(method(setDiscoverabilityTitle:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
200
201 #[unsafe(method(action))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn action(&self) -> Sel;
205
206 #[unsafe(method(propertyList))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn propertyList(&self) -> Option<Retained<AnyObject>>;
210
211 #[unsafe(method(attributes))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn attributes(&self) -> UIMenuElementAttributes;
215
216 #[unsafe(method(setAttributes:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn setAttributes(&self, attributes: UIMenuElementAttributes);
220
221 #[unsafe(method(state))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn state(&self) -> UIMenuElementState;
225
226 #[unsafe(method(setState:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn setState(&self, state: UIMenuElementState);
230
231 #[unsafe(method(alternates))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn alternates(&self) -> Retained<NSArray<UICommandAlternate>>;
235
236 #[cfg(feature = "UIImage")]
237 #[unsafe(method(commandWithTitle:image:action:propertyList:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn commandWithTitle_image_action_propertyList(
252 title: &NSString,
253 image: Option<&UIImage>,
254 action: Sel,
255 property_list: Option<&AnyObject>,
256 mtm: MainThreadMarker,
257 ) -> Retained<Self>;
258
259 #[cfg(feature = "UIImage")]
260 #[unsafe(method(commandWithTitle:image:action:propertyList:alternates:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn commandWithTitle_image_action_propertyList_alternates(
277 title: &NSString,
278 image: Option<&UIImage>,
279 action: Sel,
280 property_list: Option<&AnyObject>,
281 alternates: &NSArray<UICommandAlternate>,
282 mtm: MainThreadMarker,
283 ) -> Retained<Self>;
284
285 #[unsafe(method(new))]
286 #[unsafe(method_family = new)]
287 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
288
289 #[unsafe(method(init))]
290 #[unsafe(method_family = init)]
291 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
292
293 #[unsafe(method(initWithCoder:))]
294 #[unsafe(method_family = init)]
295 pub unsafe fn initWithCoder(
296 this: Allocated<Self>,
297 coder: &NSCoder,
298 ) -> Option<Retained<Self>>;
299 );
300}
301
302extern "C" {
303 pub static UICommandTagShare: &'static NSString;
305}