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
52unsafe impl NSCoding for UICommandAlternate {}
53
54unsafe impl NSCopying for UICommandAlternate {}
55
56unsafe impl CopyingHelper for UICommandAlternate {
57 type Result = Self;
58}
59
60unsafe impl NSObjectProtocol for UICommandAlternate {}
61
62unsafe impl NSSecureCoding for UICommandAlternate {}
63
64impl UICommandAlternate {
65 extern_methods!(
66 #[unsafe(method(title))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn title(&self) -> Retained<NSString>;
70
71 #[unsafe(method(action))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn action(&self) -> Sel;
75
76 #[unsafe(method(modifierFlags))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn modifierFlags(&self) -> UIKeyModifierFlags;
80
81 #[unsafe(method(alternateWithTitle:action:modifierFlags:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn alternateWithTitle_action_modifierFlags(
94 title: &NSString,
95 action: Sel,
96 modifier_flags: UIKeyModifierFlags,
97 mtm: MainThreadMarker,
98 ) -> Retained<Self>;
99
100 #[unsafe(method(new))]
101 #[unsafe(method_family = new)]
102 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
103
104 #[unsafe(method(init))]
105 #[unsafe(method_family = init)]
106 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108 #[unsafe(method(initWithCoder:))]
109 #[unsafe(method_family = init)]
110 pub unsafe fn initWithCoder(
111 this: Allocated<Self>,
112 coder: &NSCoder,
113 ) -> Option<Retained<Self>>;
114 );
115}
116
117extern_class!(
118 #[unsafe(super(UIMenuElement, NSObject))]
122 #[thread_kind = MainThreadOnly]
123 #[derive(Debug, PartialEq, Eq, Hash)]
124 #[cfg(feature = "UIMenuElement")]
125 pub struct UICommand;
126);
127
128#[cfg(feature = "UIMenuElement")]
129unsafe impl NSCoding for UICommand {}
130
131#[cfg(feature = "UIMenuElement")]
132unsafe impl NSCopying for UICommand {}
133
134#[cfg(feature = "UIMenuElement")]
135unsafe impl CopyingHelper for UICommand {
136 type Result = Self;
137}
138
139#[cfg(feature = "UIMenuElement")]
140unsafe impl NSObjectProtocol for UICommand {}
141
142#[cfg(feature = "UIMenuElement")]
143unsafe impl NSSecureCoding for UICommand {}
144
145#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
146unsafe impl UIMenuLeaf for UICommand {}
147
148#[cfg(feature = "UIMenuElement")]
149impl UICommand {
150 extern_methods!(
151 #[unsafe(method(title))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn title(&self) -> Retained<NSString>;
155
156 #[unsafe(method(setTitle:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setTitle(&self, title: &NSString);
160
161 #[cfg(feature = "UIImage")]
162 #[unsafe(method(image))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
166
167 #[cfg(feature = "UIImage")]
168 #[unsafe(method(setImage:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn setImage(&self, image: Option<&UIImage>);
172
173 #[unsafe(method(discoverabilityTitle))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
177
178 #[unsafe(method(setDiscoverabilityTitle:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
182
183 #[unsafe(method(action))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn action(&self) -> Sel;
187
188 #[unsafe(method(propertyList))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn propertyList(&self) -> Option<Retained<AnyObject>>;
192
193 #[unsafe(method(attributes))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn attributes(&self) -> UIMenuElementAttributes;
197
198 #[unsafe(method(setAttributes:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setAttributes(&self, attributes: UIMenuElementAttributes);
202
203 #[unsafe(method(state))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn state(&self) -> UIMenuElementState;
207
208 #[unsafe(method(setState:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn setState(&self, state: UIMenuElementState);
212
213 #[unsafe(method(alternates))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn alternates(&self) -> Retained<NSArray<UICommandAlternate>>;
217
218 #[cfg(feature = "UIImage")]
219 #[unsafe(method(commandWithTitle:image:action:propertyList:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn commandWithTitle_image_action_propertyList(
234 title: &NSString,
235 image: Option<&UIImage>,
236 action: Sel,
237 property_list: Option<&AnyObject>,
238 mtm: MainThreadMarker,
239 ) -> Retained<Self>;
240
241 #[cfg(feature = "UIImage")]
242 #[unsafe(method(commandWithTitle:image:action:propertyList:alternates:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn commandWithTitle_image_action_propertyList_alternates(
259 title: &NSString,
260 image: Option<&UIImage>,
261 action: Sel,
262 property_list: Option<&AnyObject>,
263 alternates: &NSArray<UICommandAlternate>,
264 mtm: MainThreadMarker,
265 ) -> Retained<Self>;
266
267 #[unsafe(method(new))]
268 #[unsafe(method_family = new)]
269 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
270
271 #[unsafe(method(init))]
272 #[unsafe(method_family = init)]
273 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
274
275 #[unsafe(method(initWithCoder:))]
276 #[unsafe(method_family = init)]
277 pub unsafe fn initWithCoder(
278 this: Allocated<Self>,
279 coder: &NSCoder,
280 ) -> Option<Retained<Self>>;
281 );
282}
283
284extern "C" {
285 pub static UICommandTagShare: &'static NSString;
287}