1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_enum!(
    #[underlying(NSUInteger)]
    pub enum NSTextBlockValueType {
        NSTextBlockAbsoluteValueType = 0,
        NSTextBlockPercentageValueType = 1,
    }
);

ns_enum!(
    #[underlying(NSUInteger)]
    pub enum NSTextBlockDimension {
        NSTextBlockWidth = 0,
        NSTextBlockMinimumWidth = 1,
        NSTextBlockMaximumWidth = 2,
        NSTextBlockHeight = 4,
        NSTextBlockMinimumHeight = 5,
        NSTextBlockMaximumHeight = 6,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSTextBlockLayer {
        NSTextBlockPadding = -1,
        NSTextBlockBorder = 0,
        NSTextBlockMargin = 1,
    }
);

ns_enum!(
    #[underlying(NSUInteger)]
    pub enum NSTextBlockVerticalAlignment {
        NSTextBlockTopAlignment = 0,
        NSTextBlockMiddleAlignment = 1,
        NSTextBlockBottomAlignment = 2,
        NSTextBlockBaselineAlignment = 3,
    }
);

ns_enum!(
    #[underlying(NSUInteger)]
    pub enum NSTextTableLayoutAlgorithm {
        NSTextTableAutomaticLayoutAlgorithm = 0,
        NSTextTableFixedLayoutAlgorithm = 1,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSTextBlock")]
    pub struct NSTextBlock;

    #[cfg(feature = "AppKit_NSTextBlock")]
    unsafe impl ClassType for NSTextBlock {
        type Super = NSObject;
    }
);

#[cfg(feature = "AppKit_NSTextBlock")]
unsafe impl NSCoding for NSTextBlock {}

#[cfg(feature = "AppKit_NSTextBlock")]
unsafe impl NSObjectProtocol for NSTextBlock {}

#[cfg(feature = "AppKit_NSTextBlock")]
unsafe impl NSSecureCoding for NSTextBlock {}

extern_methods!(
    #[cfg(feature = "AppKit_NSTextBlock")]
    unsafe impl NSTextBlock {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Option<Allocated<Self>>) -> Id<Self, Shared>;

        #[method(setValue:type:forDimension:)]
        pub unsafe fn setValue_type_forDimension(
            &self,
            val: CGFloat,
            r#type: NSTextBlockValueType,
            dimension: NSTextBlockDimension,
        );

        #[method(valueForDimension:)]
        pub unsafe fn valueForDimension(&self, dimension: NSTextBlockDimension) -> CGFloat;

        #[method(valueTypeForDimension:)]
        pub unsafe fn valueTypeForDimension(
            &self,
            dimension: NSTextBlockDimension,
        ) -> NSTextBlockValueType;

        #[method(setContentWidth:type:)]
        pub unsafe fn setContentWidth_type(&self, val: CGFloat, r#type: NSTextBlockValueType);

        #[method(contentWidth)]
        pub unsafe fn contentWidth(&self) -> CGFloat;

        #[method(contentWidthValueType)]
        pub unsafe fn contentWidthValueType(&self) -> NSTextBlockValueType;

        #[method(setWidth:type:forLayer:edge:)]
        pub unsafe fn setWidth_type_forLayer_edge(
            &self,
            val: CGFloat,
            r#type: NSTextBlockValueType,
            layer: NSTextBlockLayer,
            edge: NSRectEdge,
        );

        #[method(setWidth:type:forLayer:)]
        pub unsafe fn setWidth_type_forLayer(
            &self,
            val: CGFloat,
            r#type: NSTextBlockValueType,
            layer: NSTextBlockLayer,
        );

        #[method(widthForLayer:edge:)]
        pub unsafe fn widthForLayer_edge(
            &self,
            layer: NSTextBlockLayer,
            edge: NSRectEdge,
        ) -> CGFloat;

        #[method(widthValueTypeForLayer:edge:)]
        pub unsafe fn widthValueTypeForLayer_edge(
            &self,
            layer: NSTextBlockLayer,
            edge: NSRectEdge,
        ) -> NSTextBlockValueType;

        #[method(verticalAlignment)]
        pub unsafe fn verticalAlignment(&self) -> NSTextBlockVerticalAlignment;

        #[method(setVerticalAlignment:)]
        pub unsafe fn setVerticalAlignment(&self, vertical_alignment: NSTextBlockVerticalAlignment);

        #[cfg(feature = "AppKit_NSColor")]
        #[method_id(@__retain_semantics Other backgroundColor)]
        pub unsafe fn backgroundColor(&self) -> Option<Id<NSColor, Shared>>;

        #[cfg(feature = "AppKit_NSColor")]
        #[method(setBackgroundColor:)]
        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);

        #[cfg(feature = "AppKit_NSColor")]
        #[method(setBorderColor:forEdge:)]
        pub unsafe fn setBorderColor_forEdge(&self, color: Option<&NSColor>, edge: NSRectEdge);

        #[cfg(feature = "AppKit_NSColor")]
        #[method(setBorderColor:)]
        pub unsafe fn setBorderColor(&self, color: Option<&NSColor>);

        #[cfg(feature = "AppKit_NSColor")]
        #[method_id(@__retain_semantics Other borderColorForEdge:)]
        pub unsafe fn borderColorForEdge(&self, edge: NSRectEdge) -> Option<Id<NSColor, Shared>>;

        #[cfg(feature = "AppKit_NSTextContainer")]
        #[method(rectForLayoutAtPoint:inRect:textContainer:characterRange:)]
        pub unsafe fn rectForLayoutAtPoint_inRect_textContainer_characterRange(
            &self,
            starting_point: NSPoint,
            rect: NSRect,
            text_container: &NSTextContainer,
            char_range: NSRange,
        ) -> NSRect;

        #[cfg(feature = "AppKit_NSTextContainer")]
        #[method(boundsRectForContentRect:inRect:textContainer:characterRange:)]
        pub unsafe fn boundsRectForContentRect_inRect_textContainer_characterRange(
            &self,
            content_rect: NSRect,
            rect: NSRect,
            text_container: &NSTextContainer,
            char_range: NSRange,
        ) -> NSRect;

        #[cfg(all(feature = "AppKit_NSLayoutManager", feature = "AppKit_NSView"))]
        #[method(drawBackgroundWithFrame:inView:characterRange:layoutManager:)]
        pub unsafe fn drawBackgroundWithFrame_inView_characterRange_layoutManager(
            &self,
            frame_rect: NSRect,
            control_view: &NSView,
            char_range: NSRange,
            layout_manager: &NSLayoutManager,
        );
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSTextTableBlock")]
    pub struct NSTextTableBlock;

    #[cfg(feature = "AppKit_NSTextTableBlock")]
    unsafe impl ClassType for NSTextTableBlock {
        #[inherits(NSObject)]
        type Super = NSTextBlock;
    }
);

#[cfg(feature = "AppKit_NSTextTableBlock")]
unsafe impl NSCoding for NSTextTableBlock {}

#[cfg(feature = "AppKit_NSTextTableBlock")]
unsafe impl NSObjectProtocol for NSTextTableBlock {}

#[cfg(feature = "AppKit_NSTextTableBlock")]
unsafe impl NSSecureCoding for NSTextTableBlock {}

extern_methods!(
    #[cfg(feature = "AppKit_NSTextTableBlock")]
    unsafe impl NSTextTableBlock {
        #[cfg(feature = "AppKit_NSTextTable")]
        #[method_id(@__retain_semantics Init initWithTable:startingRow:rowSpan:startingColumn:columnSpan:)]
        pub unsafe fn initWithTable_startingRow_rowSpan_startingColumn_columnSpan(
            this: Option<Allocated<Self>>,
            table: &NSTextTable,
            row: NSInteger,
            row_span: NSInteger,
            col: NSInteger,
            col_span: NSInteger,
        ) -> Id<Self, Shared>;

        #[cfg(feature = "AppKit_NSTextTable")]
        #[method_id(@__retain_semantics Other table)]
        pub unsafe fn table(&self) -> Id<NSTextTable, Shared>;

        #[method(startingRow)]
        pub unsafe fn startingRow(&self) -> NSInteger;

        #[method(rowSpan)]
        pub unsafe fn rowSpan(&self) -> NSInteger;

        #[method(startingColumn)]
        pub unsafe fn startingColumn(&self) -> NSInteger;

        #[method(columnSpan)]
        pub unsafe fn columnSpan(&self) -> NSInteger;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSTextTable")]
    pub struct NSTextTable;

    #[cfg(feature = "AppKit_NSTextTable")]
    unsafe impl ClassType for NSTextTable {
        #[inherits(NSObject)]
        type Super = NSTextBlock;
    }
);

#[cfg(feature = "AppKit_NSTextTable")]
unsafe impl NSCoding for NSTextTable {}

#[cfg(feature = "AppKit_NSTextTable")]
unsafe impl NSObjectProtocol for NSTextTable {}

#[cfg(feature = "AppKit_NSTextTable")]
unsafe impl NSSecureCoding for NSTextTable {}

extern_methods!(
    #[cfg(feature = "AppKit_NSTextTable")]
    unsafe impl NSTextTable {
        #[method(numberOfColumns)]
        pub unsafe fn numberOfColumns(&self) -> NSUInteger;

        #[method(setNumberOfColumns:)]
        pub unsafe fn setNumberOfColumns(&self, number_of_columns: NSUInteger);

        #[method(layoutAlgorithm)]
        pub unsafe fn layoutAlgorithm(&self) -> NSTextTableLayoutAlgorithm;

        #[method(setLayoutAlgorithm:)]
        pub unsafe fn setLayoutAlgorithm(&self, layout_algorithm: NSTextTableLayoutAlgorithm);

        #[method(collapsesBorders)]
        pub unsafe fn collapsesBorders(&self) -> bool;

        #[method(setCollapsesBorders:)]
        pub unsafe fn setCollapsesBorders(&self, collapses_borders: bool);

        #[method(hidesEmptyCells)]
        pub unsafe fn hidesEmptyCells(&self) -> bool;

        #[method(setHidesEmptyCells:)]
        pub unsafe fn setHidesEmptyCells(&self, hides_empty_cells: bool);

        #[cfg(all(
            feature = "AppKit_NSTextContainer",
            feature = "AppKit_NSTextTableBlock"
        ))]
        #[method(rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:)]
        pub unsafe fn rectForBlock_layoutAtPoint_inRect_textContainer_characterRange(
            &self,
            block: &NSTextTableBlock,
            starting_point: NSPoint,
            rect: NSRect,
            text_container: &NSTextContainer,
            char_range: NSRange,
        ) -> NSRect;

        #[cfg(all(
            feature = "AppKit_NSTextContainer",
            feature = "AppKit_NSTextTableBlock"
        ))]
        #[method(boundsRectForBlock:contentRect:inRect:textContainer:characterRange:)]
        pub unsafe fn boundsRectForBlock_contentRect_inRect_textContainer_characterRange(
            &self,
            block: &NSTextTableBlock,
            content_rect: NSRect,
            rect: NSRect,
            text_container: &NSTextContainer,
            char_range: NSRange,
        ) -> NSRect;

        #[cfg(all(
            feature = "AppKit_NSLayoutManager",
            feature = "AppKit_NSTextTableBlock",
            feature = "AppKit_NSView"
        ))]
        #[method(drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:)]
        pub unsafe fn drawBackgroundForBlock_withFrame_inView_characterRange_layoutManager(
            &self,
            block: &NSTextTableBlock,
            frame_rect: NSRect,
            control_view: &NSView,
            char_range: NSRange,
            layout_manager: &NSLayoutManager,
        );
    }
);