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::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextBlockValueType(pub NSUInteger);
impl NSTextBlockValueType {
#[doc(alias = "NSTextBlockAbsoluteValueType")]
pub const AbsoluteValueType: Self = Self(0);
#[doc(alias = "NSTextBlockPercentageValueType")]
pub const PercentageValueType: Self = Self(1);
}
unsafe impl Encode for NSTextBlockValueType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTextBlockValueType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextBlockDimension(pub NSUInteger);
impl NSTextBlockDimension {
#[doc(alias = "NSTextBlockWidth")]
pub const Width: Self = Self(0);
#[doc(alias = "NSTextBlockMinimumWidth")]
pub const MinimumWidth: Self = Self(1);
#[doc(alias = "NSTextBlockMaximumWidth")]
pub const MaximumWidth: Self = Self(2);
#[doc(alias = "NSTextBlockHeight")]
pub const Height: Self = Self(4);
#[doc(alias = "NSTextBlockMinimumHeight")]
pub const MinimumHeight: Self = Self(5);
#[doc(alias = "NSTextBlockMaximumHeight")]
pub const MaximumHeight: Self = Self(6);
}
unsafe impl Encode for NSTextBlockDimension {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTextBlockDimension {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextBlockLayer(pub NSInteger);
impl NSTextBlockLayer {
#[doc(alias = "NSTextBlockPadding")]
pub const Padding: Self = Self(-1);
#[doc(alias = "NSTextBlockBorder")]
pub const Border: Self = Self(0);
#[doc(alias = "NSTextBlockMargin")]
pub const Margin: Self = Self(1);
}
unsafe impl Encode for NSTextBlockLayer {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTextBlockLayer {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextBlockVerticalAlignment(pub NSUInteger);
impl NSTextBlockVerticalAlignment {
#[doc(alias = "NSTextBlockTopAlignment")]
pub const TopAlignment: Self = Self(0);
#[doc(alias = "NSTextBlockMiddleAlignment")]
pub const MiddleAlignment: Self = Self(1);
#[doc(alias = "NSTextBlockBottomAlignment")]
pub const BottomAlignment: Self = Self(2);
#[doc(alias = "NSTextBlockBaselineAlignment")]
pub const BaselineAlignment: Self = Self(3);
}
unsafe impl Encode for NSTextBlockVerticalAlignment {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTextBlockVerticalAlignment {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextTableLayoutAlgorithm(pub NSUInteger);
impl NSTextTableLayoutAlgorithm {
#[doc(alias = "NSTextTableAutomaticLayoutAlgorithm")]
pub const AutomaticLayoutAlgorithm: Self = Self(0);
#[doc(alias = "NSTextTableFixedLayoutAlgorithm")]
pub const FixedLayoutAlgorithm: Self = Self(1);
}
unsafe impl Encode for NSTextTableLayoutAlgorithm {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTextTableLayoutAlgorithm {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextBlock;
);
extern_conformance!(
unsafe impl NSCoding for NSTextBlock {}
);
extern_conformance!(
unsafe impl NSCopying for NSTextBlock {}
);
unsafe impl CopyingHelper for NSTextBlock {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextBlock {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSTextBlock {}
);
impl NSTextBlock {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setValue:type:forDimension:))]
#[unsafe(method_family = none)]
pub fn setValue_type_forDimension(
&self,
val: CGFloat,
r#type: NSTextBlockValueType,
dimension: NSTextBlockDimension,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(valueForDimension:))]
#[unsafe(method_family = none)]
pub fn valueForDimension(&self, dimension: NSTextBlockDimension) -> CGFloat;
#[unsafe(method(valueTypeForDimension:))]
#[unsafe(method_family = none)]
pub fn valueTypeForDimension(
&self,
dimension: NSTextBlockDimension,
) -> NSTextBlockValueType;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setContentWidth:type:))]
#[unsafe(method_family = none)]
pub fn setContentWidth_type(&self, val: CGFloat, r#type: NSTextBlockValueType);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(contentWidth))]
#[unsafe(method_family = none)]
pub fn contentWidth(&self) -> CGFloat;
#[unsafe(method(contentWidthValueType))]
#[unsafe(method_family = none)]
pub fn contentWidthValueType(&self) -> NSTextBlockValueType;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setWidth:type:forLayer:edge:))]
#[unsafe(method_family = none)]
pub fn setWidth_type_forLayer_edge(
&self,
val: CGFloat,
r#type: NSTextBlockValueType,
layer: NSTextBlockLayer,
edge: NSRectEdge,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setWidth:type:forLayer:))]
#[unsafe(method_family = none)]
pub fn setWidth_type_forLayer(
&self,
val: CGFloat,
r#type: NSTextBlockValueType,
layer: NSTextBlockLayer,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(widthForLayer:edge:))]
#[unsafe(method_family = none)]
pub fn widthForLayer_edge(&self, layer: NSTextBlockLayer, edge: NSRectEdge) -> CGFloat;
#[unsafe(method(widthValueTypeForLayer:edge:))]
#[unsafe(method_family = none)]
pub fn widthValueTypeForLayer_edge(
&self,
layer: NSTextBlockLayer,
edge: NSRectEdge,
) -> NSTextBlockValueType;
#[unsafe(method(verticalAlignment))]
#[unsafe(method_family = none)]
pub fn verticalAlignment(&self) -> NSTextBlockVerticalAlignment;
#[unsafe(method(setVerticalAlignment:))]
#[unsafe(method_family = none)]
pub fn setVerticalAlignment(&self, vertical_alignment: NSTextBlockVerticalAlignment);
#[cfg(feature = "NSColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
#[cfg(feature = "NSColor")]
#[unsafe(method(setBorderColor:forEdge:))]
#[unsafe(method_family = none)]
pub fn setBorderColor_forEdge(&self, color: Option<&NSColor>, edge: NSRectEdge);
#[cfg(feature = "NSColor")]
#[unsafe(method(setBorderColor:))]
#[unsafe(method_family = none)]
pub fn setBorderColor(&self, color: Option<&NSColor>);
#[cfg(feature = "NSColor")]
#[unsafe(method(borderColorForEdge:))]
#[unsafe(method_family = none)]
pub fn borderColorForEdge(&self, edge: NSRectEdge) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(rectForLayoutAtPoint:inRect:textContainer:characterRange:))]
#[unsafe(method_family = none)]
pub fn rectForLayoutAtPoint_inRect_textContainer_characterRange(
&self,
starting_point: NSPoint,
rect: NSRect,
text_container: &NSTextContainer,
char_range: NSRange,
) -> NSRect;
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(boundsRectForContentRect:inRect:textContainer:characterRange:))]
#[unsafe(method_family = none)]
pub fn boundsRectForContentRect_inRect_textContainer_characterRange(
&self,
content_rect: NSRect,
rect: NSRect,
text_container: &NSTextContainer,
char_range: NSRange,
) -> NSRect;
#[cfg(all(
feature = "NSLayoutManager",
feature = "NSResponder",
feature = "NSView"
))]
#[unsafe(method(drawBackgroundWithFrame:inView:characterRange:layoutManager:))]
#[unsafe(method_family = none)]
pub fn drawBackgroundWithFrame_inView_characterRange_layoutManager(
&self,
frame_rect: NSRect,
control_view: &NSView,
char_range: NSRange,
layout_manager: &NSLayoutManager,
);
);
}
impl NSTextBlock {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSTextBlock {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSTextBlock, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextTableBlock;
);
extern_conformance!(
unsafe impl NSCoding for NSTextTableBlock {}
);
extern_conformance!(
unsafe impl NSCopying for NSTextTableBlock {}
);
unsafe impl CopyingHelper for NSTextTableBlock {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextTableBlock {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSTextTableBlock {}
);
impl NSTextTableBlock {
extern_methods!(
#[unsafe(method(initWithTable:startingRow:rowSpan:startingColumn:columnSpan:))]
#[unsafe(method_family = init)]
pub fn initWithTable_startingRow_rowSpan_startingColumn_columnSpan(
this: Allocated<Self>,
table: &NSTextTable,
row: NSInteger,
row_span: NSInteger,
col: NSInteger,
col_span: NSInteger,
) -> Retained<Self>;
#[unsafe(method(table))]
#[unsafe(method_family = none)]
pub fn table(&self) -> Retained<NSTextTable>;
#[unsafe(method(startingRow))]
#[unsafe(method_family = none)]
pub fn startingRow(&self) -> NSInteger;
#[unsafe(method(rowSpan))]
#[unsafe(method_family = none)]
pub fn rowSpan(&self) -> NSInteger;
#[unsafe(method(startingColumn))]
#[unsafe(method_family = none)]
pub fn startingColumn(&self) -> NSInteger;
#[unsafe(method(columnSpan))]
#[unsafe(method_family = none)]
pub fn columnSpan(&self) -> NSInteger;
);
}
impl NSTextTableBlock {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl NSTextTableBlock {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSTextTableBlock {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSTextBlock, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextTable;
);
extern_conformance!(
unsafe impl NSCoding for NSTextTable {}
);
extern_conformance!(
unsafe impl NSCopying for NSTextTable {}
);
unsafe impl CopyingHelper for NSTextTable {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextTable {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSTextTable {}
);
impl NSTextTable {
extern_methods!(
#[unsafe(method(numberOfColumns))]
#[unsafe(method_family = none)]
pub fn numberOfColumns(&self) -> NSUInteger;
#[unsafe(method(setNumberOfColumns:))]
#[unsafe(method_family = none)]
pub fn setNumberOfColumns(&self, number_of_columns: NSUInteger);
#[unsafe(method(layoutAlgorithm))]
#[unsafe(method_family = none)]
pub fn layoutAlgorithm(&self) -> NSTextTableLayoutAlgorithm;
#[unsafe(method(setLayoutAlgorithm:))]
#[unsafe(method_family = none)]
pub fn setLayoutAlgorithm(&self, layout_algorithm: NSTextTableLayoutAlgorithm);
#[unsafe(method(collapsesBorders))]
#[unsafe(method_family = none)]
pub fn collapsesBorders(&self) -> bool;
#[unsafe(method(setCollapsesBorders:))]
#[unsafe(method_family = none)]
pub fn setCollapsesBorders(&self, collapses_borders: bool);
#[unsafe(method(hidesEmptyCells))]
#[unsafe(method_family = none)]
pub fn hidesEmptyCells(&self) -> bool;
#[unsafe(method(setHidesEmptyCells:))]
#[unsafe(method_family = none)]
pub fn setHidesEmptyCells(&self, hides_empty_cells: bool);
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:))]
#[unsafe(method_family = none)]
pub fn rectForBlock_layoutAtPoint_inRect_textContainer_characterRange(
&self,
block: &NSTextTableBlock,
starting_point: NSPoint,
rect: NSRect,
text_container: &NSTextContainer,
char_range: NSRange,
) -> NSRect;
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(boundsRectForBlock:contentRect:inRect:textContainer:characterRange:))]
#[unsafe(method_family = none)]
pub fn boundsRectForBlock_contentRect_inRect_textContainer_characterRange(
&self,
block: &NSTextTableBlock,
content_rect: NSRect,
rect: NSRect,
text_container: &NSTextContainer,
char_range: NSRange,
) -> NSRect;
#[cfg(all(
feature = "NSLayoutManager",
feature = "NSResponder",
feature = "NSView"
))]
#[unsafe(method(drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:))]
#[unsafe(method_family = none)]
pub fn drawBackgroundForBlock_withFrame_inView_characterRange_layoutManager(
&self,
block: &NSTextTableBlock,
frame_rect: NSRect,
control_view: &NSView,
char_range: NSRange,
layout_manager: &NSLayoutManager,
);
);
}
impl NSTextTable {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
impl NSTextTable {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSTextTable {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}