objc2_ui_kit/generated/
UIFocusSystem.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// UIFocusSystem instances manage focus state within a part of the user interface. They are in charge of tracking the current focused item, as well as processing focus updates.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocussystem?language=objc)
13    #[unsafe(super(NSObject))]
14    #[thread_kind = MainThreadOnly]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIFocusSystem;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for UIFocusSystem {}
21);
22
23impl UIFocusSystem {
24    extern_methods!(
25        #[cfg(feature = "UIFocus")]
26        /// The currently focused item in this focus system.
27        #[unsafe(method(focusedItem))]
28        #[unsafe(method_family = none)]
29        pub fn focusedItem(&self) -> Option<Retained<ProtocolObject<dyn UIFocusItem>>>;
30
31        #[unsafe(method(new))]
32        #[unsafe(method_family = new)]
33        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
34
35        #[unsafe(method(init))]
36        #[unsafe(method_family = init)]
37        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39        #[cfg(feature = "UIFocus")]
40        #[unsafe(method(focusSystemForEnvironment:))]
41        #[unsafe(method_family = none)]
42        pub fn focusSystemForEnvironment(
43            environment: &ProtocolObject<dyn UIFocusEnvironment>,
44        ) -> Option<Retained<UIFocusSystem>>;
45
46        #[cfg(feature = "UIFocus")]
47        /// Requests a focus update to the specified environment. If accepted, the focus update will happen
48        /// in the next run loop cycle.
49        #[unsafe(method(requestFocusUpdateToEnvironment:))]
50        #[unsafe(method_family = none)]
51        pub fn requestFocusUpdateToEnvironment(
52            &self,
53            environment: &ProtocolObject<dyn UIFocusEnvironment>,
54        );
55
56        /// Forces any pending focus update to be committed immediately.
57        #[unsafe(method(updateFocusIfNeeded))]
58        #[unsafe(method_family = none)]
59        pub fn updateFocusIfNeeded(&self);
60
61        #[cfg(feature = "UIFocus")]
62        /// Returns true if `environment` is an ancestor of `otherEnvironment`, or false if otherwise.
63        #[unsafe(method(environment:containsEnvironment:))]
64        #[unsafe(method_family = none)]
65        pub fn environment_containsEnvironment(
66            environment: &ProtocolObject<dyn UIFocusEnvironment>,
67            other_environment: &ProtocolObject<dyn UIFocusEnvironment>,
68        ) -> bool;
69    );
70}