1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenuleaf?language=objc)
pub unsafe trait UIMenuLeaf: NSObjectProtocol + MainThreadOnly {
/// Short display title.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
fn title(&self) -> Retained<NSString>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
fn setTitle(&self, title: &NSString);
#[cfg(feature = "UIImage")]
/// Image that can appear next to this element.
#[unsafe(method(image))]
#[unsafe(method_family = none)]
fn image(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
/// Setter for [`image`][Self::image].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setImage:))]
#[unsafe(method_family = none)]
fn setImage(&self, image: Option<&UIImage>);
#[cfg(feature = "UIImage")]
/// Image that can appear next to this action when the `state` is `UIMenuElementStateOn`
#[unsafe(method(selectedImage))]
#[unsafe(method_family = none)]
fn selectedImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
/// Setter for [`selectedImage`][Self::selectedImage].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setSelectedImage:))]
#[unsafe(method_family = none)]
fn setSelectedImage(&self, selected_image: Option<&UIImage>);
/// Elaborated title used in keyboard shortcut overlay.
#[unsafe(method(discoverabilityTitle))]
#[unsafe(method_family = none)]
fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
/// Setter for [`discoverabilityTitle`][Self::discoverabilityTitle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setDiscoverabilityTitle:))]
#[unsafe(method_family = none)]
fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
#[cfg(feature = "UIMenuElement")]
/// The element's attributes.
#[unsafe(method(attributes))]
#[unsafe(method_family = none)]
fn attributes(&self) -> UIMenuElementAttributes;
#[cfg(feature = "UIMenuElement")]
/// Setter for [`attributes`][Self::attributes].
#[unsafe(method(setAttributes:))]
#[unsafe(method_family = none)]
fn setAttributes(&self, attributes: UIMenuElementAttributes);
#[cfg(feature = "UIMenuElement")]
/// The element's selection state.
#[unsafe(method(state))]
#[unsafe(method_family = none)]
fn state(&self) -> UIMenuElementState;
#[cfg(feature = "UIMenuElement")]
/// Setter for [`state`][Self::state].
#[unsafe(method(setState:))]
#[unsafe(method_family = none)]
fn setState(&self, state: UIMenuElementState);
#[cfg(feature = "UIMenuElement")]
/// The leaf's preferred repeat behavior.
/// Menu leaves can repeatedly perform their primary actions on prolonged interactions,
/// such as by holding down their keyboard shortcut.
#[unsafe(method(repeatBehavior))]
#[unsafe(method_family = none)]
fn repeatBehavior(&self) -> UIMenuElementRepeatBehavior;
#[cfg(feature = "UIMenuElement")]
/// Setter for [`repeatBehavior`][Self::repeatBehavior].
#[unsafe(method(setRepeatBehavior:))]
#[unsafe(method_family = none)]
fn setRepeatBehavior(&self, repeat_behavior: UIMenuElementRepeatBehavior);
/// The object on behalf of which the element's primary action is being performed.
/// This property is only populated during the execution of the element's
/// primary action (i.e. its handler or selector) if available.
#[unsafe(method(sender))]
#[unsafe(method_family = none)]
fn sender(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
/// Source item for subsequent presentations. For example, an element displayed in a menu attached to a
/// `UIButton`may return the button so that a popover may be presented from it when the element is tapped.
/// If available, this property is only populated during the execution of the element's action (i.e. its handler or selector).
#[unsafe(method(presentationSourceItem))]
#[unsafe(method_family = none)]
fn presentationSourceItem(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
/// Performs the element’s primary action (i.e. it's handler or selector).
///
/// # Safety
///
/// - `sender` should be of the correct type.
/// - `target` should be of the correct type.
#[unsafe(method(performWithSender:target:))]
#[unsafe(method_family = none)]
unsafe fn performWithSender_target(
&self,
sender: Option<&AnyObject>,
target: Option<&AnyObject>,
);
}
);