objc2_ui_kit/generated/
UIMenuLeaf.rs

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