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
133extern_conformance!(
134    unsafe impl NSCoding for NSTextBlock {}
135);
136
137extern_conformance!(
138    unsafe impl NSCopying for NSTextBlock {}
139);
140
141unsafe impl CopyingHelper for NSTextBlock {
142    type Result = Self;
143}
144
145extern_conformance!(
146    unsafe impl NSObjectProtocol for NSTextBlock {}
147);
148
149extern_conformance!(
150    unsafe impl NSSecureCoding for NSTextBlock {}
151);
152
153impl NSTextBlock {
154    extern_methods!(
155        #[unsafe(method(init))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
158
159        #[cfg(feature = "objc2-core-foundation")]
160        #[unsafe(method(setValue:type:forDimension:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setValue_type_forDimension(
163            &self,
164            val: CGFloat,
165            r#type: NSTextBlockValueType,
166            dimension: NSTextBlockDimension,
167        );
168
169        #[cfg(feature = "objc2-core-foundation")]
170        #[unsafe(method(valueForDimension:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn valueForDimension(&self, dimension: NSTextBlockDimension) -> CGFloat;
173
174        #[unsafe(method(valueTypeForDimension:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn valueTypeForDimension(
177            &self,
178            dimension: NSTextBlockDimension,
179        ) -> NSTextBlockValueType;
180
181        #[cfg(feature = "objc2-core-foundation")]
182        #[unsafe(method(setContentWidth:type:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setContentWidth_type(&self, val: CGFloat, r#type: NSTextBlockValueType);
185
186        #[cfg(feature = "objc2-core-foundation")]
187        #[unsafe(method(contentWidth))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn contentWidth(&self) -> CGFloat;
190
191        #[unsafe(method(contentWidthValueType))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn contentWidthValueType(&self) -> NSTextBlockValueType;
194
195        #[cfg(feature = "objc2-core-foundation")]
196        #[unsafe(method(setWidth:type:forLayer:edge:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setWidth_type_forLayer_edge(
199            &self,
200            val: CGFloat,
201            r#type: NSTextBlockValueType,
202            layer: NSTextBlockLayer,
203            edge: NSRectEdge,
204        );
205
206        #[cfg(feature = "objc2-core-foundation")]
207        #[unsafe(method(setWidth:type:forLayer:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setWidth_type_forLayer(
210            &self,
211            val: CGFloat,
212            r#type: NSTextBlockValueType,
213            layer: NSTextBlockLayer,
214        );
215
216        #[cfg(feature = "objc2-core-foundation")]
217        #[unsafe(method(widthForLayer:edge:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn widthForLayer_edge(
220            &self,
221            layer: NSTextBlockLayer,
222            edge: NSRectEdge,
223        ) -> CGFloat;
224
225        #[unsafe(method(widthValueTypeForLayer:edge:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn widthValueTypeForLayer_edge(
228            &self,
229            layer: NSTextBlockLayer,
230            edge: NSRectEdge,
231        ) -> NSTextBlockValueType;
232
233        #[unsafe(method(verticalAlignment))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn verticalAlignment(&self) -> NSTextBlockVerticalAlignment;
236
237        /// Setter for [`verticalAlignment`][Self::verticalAlignment].
238        #[unsafe(method(setVerticalAlignment:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setVerticalAlignment(&self, vertical_alignment: NSTextBlockVerticalAlignment);
241
242        #[cfg(feature = "NSColor")]
243        #[unsafe(method(backgroundColor))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
246
247        #[cfg(feature = "NSColor")]
248        /// Setter for [`backgroundColor`][Self::backgroundColor].
249        #[unsafe(method(setBackgroundColor:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
252
253        #[cfg(feature = "NSColor")]
254        #[unsafe(method(setBorderColor:forEdge:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn setBorderColor_forEdge(&self, color: Option<&NSColor>, edge: NSRectEdge);
257
258        #[cfg(feature = "NSColor")]
259        #[unsafe(method(setBorderColor:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setBorderColor(&self, color: Option<&NSColor>);
262
263        #[cfg(feature = "NSColor")]
264        #[unsafe(method(borderColorForEdge:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn borderColorForEdge(&self, edge: NSRectEdge) -> Option<Retained<NSColor>>;
267
268        #[cfg(feature = "NSTextContainer")]
269        #[unsafe(method(rectForLayoutAtPoint:inRect:textContainer:characterRange:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn rectForLayoutAtPoint_inRect_textContainer_characterRange(
272            &self,
273            starting_point: NSPoint,
274            rect: NSRect,
275            text_container: &NSTextContainer,
276            char_range: NSRange,
277        ) -> NSRect;
278
279        #[cfg(feature = "NSTextContainer")]
280        #[unsafe(method(boundsRectForContentRect:inRect:textContainer:characterRange:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn boundsRectForContentRect_inRect_textContainer_characterRange(
283            &self,
284            content_rect: NSRect,
285            rect: NSRect,
286            text_container: &NSTextContainer,
287            char_range: NSRange,
288        ) -> NSRect;
289
290        #[cfg(all(
291            feature = "NSLayoutManager",
292            feature = "NSResponder",
293            feature = "NSView"
294        ))]
295        #[unsafe(method(drawBackgroundWithFrame:inView:characterRange:layoutManager:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn drawBackgroundWithFrame_inView_characterRange_layoutManager(
298            &self,
299            frame_rect: NSRect,
300            control_view: &NSView,
301            char_range: NSRange,
302            layout_manager: &NSLayoutManager,
303        );
304    );
305}
306
307/// Methods declared on superclass `NSObject`.
308impl NSTextBlock {
309    extern_methods!(
310        #[unsafe(method(new))]
311        #[unsafe(method_family = new)]
312        pub unsafe fn new() -> Retained<Self>;
313    );
314}
315
316extern_class!(
317    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttableblock?language=objc)
318    #[unsafe(super(NSTextBlock, NSObject))]
319    #[derive(Debug, PartialEq, Eq, Hash)]
320    pub struct NSTextTableBlock;
321);
322
323extern_conformance!(
324    unsafe impl NSCoding for NSTextTableBlock {}
325);
326
327extern_conformance!(
328    unsafe impl NSCopying for NSTextTableBlock {}
329);
330
331unsafe impl CopyingHelper for NSTextTableBlock {
332    type Result = Self;
333}
334
335extern_conformance!(
336    unsafe impl NSObjectProtocol for NSTextTableBlock {}
337);
338
339extern_conformance!(
340    unsafe impl NSSecureCoding for NSTextTableBlock {}
341);
342
343impl NSTextTableBlock {
344    extern_methods!(
345        #[unsafe(method(initWithTable:startingRow:rowSpan:startingColumn:columnSpan:))]
346        #[unsafe(method_family = init)]
347        pub unsafe fn initWithTable_startingRow_rowSpan_startingColumn_columnSpan(
348            this: Allocated<Self>,
349            table: &NSTextTable,
350            row: NSInteger,
351            row_span: NSInteger,
352            col: NSInteger,
353            col_span: NSInteger,
354        ) -> Retained<Self>;
355
356        #[unsafe(method(table))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn table(&self) -> Retained<NSTextTable>;
359
360        #[unsafe(method(startingRow))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn startingRow(&self) -> NSInteger;
363
364        #[unsafe(method(rowSpan))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn rowSpan(&self) -> NSInteger;
367
368        #[unsafe(method(startingColumn))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn startingColumn(&self) -> NSInteger;
371
372        #[unsafe(method(columnSpan))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn columnSpan(&self) -> NSInteger;
375    );
376}
377
378/// Methods declared on superclass `NSTextBlock`.
379impl NSTextTableBlock {
380    extern_methods!(
381        #[unsafe(method(init))]
382        #[unsafe(method_family = init)]
383        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
384    );
385}
386
387/// Methods declared on superclass `NSObject`.
388impl NSTextTableBlock {
389    extern_methods!(
390        #[unsafe(method(new))]
391        #[unsafe(method_family = new)]
392        pub unsafe fn new() -> Retained<Self>;
393    );
394}
395
396extern_class!(
397    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttable?language=objc)
398    #[unsafe(super(NSTextBlock, NSObject))]
399    #[derive(Debug, PartialEq, Eq, Hash)]
400    pub struct NSTextTable;
401);
402
403extern_conformance!(
404    unsafe impl NSCoding for NSTextTable {}
405);
406
407extern_conformance!(
408    unsafe impl NSCopying for NSTextTable {}
409);
410
411unsafe impl CopyingHelper for NSTextTable {
412    type Result = Self;
413}
414
415extern_conformance!(
416    unsafe impl NSObjectProtocol for NSTextTable {}
417);
418
419extern_conformance!(
420    unsafe impl NSSecureCoding for NSTextTable {}
421);
422
423impl NSTextTable {
424    extern_methods!(
425        #[unsafe(method(numberOfColumns))]
426        #[unsafe(method_family = none)]
427        pub unsafe fn numberOfColumns(&self) -> NSUInteger;
428
429        /// Setter for [`numberOfColumns`][Self::numberOfColumns].
430        #[unsafe(method(setNumberOfColumns:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn setNumberOfColumns(&self, number_of_columns: NSUInteger);
433
434        #[unsafe(method(layoutAlgorithm))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn layoutAlgorithm(&self) -> NSTextTableLayoutAlgorithm;
437
438        /// Setter for [`layoutAlgorithm`][Self::layoutAlgorithm].
439        #[unsafe(method(setLayoutAlgorithm:))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn setLayoutAlgorithm(&self, layout_algorithm: NSTextTableLayoutAlgorithm);
442
443        #[unsafe(method(collapsesBorders))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn collapsesBorders(&self) -> bool;
446
447        /// Setter for [`collapsesBorders`][Self::collapsesBorders].
448        #[unsafe(method(setCollapsesBorders:))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn setCollapsesBorders(&self, collapses_borders: bool);
451
452        #[unsafe(method(hidesEmptyCells))]
453        #[unsafe(method_family = none)]
454        pub unsafe fn hidesEmptyCells(&self) -> bool;
455
456        /// Setter for [`hidesEmptyCells`][Self::hidesEmptyCells].
457        #[unsafe(method(setHidesEmptyCells:))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn setHidesEmptyCells(&self, hides_empty_cells: bool);
460
461        #[cfg(feature = "NSTextContainer")]
462        #[unsafe(method(rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:))]
463        #[unsafe(method_family = none)]
464        pub unsafe fn rectForBlock_layoutAtPoint_inRect_textContainer_characterRange(
465            &self,
466            block: &NSTextTableBlock,
467            starting_point: NSPoint,
468            rect: NSRect,
469            text_container: &NSTextContainer,
470            char_range: NSRange,
471        ) -> NSRect;
472
473        #[cfg(feature = "NSTextContainer")]
474        #[unsafe(method(boundsRectForBlock:contentRect:inRect:textContainer:characterRange:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn boundsRectForBlock_contentRect_inRect_textContainer_characterRange(
477            &self,
478            block: &NSTextTableBlock,
479            content_rect: NSRect,
480            rect: NSRect,
481            text_container: &NSTextContainer,
482            char_range: NSRange,
483        ) -> NSRect;
484
485        #[cfg(all(
486            feature = "NSLayoutManager",
487            feature = "NSResponder",
488            feature = "NSView"
489        ))]
490        #[unsafe(method(drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn drawBackgroundForBlock_withFrame_inView_characterRange_layoutManager(
493            &self,
494            block: &NSTextTableBlock,
495            frame_rect: NSRect,
496            control_view: &NSView,
497            char_range: NSRange,
498            layout_manager: &NSLayoutManager,
499        );
500    );
501}
502
503/// Methods declared on superclass `NSTextBlock`.
504impl NSTextTable {
505    extern_methods!(
506        #[unsafe(method(init))]
507        #[unsafe(method_family = init)]
508        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
509    );
510}
511
512/// Methods declared on superclass `NSObject`.
513impl NSTextTable {
514    extern_methods!(
515        #[unsafe(method(new))]
516        #[unsafe(method_family = new)]
517        pub unsafe fn new() -> Retained<Self>;
518    );
519}