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")]
22extern_conformance!(
23    unsafe impl NSCoding for UIFocusGuide {}
24);
25
26#[cfg(feature = "UILayoutGuide")]
27extern_conformance!(
28    unsafe impl NSObjectProtocol for UIFocusGuide {}
29);
30
31#[cfg(feature = "UILayoutGuide")]
32impl UIFocusGuide {
33    extern_methods!(
34        /// 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.
35        #[unsafe(method(isEnabled))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn isEnabled(&self) -> bool;
38
39        /// Setter for [`isEnabled`][Self::isEnabled].
40        #[unsafe(method(setEnabled:))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn setEnabled(&self, enabled: bool);
43
44        #[cfg(feature = "UIFocus")]
45        /// Setting preferredFocusEnvironments to a non-empty array marks this guide's layoutFrame as focusable. If empty, this guide is effectively disabled.
46        /// 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.
47        #[unsafe(method(preferredFocusEnvironments))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn preferredFocusEnvironments(
50            &self,
51        ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>;
52
53        #[cfg(feature = "UIFocus")]
54        /// Setter for [`preferredFocusEnvironments`][Self::preferredFocusEnvironments].
55        #[unsafe(method(setPreferredFocusEnvironments:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setPreferredFocusEnvironments(
58            &self,
59            preferred_focus_environments: Option<&NSArray<ProtocolObject<dyn UIFocusEnvironment>>>,
60        );
61
62        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
63        /// 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.
64        #[deprecated]
65        #[unsafe(method(preferredFocusedView))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn preferredFocusedView(&self) -> Option<Retained<UIView>>;
68
69        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
70        /// This is a [weak property][objc2::topics::weak_property].
71        /// Setter for [`preferredFocusedView`][Self::preferredFocusedView].
72        #[deprecated]
73        #[unsafe(method(setPreferredFocusedView:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setPreferredFocusedView(&self, preferred_focused_view: Option<&UIView>);
76    );
77}
78
79/// Methods declared on superclass `NSObject`.
80#[cfg(feature = "UILayoutGuide")]
81impl UIFocusGuide {
82    extern_methods!(
83        #[unsafe(method(init))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
86
87        #[unsafe(method(new))]
88        #[unsafe(method_family = new)]
89        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
90    );
91}