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/uistackviewdistribution?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIStackViewDistribution(pub NSInteger);
impl UIStackViewDistribution {
    #[doc(alias = "UIStackViewDistributionFill")]
    pub const Fill: Self = Self(0);
    #[doc(alias = "UIStackViewDistributionFillEqually")]
    pub const FillEqually: Self = Self(1);
    #[doc(alias = "UIStackViewDistributionFillProportionally")]
    pub const FillProportionally: Self = Self(2);
    #[doc(alias = "UIStackViewDistributionEqualSpacing")]
    pub const EqualSpacing: Self = Self(3);
    #[doc(alias = "UIStackViewDistributionEqualCentering")]
    pub const EqualCentering: Self = Self(4);
}

unsafe impl Encode for UIStackViewDistribution {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIStackViewDistribution {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewalignment?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIStackViewAlignment(pub NSInteger);
impl UIStackViewAlignment {
    #[doc(alias = "UIStackViewAlignmentFill")]
    pub const Fill: Self = Self(0);
    #[doc(alias = "UIStackViewAlignmentLeading")]
    pub const Leading: Self = Self(1);
    #[doc(alias = "UIStackViewAlignmentTop")]
    pub const Top: Self = Self(UIStackViewAlignment::Leading.0);
    #[doc(alias = "UIStackViewAlignmentFirstBaseline")]
    pub const FirstBaseline: Self = Self(2);
    #[doc(alias = "UIStackViewAlignmentCenter")]
    pub const Center: Self = Self(3);
    #[doc(alias = "UIStackViewAlignmentTrailing")]
    pub const Trailing: Self = Self(4);
    #[doc(alias = "UIStackViewAlignmentBottom")]
    pub const Bottom: Self = Self(UIStackViewAlignment::Trailing.0);
    #[doc(alias = "UIStackViewAlignmentLastBaseline")]
    pub const LastBaseline: Self = Self(5);
}

unsafe impl Encode for UIStackViewAlignment {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIStackViewAlignment {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewspacingusedefault?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static UIStackViewSpacingUseDefault: CGFloat = c_float::MAX as _;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uistackviewspacingusesystem?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static UIStackViewSpacingUseSystem: CGFloat = c_float::MIN as _;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[unsafe(method(initWithArrangedSubviews:))]
        #[unsafe(method_family = init)]
        pub fn initWithArrangedSubviews(
            this: Allocated<Self>,
            views: &NSArray<UIView>,
        ) -> Retained<Self>;

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

        #[unsafe(method(addArrangedSubview:))]
        #[unsafe(method_family = none)]
        pub fn addArrangedSubview(&self, view: &UIView);

        #[unsafe(method(removeArrangedSubview:))]
        #[unsafe(method_family = none)]
        pub fn removeArrangedSubview(&self, view: &UIView);

        #[unsafe(method(insertArrangedSubview:atIndex:))]
        #[unsafe(method_family = none)]
        pub fn insertArrangedSubview_atIndex(&self, view: &UIView, stack_index: NSUInteger);

        #[unsafe(method(axis))]
        #[unsafe(method_family = none)]
        pub fn axis(&self) -> UILayoutConstraintAxis;

        /// Setter for [`axis`][Self::axis].
        #[unsafe(method(setAxis:))]
        #[unsafe(method_family = none)]
        pub fn setAxis(&self, axis: UILayoutConstraintAxis);

        #[unsafe(method(distribution))]
        #[unsafe(method_family = none)]
        pub fn distribution(&self) -> UIStackViewDistribution;

        /// Setter for [`distribution`][Self::distribution].
        #[unsafe(method(setDistribution:))]
        #[unsafe(method_family = none)]
        pub fn setDistribution(&self, distribution: UIStackViewDistribution);

        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub fn alignment(&self) -> UIStackViewAlignment;

        /// Setter for [`alignment`][Self::alignment].
        #[unsafe(method(setAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setAlignment(&self, alignment: UIStackViewAlignment);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(spacing))]
        #[unsafe(method_family = none)]
        pub fn spacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`spacing`][Self::spacing].
        #[unsafe(method(setSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setSpacing(&self, spacing: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setCustomSpacing:afterView:))]
        #[unsafe(method_family = none)]
        pub fn setCustomSpacing_afterView(&self, spacing: CGFloat, arranged_subview: &UIView);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(customSpacingAfterView:))]
        #[unsafe(method_family = none)]
        pub fn customSpacingAfterView(&self, arranged_subview: &UIView) -> CGFloat;

        #[unsafe(method(isBaselineRelativeArrangement))]
        #[unsafe(method_family = none)]
        pub fn isBaselineRelativeArrangement(&self) -> bool;

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

        #[unsafe(method(isLayoutMarginsRelativeArrangement))]
        #[unsafe(method_family = none)]
        pub fn isLayoutMarginsRelativeArrangement(&self) -> bool;

        /// Setter for [`isLayoutMarginsRelativeArrangement`][Self::isLayoutMarginsRelativeArrangement].
        #[unsafe(method(setLayoutMarginsRelativeArrangement:))]
        #[unsafe(method_family = none)]
        pub fn setLayoutMarginsRelativeArrangement(
            &self,
            layout_margins_relative_arrangement: bool,
        );
    );
}

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