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 fn title(&self) -> Retained<NSString>;
78
79 #[unsafe(method(action))]
81 #[unsafe(method_family = none)]
82 pub fn action(&self) -> Sel;
83
84 #[unsafe(method(modifierFlags))]
86 #[unsafe(method_family = none)]
87 pub fn modifierFlags(&self) -> UIKeyModifierFlags;
88
89 #[unsafe(method(alternateWithTitle:action:modifierFlags:))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn alternateWithTitle_action_modifierFlags(
106 title: &NSString,
107 action: Sel,
108 modifier_flags: UIKeyModifierFlags,
109 mtm: MainThreadMarker,
110 ) -> Retained<Self>;
111
112 #[unsafe(method(new))]
113 #[unsafe(method_family = new)]
114 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
115
116 #[unsafe(method(init))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
119
120 #[unsafe(method(initWithCoder:))]
124 #[unsafe(method_family = init)]
125 pub unsafe fn initWithCoder(
126 this: Allocated<Self>,
127 coder: &NSCoder,
128 ) -> Option<Retained<Self>>;
129 );
130}
131
132extern_class!(
133 #[unsafe(super(UIMenuElement, NSObject))]
137 #[thread_kind = MainThreadOnly]
138 #[derive(Debug, PartialEq, Eq, Hash)]
139 #[cfg(feature = "UIMenuElement")]
140 pub struct UICommand;
141);
142
143#[cfg(feature = "UIMenuElement")]
144extern_conformance!(
145 unsafe impl NSCoding for UICommand {}
146);
147
148#[cfg(feature = "UIMenuElement")]
149extern_conformance!(
150 unsafe impl NSCopying for UICommand {}
151);
152
153#[cfg(feature = "UIMenuElement")]
154unsafe impl CopyingHelper for UICommand {
155 type Result = Self;
156}
157
158#[cfg(feature = "UIMenuElement")]
159extern_conformance!(
160 unsafe impl NSObjectProtocol for UICommand {}
161);
162
163#[cfg(feature = "UIMenuElement")]
164extern_conformance!(
165 unsafe impl NSSecureCoding for UICommand {}
166);
167
168#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
169extern_conformance!(
170 unsafe impl UIMenuLeaf for UICommand {}
171);
172
173#[cfg(feature = "UIMenuElement")]
174impl UICommand {
175 extern_methods!(
176 #[unsafe(method(title))]
178 #[unsafe(method_family = none)]
179 pub fn title(&self) -> Retained<NSString>;
180
181 #[unsafe(method(setTitle:))]
185 #[unsafe(method_family = none)]
186 pub fn setTitle(&self, title: &NSString);
187
188 #[cfg(feature = "UIImage")]
189 #[unsafe(method(image))]
191 #[unsafe(method_family = none)]
192 pub fn image(&self) -> Option<Retained<UIImage>>;
193
194 #[cfg(feature = "UIImage")]
195 #[unsafe(method(setImage:))]
199 #[unsafe(method_family = none)]
200 pub fn setImage(&self, image: Option<&UIImage>);
201
202 #[unsafe(method(discoverabilityTitle))]
204 #[unsafe(method_family = none)]
205 pub fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
206
207 #[unsafe(method(setDiscoverabilityTitle:))]
211 #[unsafe(method_family = none)]
212 pub fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
213
214 #[unsafe(method(action))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn action(&self) -> Sel;
218
219 #[unsafe(method(propertyList))]
221 #[unsafe(method_family = none)]
222 pub fn propertyList(&self) -> Option<Retained<AnyObject>>;
223
224 #[unsafe(method(attributes))]
226 #[unsafe(method_family = none)]
227 pub fn attributes(&self) -> UIMenuElementAttributes;
228
229 #[unsafe(method(setAttributes:))]
231 #[unsafe(method_family = none)]
232 pub fn setAttributes(&self, attributes: UIMenuElementAttributes);
233
234 #[unsafe(method(state))]
236 #[unsafe(method_family = none)]
237 pub fn state(&self) -> UIMenuElementState;
238
239 #[unsafe(method(setState:))]
241 #[unsafe(method_family = none)]
242 pub fn setState(&self, state: UIMenuElementState);
243
244 #[unsafe(method(alternates))]
246 #[unsafe(method_family = none)]
247 pub fn alternates(&self) -> Retained<NSArray<UICommandAlternate>>;
248
249 #[cfg(feature = "UIImage")]
250 #[unsafe(method(commandWithTitle:image:action:propertyList:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn commandWithTitle_image_action_propertyList(
270 title: &NSString,
271 image: Option<&UIImage>,
272 action: Sel,
273 property_list: Option<&AnyObject>,
274 mtm: MainThreadMarker,
275 ) -> Retained<Self>;
276
277 #[cfg(feature = "UIImage")]
278 #[unsafe(method(commandWithTitle:image:action:propertyList:alternates:))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn commandWithTitle_image_action_propertyList_alternates(
300 title: &NSString,
301 image: Option<&UIImage>,
302 action: Sel,
303 property_list: Option<&AnyObject>,
304 alternates: &NSArray<UICommandAlternate>,
305 mtm: MainThreadMarker,
306 ) -> Retained<Self>;
307
308 #[unsafe(method(new))]
309 #[unsafe(method_family = new)]
310 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
311
312 #[unsafe(method(init))]
313 #[unsafe(method_family = init)]
314 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
315
316 #[unsafe(method(initWithCoder:))]
320 #[unsafe(method_family = init)]
321 pub unsafe fn initWithCoder(
322 this: Allocated<Self>,
323 coder: &NSCoder,
324 ) -> Option<Retained<Self>>;
325 );
326}
327
328extern "C" {
329 pub static UICommandTagShare: &'static NSString;
331}