objc2_ui_kit/generated/
UIFocusGuide.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_class!(
11    /// UIFocusGuides are UILayoutGuide subclasses that participate in the focus system from within their owning view. A UIFocusGuide may be used to expose non-view areas as focusable.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusguide?language=objc)
14    #[unsafe(super(UILayoutGuide, NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "UILayoutGuide")]
18    pub struct UIFocusGuide;
19);
20
21#[cfg(feature = "UILayoutGuide")]
22unsafe impl NSCoding for UIFocusGuide {}
23
24#[cfg(feature = "UILayoutGuide")]
25unsafe impl NSObjectProtocol for UIFocusGuide {}
26
27#[cfg(feature = "UILayoutGuide")]
28impl UIFocusGuide {
29    extern_methods!(
30        /// If disabled, UIFocusGuides are ignored by the focus engine, but still participate in layout. Modifying this flag allows you to conditionally enable or disable certain focus behaviors. YES by default.
31        #[unsafe(method(isEnabled))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn isEnabled(&self) -> bool;
34
35        /// Setter for [`isEnabled`][Self::isEnabled].
36        #[unsafe(method(setEnabled:))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn setEnabled(&self, enabled: bool);
39
40        #[cfg(feature = "UIFocus")]
41        /// Setting preferredFocusEnvironments to a non-empty array marks this guide's layoutFrame as focusable. If empty, this guide is effectively disabled.
42        /// If focused, the guide attempts to redirect focus to each environment in the array, in order, stopping when a focusable item in an environment has been found.
43        #[unsafe(method(preferredFocusEnvironments))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn preferredFocusEnvironments(
46            &self,
47        ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>;
48
49        #[cfg(feature = "UIFocus")]
50        /// Setter for [`preferredFocusEnvironments`][Self::preferredFocusEnvironments].
51        #[unsafe(method(setPreferredFocusEnvironments:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn setPreferredFocusEnvironments(
54            &self,
55            preferred_focus_environments: Option<&NSArray<ProtocolObject<dyn UIFocusEnvironment>>>,
56        );
57
58        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
59        /// Setting a preferred focused view marks this guide's layoutFrame as focusable, and if focused, redirects focus to its preferred focused view. If nil, this guide is effectively disabled.
60        #[deprecated]
61        #[unsafe(method(preferredFocusedView))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn preferredFocusedView(&self) -> Option<Retained<UIView>>;
64
65        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
66        /// This is a [weak property][objc2::topics::weak_property].
67        /// Setter for [`preferredFocusedView`][Self::preferredFocusedView].
68        #[deprecated]
69        #[unsafe(method(setPreferredFocusedView:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setPreferredFocusedView(&self, preferred_focused_view: Option<&UIView>);
72    );
73}
74
75/// Methods declared on superclass `NSObject`.
76#[cfg(feature = "UILayoutGuide")]
77impl UIFocusGuide {
78    extern_methods!(
79        #[unsafe(method(init))]
80        #[unsafe(method_family = init)]
81        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
82
83        #[unsafe(method(new))]
84        #[unsafe(method_family = new)]
85        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
86    );
87}