objc2_ui_kit/generated/
UIContextMenuConfiguration.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 UIContextMenuConfigurationElementOrder(pub NSInteger);
15impl UIContextMenuConfigurationElementOrder {
16 #[doc(alias = "UIContextMenuConfigurationElementOrderAutomatic")]
17 pub const Automatic: Self = Self(0);
18 #[doc(alias = "UIContextMenuConfigurationElementOrderPriority")]
20 pub const Priority: Self = Self(1);
21 #[doc(alias = "UIContextMenuConfigurationElementOrderFixed")]
23 pub const Fixed: Self = Self(2);
24}
25
26unsafe impl Encode for UIContextMenuConfigurationElementOrder {
27 const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for UIContextMenuConfigurationElementOrder {
31 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34#[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
42pub type UIContextMenuActionProvider =
43 *mut block2::DynBlock<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>;
44
45#[cfg(all(
49 feature = "UIResponder",
50 feature = "UIViewController",
51 feature = "block2"
52))]
53pub type UIContextMenuContentPreviewProvider =
54 *mut block2::DynBlock<dyn Fn() -> *mut UIViewController>;
55
56extern_class!(
57 #[unsafe(super(NSObject))]
59 #[thread_kind = MainThreadOnly]
60 #[derive(Debug, PartialEq, Eq, Hash)]
61 pub struct UIContextMenuConfiguration;
62);
63
64extern_conformance!(
65 unsafe impl NSObjectProtocol for UIContextMenuConfiguration {}
66);
67
68impl UIContextMenuConfiguration {
69 extern_methods!(
70 #[unsafe(method(identifier))]
73 #[unsafe(method_family = none)]
74 pub fn identifier(&self) -> Retained<ProtocolObject<dyn NSCopying>>;
75
76 #[unsafe(method(secondaryItemIdentifiers))]
78 #[unsafe(method_family = none)]
79 pub fn secondaryItemIdentifiers(&self) -> Retained<NSSet<ProtocolObject<dyn NSCopying>>>;
80
81 #[unsafe(method(setSecondaryItemIdentifiers:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn setSecondaryItemIdentifiers(
91 &self,
92 secondary_item_identifiers: &NSSet<ProtocolObject<dyn NSCopying>>,
93 );
94
95 #[unsafe(method(badgeCount))]
98 #[unsafe(method_family = none)]
99 pub fn badgeCount(&self) -> NSInteger;
100
101 #[unsafe(method(setBadgeCount:))]
103 #[unsafe(method_family = none)]
104 pub fn setBadgeCount(&self, badge_count: NSInteger);
105
106 #[unsafe(method(preferredMenuElementOrder))]
108 #[unsafe(method_family = none)]
109 pub fn preferredMenuElementOrder(&self) -> UIContextMenuConfigurationElementOrder;
110
111 #[unsafe(method(setPreferredMenuElementOrder:))]
113 #[unsafe(method_family = none)]
114 pub fn setPreferredMenuElementOrder(
115 &self,
116 preferred_menu_element_order: UIContextMenuConfigurationElementOrder,
117 );
118
119 #[cfg(all(
120 feature = "UIMenu",
121 feature = "UIMenuElement",
122 feature = "UIResponder",
123 feature = "UIViewController",
124 feature = "block2"
125 ))]
126 #[unsafe(method(configurationWithIdentifier:previewProvider:actionProvider:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn configurationWithIdentifier_previewProvider_actionProvider(
144 identifier: Option<&ProtocolObject<dyn NSCopying>>,
145 preview_provider: UIContextMenuContentPreviewProvider,
146 action_provider: UIContextMenuActionProvider,
147 mtm: MainThreadMarker,
148 ) -> Retained<Self>;
149 );
150}
151
152impl UIContextMenuConfiguration {
154 extern_methods!(
155 #[unsafe(method(init))]
156 #[unsafe(method_family = init)]
157 pub fn init(this: Allocated<Self>) -> Retained<Self>;
158
159 #[unsafe(method(new))]
160 #[unsafe(method_family = new)]
161 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
162 );
163}