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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitableviewheaderfooterviewconfigurationupdatehandler?language=objc)
#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "UIViewConfigurationState",
    feature = "block2"
))]
pub type UITableViewHeaderFooterViewConfigurationUpdateHandler = *mut block2::DynBlock<
    dyn Fn(NonNull<UITableViewHeaderFooterView>, NonNull<UIViewConfigurationState>),
>;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitableviewheaderfooterview?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UITableViewHeaderFooterView;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UITableViewHeaderFooterView {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UITableViewHeaderFooterView {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UITableViewHeaderFooterView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UITableViewHeaderFooterView {
    extern_methods!(
        #[unsafe(method(initWithReuseIdentifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithReuseIdentifier(
            this: Allocated<Self>,
            reuse_identifier: Option<&NSString>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "UIViewConfigurationState")]
        /// Returns the current configuration state for the header/footer.
        /// To add your own custom state(s), override the getter and call super to obtain an instance with the
        /// system properties set, then set your own custom states as desired.
        #[unsafe(method(configurationState))]
        #[unsafe(method_family = none)]
        pub fn configurationState(&self) -> Retained<UIViewConfigurationState>;

        /// Requests the view update its configuration for its current state. This method is called automatically
        /// when the view's `configurationState` may have changed, as well as in other circumstances where an
        /// update may be required. Multiple requests may be coalesced into a single update at the appropriate time.
        #[unsafe(method(setNeedsUpdateConfiguration))]
        #[unsafe(method_family = none)]
        pub fn setNeedsUpdateConfiguration(&self);

        #[cfg(feature = "UIViewConfigurationState")]
        /// Subclasses should override this method and update the view's configuration using the state provided.
        /// This method should not be called directly, use `setNeedsUpdateConfiguration` to request an update.
        #[unsafe(method(updateConfigurationUsingState:))]
        #[unsafe(method_family = none)]
        pub fn updateConfigurationUsingState(&self, state: &UIViewConfigurationState);

        #[cfg(all(feature = "UIViewConfigurationState", feature = "block2"))]
        /// Optional block-based alternative to overriding `-updateConfigurationUsingState:` in a subclass. This handler
        /// is called after `-updateConfigurationUsingState:`. Setting a new handler triggers `setNeedsUpdateConfiguration`.
        ///
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 2 must be a valid pointer.
        #[unsafe(method(configurationUpdateHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurationUpdateHandler(
            &self,
        ) -> UITableViewHeaderFooterViewConfigurationUpdateHandler;

        #[cfg(all(feature = "UIViewConfigurationState", feature = "block2"))]
        /// Setter for [`configurationUpdateHandler`][Self::configurationUpdateHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `configuration_update_handler` must be a valid pointer or null.
        #[unsafe(method(setConfigurationUpdateHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setConfigurationUpdateHandler(
            &self,
            configuration_update_handler: UITableViewHeaderFooterViewConfigurationUpdateHandler,
        );

        #[cfg(feature = "UIListContentConfiguration")]
        /// Returns a default list content configuration for the header/footer view's style.
        #[unsafe(method(defaultContentConfiguration))]
        #[unsafe(method_family = none)]
        pub fn defaultContentConfiguration(&self) -> Retained<UIListContentConfiguration>;

        #[cfg(feature = "UIContentConfiguration")]
        /// Setting a content configuration replaces the existing contentView of the header/footer with a new content view instance from the configuration,
        /// or directly applies the configuration to the existing content view if the configuration is compatible with the existing content view type.
        /// The default value is nil. After a configuration has been set, setting this property to nil will replace the current content view with a new content view.
        #[unsafe(method(contentConfiguration))]
        #[unsafe(method_family = none)]
        pub fn contentConfiguration(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;

        #[cfg(feature = "UIContentConfiguration")]
        /// Setter for [`contentConfiguration`][Self::contentConfiguration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setContentConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setContentConfiguration(
            &self,
            content_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
        );

        /// When YES, the header/footer will automatically call -updatedConfigurationForState: on its `contentConfiguration` when the header/footer's
        /// configuration state changes, and apply the updated configuration back to the header/footer. The default value is YES.
        #[unsafe(method(automaticallyUpdatesContentConfiguration))]
        #[unsafe(method_family = none)]
        pub fn automaticallyUpdatesContentConfiguration(&self) -> bool;

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

        #[unsafe(method(contentView))]
        #[unsafe(method_family = none)]
        pub fn contentView(&self) -> Retained<UIView>;

        #[cfg(feature = "UILabel")]
        #[deprecated = "Use UIListContentConfiguration instead, this property will be deprecated in a future release."]
        #[unsafe(method(textLabel))]
        #[unsafe(method_family = none)]
        pub fn textLabel(&self) -> Option<Retained<UILabel>>;

        #[cfg(feature = "UILabel")]
        #[deprecated = "Use UIListContentConfiguration instead, this property will be deprecated in a future release."]
        #[unsafe(method(detailTextLabel))]
        #[unsafe(method_family = none)]
        pub fn detailTextLabel(&self) -> Option<Retained<UILabel>>;

        #[cfg(feature = "UIBackgroundConfiguration")]
        /// Returns a default background configuration for the header/footer's style.
        /// This background configuration represents the default appearance that the header/footer will use.
        #[unsafe(method(defaultBackgroundConfiguration))]
        #[unsafe(method_family = none)]
        pub fn defaultBackgroundConfiguration(&self) -> Retained<UIBackgroundConfiguration>;

        #[cfg(feature = "UIBackgroundConfiguration")]
        /// Setting a background configuration supersedes the header/footer's backgroundView. The default value is nil.
        #[unsafe(method(backgroundConfiguration))]
        #[unsafe(method_family = none)]
        pub fn backgroundConfiguration(&self) -> Option<Retained<UIBackgroundConfiguration>>;

        #[cfg(feature = "UIBackgroundConfiguration")]
        /// Setter for [`backgroundConfiguration`][Self::backgroundConfiguration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackgroundConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundConfiguration(
            &self,
            background_configuration: Option<&UIBackgroundConfiguration>,
        );

        /// When YES, the header/footer will automatically call -updatedConfigurationForState: on its `backgroundConfiguration` when the header/footer's
        /// configuration state changes, and apply the updated configuration back to the header/footer. The default value is YES.
        #[unsafe(method(automaticallyUpdatesBackgroundConfiguration))]
        #[unsafe(method_family = none)]
        pub fn automaticallyUpdatesBackgroundConfiguration(&self) -> bool;

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

        #[unsafe(method(backgroundView))]
        #[unsafe(method_family = none)]
        pub fn backgroundView(&self) -> Option<Retained<UIView>>;

        /// Setter for [`backgroundView`][Self::backgroundView].
        #[unsafe(method(setBackgroundView:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundView(&self, background_view: Option<&UIView>);

        #[unsafe(method(reuseIdentifier))]
        #[unsafe(method_family = none)]
        pub fn reuseIdentifier(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(prepareForReuse))]
        #[unsafe(method_family = none)]
        pub fn prepareForReuse(&self);
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UITableViewHeaderFooterView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UITableViewHeaderFooterView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}