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        unsafe fn title(&self) -> Retained<NSString>;
17
18        /// Setter for [`title`][Self::title].
19        #[unsafe(method(setTitle:))]
20        #[unsafe(method_family = none)]
21        unsafe fn setTitle(&self, title: &NSString);
22
23        #[cfg(feature = "UIImage")]
24        /// Image that can appear next to this element.
25        #[unsafe(method(image))]
26        #[unsafe(method_family = none)]
27        unsafe fn image(&self) -> Option<Retained<UIImage>>;
28
29        #[cfg(feature = "UIImage")]
30        /// Setter for [`image`][Self::image].
31        #[unsafe(method(setImage:))]
32        #[unsafe(method_family = none)]
33        unsafe fn setImage(&self, image: Option<&UIImage>);
34
35        #[cfg(feature = "UIImage")]
36        /// Image that can appear next to this action when the `state` is `UIMenuElementStateOn`
37        #[unsafe(method(selectedImage))]
38        #[unsafe(method_family = none)]
39        unsafe fn selectedImage(&self) -> Option<Retained<UIImage>>;
40
41        #[cfg(feature = "UIImage")]
42        /// Setter for [`selectedImage`][Self::selectedImage].
43        #[unsafe(method(setSelectedImage:))]
44        #[unsafe(method_family = none)]
45        unsafe fn setSelectedImage(&self, selected_image: Option<&UIImage>);
46
47        /// Elaborated title used in keyboard shortcut overlay.
48        #[unsafe(method(discoverabilityTitle))]
49        #[unsafe(method_family = none)]
50        unsafe fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
51
52        /// Setter for [`discoverabilityTitle`][Self::discoverabilityTitle].
53        #[unsafe(method(setDiscoverabilityTitle:))]
54        #[unsafe(method_family = none)]
55        unsafe fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
56
57        #[cfg(feature = "UIMenuElement")]
58        /// The element's attributes.
59        #[unsafe(method(attributes))]
60        #[unsafe(method_family = none)]
61        unsafe fn attributes(&self) -> UIMenuElementAttributes;
62
63        #[cfg(feature = "UIMenuElement")]
64        /// Setter for [`attributes`][Self::attributes].
65        #[unsafe(method(setAttributes:))]
66        #[unsafe(method_family = none)]
67        unsafe fn setAttributes(&self, attributes: UIMenuElementAttributes);
68
69        #[cfg(feature = "UIMenuElement")]
70        /// The element's selection state.
71        #[unsafe(method(state))]
72        #[unsafe(method_family = none)]
73        unsafe fn state(&self) -> UIMenuElementState;
74
75        #[cfg(feature = "UIMenuElement")]
76        /// Setter for [`state`][Self::state].
77        #[unsafe(method(setState:))]
78        #[unsafe(method_family = none)]
79        unsafe fn setState(&self, state: UIMenuElementState);
80
81        /// The object on behalf of which the element's primary action is being performed.
82        /// This property is only populated during the execution of the element's
83        /// primary action (i.e. its handler or selector) if available.
84        #[unsafe(method(sender))]
85        #[unsafe(method_family = none)]
86        unsafe fn sender(&self) -> Option<Retained<AnyObject>>;
87
88        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
89        /// Source item for subsequent presentations. For example, an element displayed in a menu attached to a
90        /// `UIButton`may return the button so that a popover may be presented from it when the element is tapped.
91        /// If available, this property is only populated during the execution of the element's action (i.e. its handler or selector).
92        #[unsafe(method(presentationSourceItem))]
93        #[unsafe(method_family = none)]
94        unsafe fn presentationSourceItem(
95            &self,
96        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
97
98        /// Performs the element’s primary action (i.e. it's handler or selector).
99        #[unsafe(method(performWithSender:target:))]
100        #[unsafe(method_family = none)]
101        unsafe fn performWithSender_target(
102            &self,
103            sender: Option<&AnyObject>,
104            target: Option<&AnyObject>,
105        );
106    }
107);