objc2_app_kit/generated/
NSTextTable.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextblockvaluetype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTextBlockValueType(pub NSUInteger);
17impl NSTextBlockValueType {
18    #[doc(alias = "NSTextBlockAbsoluteValueType")]
19    pub const AbsoluteValueType: Self = Self(0);
20    #[doc(alias = "NSTextBlockPercentageValueType")]
21    pub const PercentageValueType: Self = Self(1);
22}
23
24unsafe impl Encode for NSTextBlockValueType {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSTextBlockValueType {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextblockdimension?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSTextBlockDimension(pub NSUInteger);
37impl NSTextBlockDimension {
38    #[doc(alias = "NSTextBlockWidth")]
39    pub const Width: Self = Self(0);
40    #[doc(alias = "NSTextBlockMinimumWidth")]
41    pub const MinimumWidth: Self = Self(1);
42    #[doc(alias = "NSTextBlockMaximumWidth")]
43    pub const MaximumWidth: Self = Self(2);
44    #[doc(alias = "NSTextBlockHeight")]
45    pub const Height: Self = Self(4);
46    #[doc(alias = "NSTextBlockMinimumHeight")]
47    pub const MinimumHeight: Self = Self(5);
48    #[doc(alias = "NSTextBlockMaximumHeight")]
49    pub const MaximumHeight: Self = Self(6);
50}
51
52unsafe impl Encode for NSTextBlockDimension {
53    const ENCODING: Encoding = NSUInteger::ENCODING;
54}
55
56unsafe impl RefEncode for NSTextBlockDimension {
57    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
58}
59
60/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextblocklayer?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct NSTextBlockLayer(pub NSInteger);
65impl NSTextBlockLayer {
66    #[doc(alias = "NSTextBlockPadding")]
67    pub const Padding: Self = Self(-1);
68    #[doc(alias = "NSTextBlockBorder")]
69    pub const Border: Self = Self(0);
70    #[doc(alias = "NSTextBlockMargin")]
71    pub const Margin: Self = Self(1);
72}
73
74unsafe impl Encode for NSTextBlockLayer {
75    const ENCODING: Encoding = NSInteger::ENCODING;
76}
77
78unsafe impl RefEncode for NSTextBlockLayer {
79    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
80}
81
82/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextblockverticalalignment?language=objc)
83// NS_ENUM
84#[repr(transparent)]
85#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
86pub struct NSTextBlockVerticalAlignment(pub NSUInteger);
87impl NSTextBlockVerticalAlignment {
88    #[doc(alias = "NSTextBlockTopAlignment")]
89    pub const TopAlignment: Self = Self(0);
90    #[doc(alias = "NSTextBlockMiddleAlignment")]
91    pub const MiddleAlignment: Self = Self(1);
92    #[doc(alias = "NSTextBlockBottomAlignment")]
93    pub const BottomAlignment: Self = Self(2);
94    #[doc(alias = "NSTextBlockBaselineAlignment")]
95    pub const BaselineAlignment: Self = Self(3);
96}
97
98unsafe impl Encode for NSTextBlockVerticalAlignment {
99    const ENCODING: Encoding = NSUInteger::ENCODING;
100}
101
102unsafe impl RefEncode for NSTextBlockVerticalAlignment {
103    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttablelayoutalgorithm?language=objc)
107// NS_ENUM
108#[repr(transparent)]
109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
110pub struct NSTextTableLayoutAlgorithm(pub NSUInteger);
111impl NSTextTableLayoutAlgorithm {
112    #[doc(alias = "NSTextTableAutomaticLayoutAlgorithm")]
113    pub const AutomaticLayoutAlgorithm: Self = Self(0);
114    #[doc(alias = "NSTextTableFixedLayoutAlgorithm")]
115    pub const FixedLayoutAlgorithm: Self = Self(1);
116}
117
118unsafe impl Encode for NSTextTableLayoutAlgorithm {
119    const ENCODING: Encoding = NSUInteger::ENCODING;
120}
121
122unsafe impl RefEncode for NSTextTableLayoutAlgorithm {
123    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
124}
125
126extern_class!(
127    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextblock?language=objc)
128    #[unsafe(super(NSObject))]
129    #[derive(Debug, PartialEq, Eq, Hash)]
130    pub struct NSTextBlock;
131);
132
133unsafe impl NSCoding for NSTextBlock {}
134
135unsafe impl NSCopying for NSTextBlock {}
136
137unsafe impl CopyingHelper for NSTextBlock {
138    type Result = Self;
139}
140
141unsafe impl NSObjectProtocol for NSTextBlock {}
142
143unsafe impl NSSecureCoding for NSTextBlock {}
144
145impl NSTextBlock {
146    extern_methods!(
147        #[unsafe(method(init))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
150
151        #[cfg(feature = "objc2-core-foundation")]
152        #[unsafe(method(setValue:type:forDimension:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setValue_type_forDimension(
155            &self,
156            val: CGFloat,
157            r#type: NSTextBlockValueType,
158            dimension: NSTextBlockDimension,
159        );
160
161        #[cfg(feature = "objc2-core-foundation")]
162        #[unsafe(method(valueForDimension:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn valueForDimension(&self, dimension: NSTextBlockDimension) -> CGFloat;
165
166        #[unsafe(method(valueTypeForDimension:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn valueTypeForDimension(
169            &self,
170            dimension: NSTextBlockDimension,
171        ) -> NSTextBlockValueType;
172
173        #[cfg(feature = "objc2-core-foundation")]
174        #[unsafe(method(setContentWidth:type:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setContentWidth_type(&self, val: CGFloat, r#type: NSTextBlockValueType);
177
178        #[cfg(feature = "objc2-core-foundation")]
179        #[unsafe(method(contentWidth))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn contentWidth(&self) -> CGFloat;
182
183        #[unsafe(method(contentWidthValueType))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn contentWidthValueType(&self) -> NSTextBlockValueType;
186
187        #[cfg(feature = "objc2-core-foundation")]
188        #[unsafe(method(setWidth:type:forLayer:edge:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setWidth_type_forLayer_edge(
191            &self,
192            val: CGFloat,
193            r#type: NSTextBlockValueType,
194            layer: NSTextBlockLayer,
195            edge: NSRectEdge,
196        );
197
198        #[cfg(feature = "objc2-core-foundation")]
199        #[unsafe(method(setWidth:type:forLayer:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setWidth_type_forLayer(
202            &self,
203            val: CGFloat,
204            r#type: NSTextBlockValueType,
205            layer: NSTextBlockLayer,
206        );
207
208        #[cfg(feature = "objc2-core-foundation")]
209        #[unsafe(method(widthForLayer:edge:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn widthForLayer_edge(
212            &self,
213            layer: NSTextBlockLayer,
214            edge: NSRectEdge,
215        ) -> CGFloat;
216
217        #[unsafe(method(widthValueTypeForLayer:edge:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn widthValueTypeForLayer_edge(
220            &self,
221            layer: NSTextBlockLayer,
222            edge: NSRectEdge,
223        ) -> NSTextBlockValueType;
224
225        #[unsafe(method(verticalAlignment))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn verticalAlignment(&self) -> NSTextBlockVerticalAlignment;
228
229        /// Setter for [`verticalAlignment`][Self::verticalAlignment].
230        #[unsafe(method(setVerticalAlignment:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn setVerticalAlignment(&self, vertical_alignment: NSTextBlockVerticalAlignment);
233
234        #[cfg(feature = "NSColor")]
235        #[unsafe(method(backgroundColor))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
238
239        #[cfg(feature = "NSColor")]
240        /// Setter for [`backgroundColor`][Self::backgroundColor].
241        #[unsafe(method(setBackgroundColor:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
244
245        #[cfg(feature = "NSColor")]
246        #[unsafe(method(setBorderColor:forEdge:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn setBorderColor_forEdge(&self, color: Option<&NSColor>, edge: NSRectEdge);
249
250        #[cfg(feature = "NSColor")]
251        #[unsafe(method(setBorderColor:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn setBorderColor(&self, color: Option<&NSColor>);
254
255        #[cfg(feature = "NSColor")]
256        #[unsafe(method(borderColorForEdge:))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn borderColorForEdge(&self, edge: NSRectEdge) -> Option<Retained<NSColor>>;
259
260        #[cfg(feature = "NSTextContainer")]
261        #[unsafe(method(rectForLayoutAtPoint:inRect:textContainer:characterRange:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn rectForLayoutAtPoint_inRect_textContainer_characterRange(
264            &self,
265            starting_point: NSPoint,
266            rect: NSRect,
267            text_container: &NSTextContainer,
268            char_range: NSRange,
269        ) -> NSRect;
270
271        #[cfg(feature = "NSTextContainer")]
272        #[unsafe(method(boundsRectForContentRect:inRect:textContainer:characterRange:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn boundsRectForContentRect_inRect_textContainer_characterRange(
275            &self,
276            content_rect: NSRect,
277            rect: NSRect,
278            text_container: &NSTextContainer,
279            char_range: NSRange,
280        ) -> NSRect;
281
282        #[cfg(all(
283            feature = "NSLayoutManager",
284            feature = "NSResponder",
285            feature = "NSView"
286        ))]
287        #[unsafe(method(drawBackgroundWithFrame:inView:characterRange:layoutManager:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn drawBackgroundWithFrame_inView_characterRange_layoutManager(
290            &self,
291            frame_rect: NSRect,
292            control_view: &NSView,
293            char_range: NSRange,
294            layout_manager: &NSLayoutManager,
295        );
296    );
297}
298
299/// Methods declared on superclass `NSObject`.
300impl NSTextBlock {
301    extern_methods!(
302        #[unsafe(method(new))]
303        #[unsafe(method_family = new)]
304        pub unsafe fn new() -> Retained<Self>;
305    );
306}
307
308extern_class!(
309    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttableblock?language=objc)
310    #[unsafe(super(NSTextBlock, NSObject))]
311    #[derive(Debug, PartialEq, Eq, Hash)]
312    pub struct NSTextTableBlock;
313);
314
315unsafe impl NSCoding for NSTextTableBlock {}
316
317unsafe impl NSCopying for NSTextTableBlock {}
318
319unsafe impl CopyingHelper for NSTextTableBlock {
320    type Result = Self;
321}
322
323unsafe impl NSObjectProtocol for NSTextTableBlock {}
324
325unsafe impl NSSecureCoding for NSTextTableBlock {}
326
327impl NSTextTableBlock {
328    extern_methods!(
329        #[unsafe(method(initWithTable:startingRow:rowSpan:startingColumn:columnSpan:))]
330        #[unsafe(method_family = init)]
331        pub unsafe fn initWithTable_startingRow_rowSpan_startingColumn_columnSpan(
332            this: Allocated<Self>,
333            table: &NSTextTable,
334            row: NSInteger,
335            row_span: NSInteger,
336            col: NSInteger,
337            col_span: NSInteger,
338        ) -> Retained<Self>;
339
340        #[unsafe(method(table))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn table(&self) -> Retained<NSTextTable>;
343
344        #[unsafe(method(startingRow))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn startingRow(&self) -> NSInteger;
347
348        #[unsafe(method(rowSpan))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn rowSpan(&self) -> NSInteger;
351
352        #[unsafe(method(startingColumn))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn startingColumn(&self) -> NSInteger;
355
356        #[unsafe(method(columnSpan))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn columnSpan(&self) -> NSInteger;
359    );
360}
361
362/// Methods declared on superclass `NSTextBlock`.
363impl NSTextTableBlock {
364    extern_methods!(
365        #[unsafe(method(init))]
366        #[unsafe(method_family = init)]
367        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
368    );
369}
370
371/// Methods declared on superclass `NSObject`.
372impl NSTextTableBlock {
373    extern_methods!(
374        #[unsafe(method(new))]
375        #[unsafe(method_family = new)]
376        pub unsafe fn new() -> Retained<Self>;
377    );
378}
379
380extern_class!(
381    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttable?language=objc)
382    #[unsafe(super(NSTextBlock, NSObject))]
383    #[derive(Debug, PartialEq, Eq, Hash)]
384    pub struct NSTextTable;
385);
386
387unsafe impl NSCoding for NSTextTable {}
388
389unsafe impl NSCopying for NSTextTable {}
390
391unsafe impl CopyingHelper for NSTextTable {
392    type Result = Self;
393}
394
395unsafe impl NSObjectProtocol for NSTextTable {}
396
397unsafe impl NSSecureCoding for NSTextTable {}
398
399impl NSTextTable {
400    extern_methods!(
401        #[unsafe(method(numberOfColumns))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn numberOfColumns(&self) -> NSUInteger;
404
405        /// Setter for [`numberOfColumns`][Self::numberOfColumns].
406        #[unsafe(method(setNumberOfColumns:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn setNumberOfColumns(&self, number_of_columns: NSUInteger);
409
410        #[unsafe(method(layoutAlgorithm))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn layoutAlgorithm(&self) -> NSTextTableLayoutAlgorithm;
413
414        /// Setter for [`layoutAlgorithm`][Self::layoutAlgorithm].
415        #[unsafe(method(setLayoutAlgorithm:))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn setLayoutAlgorithm(&self, layout_algorithm: NSTextTableLayoutAlgorithm);
418
419        #[unsafe(method(collapsesBorders))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn collapsesBorders(&self) -> bool;
422
423        /// Setter for [`collapsesBorders`][Self::collapsesBorders].
424        #[unsafe(method(setCollapsesBorders:))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn setCollapsesBorders(&self, collapses_borders: bool);
427
428        #[unsafe(method(hidesEmptyCells))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn hidesEmptyCells(&self) -> bool;
431
432        /// Setter for [`hidesEmptyCells`][Self::hidesEmptyCells].
433        #[unsafe(method(setHidesEmptyCells:))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn setHidesEmptyCells(&self, hides_empty_cells: bool);
436
437        #[cfg(feature = "NSTextContainer")]
438        #[unsafe(method(rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn rectForBlock_layoutAtPoint_inRect_textContainer_characterRange(
441            &self,
442            block: &NSTextTableBlock,
443            starting_point: NSPoint,
444            rect: NSRect,
445            text_container: &NSTextContainer,
446            char_range: NSRange,
447        ) -> NSRect;
448
449        #[cfg(feature = "NSTextContainer")]
450        #[unsafe(method(boundsRectForBlock:contentRect:inRect:textContainer:characterRange:))]
451        #[unsafe(method_family = none)]
452        pub unsafe fn boundsRectForBlock_contentRect_inRect_textContainer_characterRange(
453            &self,
454            block: &NSTextTableBlock,
455            content_rect: NSRect,
456            rect: NSRect,
457            text_container: &NSTextContainer,
458            char_range: NSRange,
459        ) -> NSRect;
460
461        #[cfg(all(
462            feature = "NSLayoutManager",
463            feature = "NSResponder",
464            feature = "NSView"
465        ))]
466        #[unsafe(method(drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:))]
467        #[unsafe(method_family = none)]
468        pub unsafe fn drawBackgroundForBlock_withFrame_inView_characterRange_layoutManager(
469            &self,
470            block: &NSTextTableBlock,
471            frame_rect: NSRect,
472            control_view: &NSView,
473            char_range: NSRange,
474            layout_manager: &NSLayoutManager,
475        );
476    );
477}
478
479/// Methods declared on superclass `NSTextBlock`.
480impl NSTextTable {
481    extern_methods!(
482        #[unsafe(method(init))]
483        #[unsafe(method_family = init)]
484        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
485    );
486}
487
488/// Methods declared on superclass `NSObject`.
489impl NSTextTable {
490    extern_methods!(
491        #[unsafe(method(new))]
492        #[unsafe(method_family = new)]
493        pub unsafe fn new() -> Retained<Self>;
494    );
495}