objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusguide?language=objc)
    #[unsafe(super(UILayoutGuide, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "UILayoutGuide")]
    pub struct UIFocusGuide;
);

#[cfg(feature = "UILayoutGuide")]
extern_conformance!(
    unsafe impl NSCoding for UIFocusGuide {}
);

#[cfg(feature = "UILayoutGuide")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIFocusGuide {}
);

#[cfg(feature = "UILayoutGuide")]
impl UIFocusGuide {
    extern_methods!(
        /// 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.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub fn isEnabled(&self) -> bool;

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setEnabled(&self, enabled: bool);

        #[cfg(feature = "UIFocus")]
        /// Setting preferredFocusEnvironments to a non-empty array marks this guide's layoutFrame as focusable. If empty, this guide is effectively disabled.
        /// 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.
        #[unsafe(method(preferredFocusEnvironments))]
        #[unsafe(method_family = none)]
        pub fn preferredFocusEnvironments(
            &self,
        ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>;

        #[cfg(feature = "UIFocus")]
        /// Setter for [`preferredFocusEnvironments`][Self::preferredFocusEnvironments].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPreferredFocusEnvironments:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFocusEnvironments(
            &self,
            preferred_focus_environments: Option<&NSArray<ProtocolObject<dyn UIFocusEnvironment>>>,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// 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.
        #[deprecated]
        #[unsafe(method(preferredFocusedView))]
        #[unsafe(method_family = none)]
        pub fn preferredFocusedView(&self) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// Setter for [`preferredFocusedView`][Self::preferredFocusedView].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[deprecated]
        #[unsafe(method(setPreferredFocusedView:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFocusedView(&self, preferred_focused_view: Option<&UIView>);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UILayoutGuide")]
impl UIFocusGuide {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}