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

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

unsafe impl NSCoding for NSTextContainer {}

unsafe impl NSObjectProtocol for NSTextContainer {}

unsafe impl NSSecureCoding for NSTextContainer {}

impl NSTextContainer {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// ************************** Initialization ***************************
        #[unsafe(method(initWithSize:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSize(this: Allocated<Self>, size: CGSize) -> Retained<Self>;

        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSTextLayoutManager")]
        #[unsafe(method(textLayoutManager))]
        #[unsafe(method_family = none)]
        pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// *********************** Container shape properties ************************
        #[unsafe(method(size))]
        #[unsafe(method_family = none)]
        pub unsafe fn size(&self) -> CGSize;

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

        #[cfg(feature = "NSParagraphStyle")]
        #[unsafe(method(lineBreakMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// *********************** Layout constraint properties ************************
        #[unsafe(method(lineFragmentPadding))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineFragmentPadding(&self) -> CGFloat;

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

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

        /// Setter for [`maximumNumberOfLines`][Self::maximumNumberOfLines].
        #[unsafe(method(setMaximumNumberOfLines:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumNumberOfLines(&self, maximum_number_of_lines: NSUInteger);

        #[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
        /// ************************** Line fragments ***************************
        #[unsafe(method(lineFragmentRectForProposedRect:atIndex:writingDirection:remainingRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineFragmentRectForProposedRect_atIndex_writingDirection_remainingRect(
            &self,
            proposed_rect: CGRect,
            character_index: NSUInteger,
            base_writing_direction: NSWritingDirection,
            remaining_rect: *mut CGRect,
        ) -> CGRect;

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

        /// ************************** View synchronization ***************************
        #[unsafe(method(widthTracksTextView))]
        #[unsafe(method_family = none)]
        pub unsafe fn widthTracksTextView(&self) -> bool;

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

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

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

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

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

impl NSTextContainer {
    extern_methods!(
        #[cfg(feature = "NSLayoutManager")]
        #[unsafe(method(layoutManager))]
        #[unsafe(method_family = none)]
        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;

        #[cfg(feature = "NSLayoutManager")]
        /// Setter for [`layoutManager`][Self::layoutManager].
        #[unsafe(method(setLayoutManager:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLayoutManager(&self, layout_manager: Option<&NSLayoutManager>);

        #[cfg(feature = "NSLayoutManager")]
        #[unsafe(method(replaceLayoutManager:))]
        #[unsafe(method_family = none)]
        pub unsafe fn replaceLayoutManager(&self, new_layout_manager: &NSLayoutManager);

        #[cfg(feature = "NSBezierPath")]
        #[unsafe(method(exclusionPaths))]
        #[unsafe(method_family = none)]
        pub unsafe fn exclusionPaths(&self) -> Retained<NSArray<NSBezierPath>>;

        #[cfg(feature = "NSBezierPath")]
        /// Setter for [`exclusionPaths`][Self::exclusionPaths].
        #[unsafe(method(setExclusionPaths:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExclusionPaths(&self, exclusion_paths: &NSArray<NSBezierPath>);

        #[cfg(all(
            feature = "NSResponder",
            feature = "NSText",
            feature = "NSTextView",
            feature = "NSView"
        ))]
        #[unsafe(method(textView))]
        #[unsafe(method_family = none)]
        pub unsafe fn textView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;

        #[cfg(all(
            feature = "NSResponder",
            feature = "NSText",
            feature = "NSTextView",
            feature = "NSView"
        ))]
        /// This is a [weak property][objc2::topics::weak_property].
        /// Setter for [`textView`][Self::textView].
        #[unsafe(method(setTextView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTextView(&self, text_view: Option<&NSTextView>);
    );
}

#[cfg(feature = "NSLayoutManager")]
unsafe impl NSTextLayoutOrientationProvider for NSTextContainer {}

/// ************************** Deprecated ***************************
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nslinesweepdirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineSweepDirection(pub NSUInteger);
impl NSLineSweepDirection {
    #[doc(alias = "NSLineSweepLeft")]
    pub const Left: Self = Self(0);
    #[doc(alias = "NSLineSweepRight")]
    pub const Right: Self = Self(1);
    #[doc(alias = "NSLineSweepDown")]
    pub const Down: Self = Self(2);
    #[doc(alias = "NSLineSweepUp")]
    pub const Up: Self = Self(3);
}

unsafe impl Encode for NSLineSweepDirection {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslinemovementdirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineMovementDirection(pub NSUInteger);
impl NSLineMovementDirection {
    #[doc(alias = "NSLineDoesntMove")]
    pub const DoesntMove: Self = Self(0);
    #[doc(alias = "NSLineMovesLeft")]
    pub const MovesLeft: Self = Self(1);
    #[doc(alias = "NSLineMovesRight")]
    pub const MovesRight: Self = Self(2);
    #[doc(alias = "NSLineMovesDown")]
    pub const MovesDown: Self = Self(3);
    #[doc(alias = "NSLineMovesUp")]
    pub const MovesUp: Self = Self(4);
}

unsafe impl Encode for NSLineMovementDirection {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

/// NSTextContainerDeprecated.
impl NSTextContainer {
    extern_methods!(
        #[unsafe(method(initWithContainerSize:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContainerSize(
            this: Allocated<Self>,
            a_container_size: NSSize,
        ) -> Retained<Self>;

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

        /// Setter for [`containerSize`][Self::containerSize].
        #[unsafe(method(setContainerSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContainerSize(&self, container_size: NSSize);

        #[unsafe(method(lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineFragmentRectForProposedRect_sweepDirection_movementDirection_remainingRect(
            &self,
            proposed_rect: NSRect,
            sweep_direction: NSLineSweepDirection,
            movement_direction: NSLineMovementDirection,
            remaining_rect: NSRectPointer,
        ) -> NSRect;

        #[deprecated]
        #[unsafe(method(containsPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsPoint(&self, point: NSPoint) -> bool;
    );
}
