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!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextContainer;
);
extern_conformance!(
unsafe impl NSCoding for NSTextContainer {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextContainer {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSTextContainer {}
);
impl NSTextContainer {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithSize:))]
#[unsafe(method_family = init)]
pub 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 fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(size))]
#[unsafe(method_family = none)]
pub fn size(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setSize:))]
#[unsafe(method_family = none)]
pub fn setSize(&self, size: CGSize);
#[cfg(feature = "NSParagraphStyle")]
#[unsafe(method(lineBreakMode))]
#[unsafe(method_family = none)]
pub fn lineBreakMode(&self) -> NSLineBreakMode;
#[cfg(feature = "NSParagraphStyle")]
#[unsafe(method(setLineBreakMode:))]
#[unsafe(method_family = none)]
pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineFragmentPadding))]
#[unsafe(method_family = none)]
pub fn lineFragmentPadding(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineFragmentPadding:))]
#[unsafe(method_family = none)]
pub fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
#[unsafe(method(maximumNumberOfLines))]
#[unsafe(method_family = none)]
pub fn maximumNumberOfLines(&self) -> NSUInteger;
#[unsafe(method(setMaximumNumberOfLines:))]
#[unsafe(method_family = none)]
pub fn setMaximumNumberOfLines(&self, maximum_number_of_lines: NSUInteger);
#[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
#[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 fn isSimpleRectangularTextContainer(&self) -> bool;
#[unsafe(method(widthTracksTextView))]
#[unsafe(method_family = none)]
pub fn widthTracksTextView(&self) -> bool;
#[unsafe(method(setWidthTracksTextView:))]
#[unsafe(method_family = none)]
pub fn setWidthTracksTextView(&self, width_tracks_text_view: bool);
#[unsafe(method(heightTracksTextView))]
#[unsafe(method_family = none)]
pub fn heightTracksTextView(&self) -> bool;
#[unsafe(method(setHeightTracksTextView:))]
#[unsafe(method_family = none)]
pub fn setHeightTracksTextView(&self, height_tracks_text_view: bool);
);
}
impl NSTextContainer {
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() -> Retained<Self>;
);
}
impl DefaultRetained for NSTextContainer {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
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")]
#[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 fn replaceLayoutManager(&self, new_layout_manager: &NSLayoutManager);
#[cfg(feature = "NSBezierPath")]
#[unsafe(method(exclusionPaths))]
#[unsafe(method_family = none)]
pub fn exclusionPaths(&self) -> Retained<NSArray<NSBezierPath>>;
#[cfg(feature = "NSBezierPath")]
#[unsafe(method(setExclusionPaths:))]
#[unsafe(method_family = none)]
pub 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 fn textView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[unsafe(method(setTextView:))]
#[unsafe(method_family = none)]
pub fn setTextView(&self, text_view: Option<&NSTextView>);
);
}
#[cfg(feature = "NSLayoutManager")]
extern_conformance!(
unsafe impl NSTextLayoutOrientationProvider for NSTextContainer {}
);
#[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);
}
#[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);
}
impl NSTextContainer {
extern_methods!(
#[unsafe(method(initWithContainerSize:))]
#[unsafe(method_family = init)]
pub fn initWithContainerSize(
this: Allocated<Self>,
a_container_size: NSSize,
) -> Retained<Self>;
#[unsafe(method(containerSize))]
#[unsafe(method_family = none)]
pub fn containerSize(&self) -> NSSize;
#[unsafe(method(setContainerSize:))]
#[unsafe(method_family = none)]
pub 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 fn containsPoint(&self, point: NSPoint) -> bool;
);
}