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::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttextalignment?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIListContentTextAlignment(pub NSInteger);
impl UIListContentTextAlignment {
    #[doc(alias = "UIListContentTextAlignmentNatural")]
    pub const Natural: Self = Self(0);
    #[doc(alias = "UIListContentTextAlignmentCenter")]
    pub const Center: Self = Self(1);
    #[doc(alias = "UIListContentTextAlignmentJustified")]
    pub const Justified: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttexttransform?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIListContentTextTransform(pub NSInteger);
impl UIListContentTextTransform {
    #[doc(alias = "UIListContentTextTransformNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIListContentTextTransformUppercase")]
    pub const Uppercase: Self = Self(1);
    #[doc(alias = "UIListContentTextTransformLowercase")]
    pub const Lowercase: Self = Self(2);
    #[doc(alias = "UIListContentTextTransformCapitalized")]
    pub const Capitalized: Self = Self(3);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontenttextproperties?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIListContentTextProperties;
);

extern_conformance!(
    unsafe impl NSCoding for UIListContentTextProperties {}
);

extern_conformance!(
    unsafe impl NSCopying for UIListContentTextProperties {}
);

unsafe impl CopyingHelper for UIListContentTextProperties {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for UIListContentTextProperties {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for UIListContentTextProperties {}
);

impl UIListContentTextProperties {
    extern_methods!(
        #[cfg(feature = "UIFont")]
        /// The font used for the text.
        #[unsafe(method(font))]
        #[unsafe(method_family = none)]
        pub fn font(&self) -> Retained<UIFont>;

        #[cfg(feature = "UIFont")]
        /// Setter for [`font`][Self::font].
        #[unsafe(method(setFont:))]
        #[unsafe(method_family = none)]
        pub fn setFont(&self, font: &UIFont);

        #[cfg(feature = "UIColor")]
        /// The color of the text.
        #[unsafe(method(color))]
        #[unsafe(method_family = none)]
        pub fn color(&self) -> Retained<UIColor>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`color`][Self::color].
        #[unsafe(method(setColor:))]
        #[unsafe(method_family = none)]
        pub fn setColor(&self, color: &UIColor);

        #[cfg(all(
            feature = "UIColor",
            feature = "UIConfigurationColorTransformer",
            feature = "block2"
        ))]
        /// Optional color transformer that is used to resolve the color. A nil value means the `color` is used as-is.
        ///
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(colorTransformer))]
        #[unsafe(method_family = none)]
        pub unsafe fn colorTransformer(&self) -> UIConfigurationColorTransformer;

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

        #[cfg(feature = "UIColor")]
        /// Returns the resolved color, based on the `color` and `colorTransformer`.
        #[unsafe(method(resolvedColor))]
        #[unsafe(method_family = none)]
        pub fn resolvedColor(&self) -> Retained<UIColor>;

        /// The alignment for the text.
        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub fn alignment(&self) -> UIListContentTextAlignment;

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

        #[cfg(feature = "NSParagraphStyle")]
        /// The line break mode to use for the text.
        #[unsafe(method(lineBreakMode))]
        #[unsafe(method_family = none)]
        pub fn lineBreakMode(&self) -> NSLineBreakMode;

        #[cfg(feature = "NSParagraphStyle")]
        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
        #[unsafe(method(setLineBreakMode:))]
        #[unsafe(method_family = none)]
        pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);

        /// The maximum number of lines for the text. 0 indicates the number of lines is unlimited.
        #[unsafe(method(numberOfLines))]
        #[unsafe(method_family = none)]
        pub fn numberOfLines(&self) -> NSInteger;

        /// Setter for [`numberOfLines`][Self::numberOfLines].
        #[unsafe(method(setNumberOfLines:))]
        #[unsafe(method_family = none)]
        pub fn setNumberOfLines(&self, number_of_lines: NSInteger);

        /// Whether the font size of the text is automatically adjusted when necessary to fit in the available width.
        #[unsafe(method(adjustsFontSizeToFitWidth))]
        #[unsafe(method_family = none)]
        pub fn adjustsFontSizeToFitWidth(&self) -> bool;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// When `adjustsFontSizeToFitWidth` is enabled, the smallest multiplier for the font size used to make the text fit.
        #[unsafe(method(minimumScaleFactor))]
        #[unsafe(method_family = none)]
        pub fn minimumScaleFactor(&self) -> CGFloat;

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

        /// Whether the text is tightened before truncating.
        #[unsafe(method(allowsDefaultTighteningForTruncation))]
        #[unsafe(method_family = none)]
        pub fn allowsDefaultTighteningForTruncation(&self) -> bool;

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

        /// Whether the font is automatically updated when the content size category changes.
        #[unsafe(method(adjustsFontForContentSizeCategory))]
        #[unsafe(method_family = none)]
        pub fn adjustsFontForContentSizeCategory(&self) -> bool;

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

        /// Whether the full text will be shown when a pointer hovers over truncated text.
        #[unsafe(method(showsExpansionTextWhenTruncated))]
        #[unsafe(method_family = none)]
        pub fn showsExpansionTextWhenTruncated(&self) -> bool;

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

        /// A transform that is applied to the text before it is displayed.
        #[unsafe(method(transform))]
        #[unsafe(method_family = none)]
        pub fn transform(&self) -> UIListContentTextTransform;

        /// Setter for [`transform`][Self::transform].
        #[unsafe(method(setTransform:))]
        #[unsafe(method_family = none)]
        pub fn setTransform(&self, transform: UIListContentTextTransform);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIListContentTextProperties {
    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>;
    );
}