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 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 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 fn valueForDimension(&self, dimension: NSTextBlockDimension) -> CGFloat;
173
174        #[unsafe(method(valueTypeForDimension:))]
175        #[unsafe(method_family = none)]
176        pub 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 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 fn contentWidth(&self) -> CGFloat;
190
191        #[unsafe(method(contentWidthValueType))]
192        #[unsafe(method_family = none)]
193        pub 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 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 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 fn widthForLayer_edge(&self, layer: NSTextBlockLayer, edge: NSRectEdge) -> CGFloat;
220
221        #[unsafe(method(widthValueTypeForLayer:edge:))]
222        #[unsafe(method_family = none)]
223        pub fn widthValueTypeForLayer_edge(
224            &self,
225            layer: NSTextBlockLayer,
226            edge: NSRectEdge,
227        ) -> NSTextBlockValueType;
228
229        #[unsafe(method(verticalAlignment))]
230        #[unsafe(method_family = none)]
231        pub fn verticalAlignment(&self) -> NSTextBlockVerticalAlignment;
232
233        /// Setter for [`verticalAlignment`][Self::verticalAlignment].
234        #[unsafe(method(setVerticalAlignment:))]
235        #[unsafe(method_family = none)]
236        pub fn setVerticalAlignment(&self, vertical_alignment: NSTextBlockVerticalAlignment);
237
238        #[cfg(feature = "NSColor")]
239        #[unsafe(method(backgroundColor))]
240        #[unsafe(method_family = none)]
241        pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
242
243        #[cfg(feature = "NSColor")]
244        /// Setter for [`backgroundColor`][Self::backgroundColor].
245        ///
246        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
247        #[unsafe(method(setBackgroundColor:))]
248        #[unsafe(method_family = none)]
249        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
250
251        #[cfg(feature = "NSColor")]
252        #[unsafe(method(setBorderColor:forEdge:))]
253        #[unsafe(method_family = none)]
254        pub fn setBorderColor_forEdge(&self, color: Option<&NSColor>, edge: NSRectEdge);
255
256        #[cfg(feature = "NSColor")]
257        #[unsafe(method(setBorderColor:))]
258        #[unsafe(method_family = none)]
259        pub fn setBorderColor(&self, color: Option<&NSColor>);
260
261        #[cfg(feature = "NSColor")]
262        #[unsafe(method(borderColorForEdge:))]
263        #[unsafe(method_family = none)]
264        pub fn borderColorForEdge(&self, edge: NSRectEdge) -> Option<Retained<NSColor>>;
265
266        #[cfg(feature = "NSTextContainer")]
267        #[unsafe(method(rectForLayoutAtPoint:inRect:textContainer:characterRange:))]
268        #[unsafe(method_family = none)]
269        pub fn rectForLayoutAtPoint_inRect_textContainer_characterRange(
270            &self,
271            starting_point: NSPoint,
272            rect: NSRect,
273            text_container: &NSTextContainer,
274            char_range: NSRange,
275        ) -> NSRect;
276
277        #[cfg(feature = "NSTextContainer")]
278        #[unsafe(method(boundsRectForContentRect:inRect:textContainer:characterRange:))]
279        #[unsafe(method_family = none)]
280        pub fn boundsRectForContentRect_inRect_textContainer_characterRange(
281            &self,
282            content_rect: NSRect,
283            rect: NSRect,
284            text_container: &NSTextContainer,
285            char_range: NSRange,
286        ) -> NSRect;
287
288        #[cfg(all(
289            feature = "NSLayoutManager",
290            feature = "NSResponder",
291            feature = "NSView"
292        ))]
293        #[unsafe(method(drawBackgroundWithFrame:inView:characterRange:layoutManager:))]
294        #[unsafe(method_family = none)]
295        pub fn drawBackgroundWithFrame_inView_characterRange_layoutManager(
296            &self,
297            frame_rect: NSRect,
298            control_view: &NSView,
299            char_range: NSRange,
300            layout_manager: &NSLayoutManager,
301        );
302    );
303}
304
305/// Methods declared on superclass `NSObject`.
306impl NSTextBlock {
307    extern_methods!(
308        #[unsafe(method(new))]
309        #[unsafe(method_family = new)]
310        pub fn new() -> Retained<Self>;
311    );
312}
313
314impl DefaultRetained for NSTextBlock {
315    #[inline]
316    fn default_retained() -> Retained<Self> {
317        Self::new()
318    }
319}
320
321extern_class!(
322    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttableblock?language=objc)
323    #[unsafe(super(NSTextBlock, NSObject))]
324    #[derive(Debug, PartialEq, Eq, Hash)]
325    pub struct NSTextTableBlock;
326);
327
328extern_conformance!(
329    unsafe impl NSCoding for NSTextTableBlock {}
330);
331
332extern_conformance!(
333    unsafe impl NSCopying for NSTextTableBlock {}
334);
335
336unsafe impl CopyingHelper for NSTextTableBlock {
337    type Result = Self;
338}
339
340extern_conformance!(
341    unsafe impl NSObjectProtocol for NSTextTableBlock {}
342);
343
344extern_conformance!(
345    unsafe impl NSSecureCoding for NSTextTableBlock {}
346);
347
348impl NSTextTableBlock {
349    extern_methods!(
350        #[unsafe(method(initWithTable:startingRow:rowSpan:startingColumn:columnSpan:))]
351        #[unsafe(method_family = init)]
352        pub fn initWithTable_startingRow_rowSpan_startingColumn_columnSpan(
353            this: Allocated<Self>,
354            table: &NSTextTable,
355            row: NSInteger,
356            row_span: NSInteger,
357            col: NSInteger,
358            col_span: NSInteger,
359        ) -> Retained<Self>;
360
361        #[unsafe(method(table))]
362        #[unsafe(method_family = none)]
363        pub fn table(&self) -> Retained<NSTextTable>;
364
365        #[unsafe(method(startingRow))]
366        #[unsafe(method_family = none)]
367        pub fn startingRow(&self) -> NSInteger;
368
369        #[unsafe(method(rowSpan))]
370        #[unsafe(method_family = none)]
371        pub fn rowSpan(&self) -> NSInteger;
372
373        #[unsafe(method(startingColumn))]
374        #[unsafe(method_family = none)]
375        pub fn startingColumn(&self) -> NSInteger;
376
377        #[unsafe(method(columnSpan))]
378        #[unsafe(method_family = none)]
379        pub fn columnSpan(&self) -> NSInteger;
380    );
381}
382
383/// Methods declared on superclass `NSTextBlock`.
384impl NSTextTableBlock {
385    extern_methods!(
386        #[unsafe(method(init))]
387        #[unsafe(method_family = init)]
388        pub fn init(this: Allocated<Self>) -> Retained<Self>;
389    );
390}
391
392/// Methods declared on superclass `NSObject`.
393impl NSTextTableBlock {
394    extern_methods!(
395        #[unsafe(method(new))]
396        #[unsafe(method_family = new)]
397        pub fn new() -> Retained<Self>;
398    );
399}
400
401impl DefaultRetained for NSTextTableBlock {
402    #[inline]
403    fn default_retained() -> Retained<Self> {
404        Self::new()
405    }
406}
407
408extern_class!(
409    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstexttable?language=objc)
410    #[unsafe(super(NSTextBlock, NSObject))]
411    #[derive(Debug, PartialEq, Eq, Hash)]
412    pub struct NSTextTable;
413);
414
415extern_conformance!(
416    unsafe impl NSCoding for NSTextTable {}
417);
418
419extern_conformance!(
420    unsafe impl NSCopying for NSTextTable {}
421);
422
423unsafe impl CopyingHelper for NSTextTable {
424    type Result = Self;
425}
426
427extern_conformance!(
428    unsafe impl NSObjectProtocol for NSTextTable {}
429);
430
431extern_conformance!(
432    unsafe impl NSSecureCoding for NSTextTable {}
433);
434
435impl NSTextTable {
436    extern_methods!(
437        #[unsafe(method(numberOfColumns))]
438        #[unsafe(method_family = none)]
439        pub fn numberOfColumns(&self) -> NSUInteger;
440
441        /// Setter for [`numberOfColumns`][Self::numberOfColumns].
442        #[unsafe(method(setNumberOfColumns:))]
443        #[unsafe(method_family = none)]
444        pub fn setNumberOfColumns(&self, number_of_columns: NSUInteger);
445
446        #[unsafe(method(layoutAlgorithm))]
447        #[unsafe(method_family = none)]
448        pub fn layoutAlgorithm(&self) -> NSTextTableLayoutAlgorithm;
449
450        /// Setter for [`layoutAlgorithm`][Self::layoutAlgorithm].
451        #[unsafe(method(setLayoutAlgorithm:))]
452        #[unsafe(method_family = none)]
453        pub fn setLayoutAlgorithm(&self, layout_algorithm: NSTextTableLayoutAlgorithm);
454
455        #[unsafe(method(collapsesBorders))]
456        #[unsafe(method_family = none)]
457        pub fn collapsesBorders(&self) -> bool;
458
459        /// Setter for [`collapsesBorders`][Self::collapsesBorders].
460        #[unsafe(method(setCollapsesBorders:))]
461        #[unsafe(method_family = none)]
462        pub fn setCollapsesBorders(&self, collapses_borders: bool);
463
464        #[unsafe(method(hidesEmptyCells))]
465        #[unsafe(method_family = none)]
466        pub fn hidesEmptyCells(&self) -> bool;
467
468        /// Setter for [`hidesEmptyCells`][Self::hidesEmptyCells].
469        #[unsafe(method(setHidesEmptyCells:))]
470        #[unsafe(method_family = none)]
471        pub fn setHidesEmptyCells(&self, hides_empty_cells: bool);
472
473        #[cfg(feature = "NSTextContainer")]
474        #[unsafe(method(rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:))]
475        #[unsafe(method_family = none)]
476        pub fn rectForBlock_layoutAtPoint_inRect_textContainer_characterRange(
477            &self,
478            block: &NSTextTableBlock,
479            starting_point: NSPoint,
480            rect: NSRect,
481            text_container: &NSTextContainer,
482            char_range: NSRange,
483        ) -> NSRect;
484
485        #[cfg(feature = "NSTextContainer")]
486        #[unsafe(method(boundsRectForBlock:contentRect:inRect:textContainer:characterRange:))]
487        #[unsafe(method_family = none)]
488        pub fn boundsRectForBlock_contentRect_inRect_textContainer_characterRange(
489            &self,
490            block: &NSTextTableBlock,
491            content_rect: NSRect,
492            rect: NSRect,
493            text_container: &NSTextContainer,
494            char_range: NSRange,
495        ) -> NSRect;
496
497        #[cfg(all(
498            feature = "NSLayoutManager",
499            feature = "NSResponder",
500            feature = "NSView"
501        ))]
502        #[unsafe(method(drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:))]
503        #[unsafe(method_family = none)]
504        pub fn drawBackgroundForBlock_withFrame_inView_characterRange_layoutManager(
505            &self,
506            block: &NSTextTableBlock,
507            frame_rect: NSRect,
508            control_view: &NSView,
509            char_range: NSRange,
510            layout_manager: &NSLayoutManager,
511        );
512    );
513}
514
515/// Methods declared on superclass `NSTextBlock`.
516impl NSTextTable {
517    extern_methods!(
518        #[unsafe(method(init))]
519        #[unsafe(method_family = init)]
520        pub fn init(this: Allocated<Self>) -> Retained<Self>;
521    );
522}
523
524/// Methods declared on superclass `NSObject`.
525impl NSTextTable {
526    extern_methods!(
527        #[unsafe(method(new))]
528        #[unsafe(method_family = new)]
529        pub fn new() -> Retained<Self>;
530    );
531}
532
533impl DefaultRetained for NSTextTable {
534    #[inline]
535    fn default_retained() -> Retained<Self> {
536        Self::new()
537    }
538}