1use 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#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSGridCellPlacement(pub NSInteger);
17impl NSGridCellPlacement {
18 #[doc(alias = "NSGridCellPlacementInherited")]
19 pub const Inherited: Self = Self(0);
20 #[doc(alias = "NSGridCellPlacementNone")]
21 pub const None: Self = Self(1);
22 #[doc(alias = "NSGridCellPlacementLeading")]
23 pub const Leading: Self = Self(2);
24 #[doc(alias = "NSGridCellPlacementTop")]
25 pub const Top: Self = Self(NSGridCellPlacement::Leading.0);
26 #[doc(alias = "NSGridCellPlacementTrailing")]
27 pub const Trailing: Self = Self(3);
28 #[doc(alias = "NSGridCellPlacementBottom")]
29 pub const Bottom: Self = Self(NSGridCellPlacement::Trailing.0);
30 #[doc(alias = "NSGridCellPlacementCenter")]
31 pub const Center: Self = Self(4);
32 #[doc(alias = "NSGridCellPlacementFill")]
33 pub const Fill: Self = Self(5);
34}
35
36unsafe impl Encode for NSGridCellPlacement {
37 const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for NSGridCellPlacement {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44#[repr(transparent)]
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
48pub struct NSGridRowAlignment(pub NSInteger);
49impl NSGridRowAlignment {
50 #[doc(alias = "NSGridRowAlignmentInherited")]
51 pub const Inherited: Self = Self(0);
52 #[doc(alias = "NSGridRowAlignmentNone")]
53 pub const None: Self = Self(1);
54 #[doc(alias = "NSGridRowAlignmentFirstBaseline")]
55 pub const FirstBaseline: Self = Self(2);
56 #[doc(alias = "NSGridRowAlignmentLastBaseline")]
57 pub const LastBaseline: Self = Self(3);
58}
59
60unsafe impl Encode for NSGridRowAlignment {
61 const ENCODING: Encoding = NSInteger::ENCODING;
62}
63
64unsafe impl RefEncode for NSGridRowAlignment {
65 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
66}
67
68extern "C" {
69 #[cfg(feature = "objc2-core-foundation")]
71 pub static NSGridViewSizeForContent: CGFloat;
72}
73
74extern_class!(
75 #[unsafe(super(NSView, NSResponder, NSObject))]
77 #[derive(Debug, PartialEq, Eq, Hash)]
78 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
79 pub struct NSGridView;
80);
81
82#[cfg(all(
83 feature = "NSAccessibilityProtocols",
84 feature = "NSResponder",
85 feature = "NSView"
86))]
87extern_conformance!(
88 unsafe impl NSAccessibility for NSGridView {}
89);
90
91#[cfg(all(
92 feature = "NSAccessibilityProtocols",
93 feature = "NSResponder",
94 feature = "NSView"
95))]
96extern_conformance!(
97 unsafe impl NSAccessibilityElementProtocol for NSGridView {}
98);
99
100#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
101extern_conformance!(
102 unsafe impl NSAnimatablePropertyContainer for NSGridView {}
103);
104
105#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
106extern_conformance!(
107 unsafe impl NSAppearanceCustomization for NSGridView {}
108);
109
110#[cfg(all(feature = "NSResponder", feature = "NSView"))]
111extern_conformance!(
112 unsafe impl NSCoding for NSGridView {}
113);
114
115#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
116extern_conformance!(
117 unsafe impl NSDraggingDestination for NSGridView {}
118);
119
120#[cfg(all(feature = "NSResponder", feature = "NSView"))]
121extern_conformance!(
122 unsafe impl NSObjectProtocol for NSGridView {}
123);
124
125#[cfg(all(
126 feature = "NSResponder",
127 feature = "NSUserInterfaceItemIdentification",
128 feature = "NSView"
129))]
130extern_conformance!(
131 unsafe impl NSUserInterfaceItemIdentification for NSGridView {}
132);
133
134#[cfg(all(feature = "NSResponder", feature = "NSView"))]
135impl NSGridView {
136 extern_methods!(
137 #[unsafe(method(initWithFrame:))]
138 #[unsafe(method_family = init)]
139 pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
140
141 #[unsafe(method(initWithCoder:))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn initWithCoder(
147 this: Allocated<Self>,
148 coder: &NSCoder,
149 ) -> Option<Retained<Self>>;
150
151 #[unsafe(method(gridViewWithNumberOfColumns:rows:))]
152 #[unsafe(method_family = none)]
153 pub fn gridViewWithNumberOfColumns_rows(
154 column_count: NSInteger,
155 row_count: NSInteger,
156 mtm: MainThreadMarker,
157 ) -> Retained<Self>;
158
159 #[unsafe(method(gridViewWithViews:))]
160 #[unsafe(method_family = none)]
161 pub fn gridViewWithViews(
162 rows: &NSArray<NSArray<NSView>>,
163 mtm: MainThreadMarker,
164 ) -> Retained<Self>;
165
166 #[unsafe(method(numberOfRows))]
167 #[unsafe(method_family = none)]
168 pub fn numberOfRows(&self) -> NSInteger;
169
170 #[unsafe(method(numberOfColumns))]
171 #[unsafe(method_family = none)]
172 pub fn numberOfColumns(&self) -> NSInteger;
173
174 #[unsafe(method(rowAtIndex:))]
175 #[unsafe(method_family = none)]
176 pub fn rowAtIndex(&self, index: NSInteger) -> Retained<NSGridRow>;
177
178 #[unsafe(method(indexOfRow:))]
179 #[unsafe(method_family = none)]
180 pub fn indexOfRow(&self, row: &NSGridRow) -> NSInteger;
181
182 #[unsafe(method(columnAtIndex:))]
183 #[unsafe(method_family = none)]
184 pub fn columnAtIndex(&self, index: NSInteger) -> Retained<NSGridColumn>;
185
186 #[unsafe(method(indexOfColumn:))]
187 #[unsafe(method_family = none)]
188 pub fn indexOfColumn(&self, column: &NSGridColumn) -> NSInteger;
189
190 #[unsafe(method(cellAtColumnIndex:rowIndex:))]
191 #[unsafe(method_family = none)]
192 pub fn cellAtColumnIndex_rowIndex(
193 &self,
194 column_index: NSInteger,
195 row_index: NSInteger,
196 ) -> Retained<NSGridCell>;
197
198 #[unsafe(method(cellForView:))]
199 #[unsafe(method_family = none)]
200 pub fn cellForView(&self, view: &NSView) -> Option<Retained<NSGridCell>>;
201
202 #[unsafe(method(addRowWithViews:))]
203 #[unsafe(method_family = none)]
204 pub fn addRowWithViews(&self, views: &NSArray<NSView>) -> Retained<NSGridRow>;
205
206 #[unsafe(method(insertRowAtIndex:withViews:))]
207 #[unsafe(method_family = none)]
208 pub fn insertRowAtIndex_withViews(
209 &self,
210 index: NSInteger,
211 views: &NSArray<NSView>,
212 ) -> Retained<NSGridRow>;
213
214 #[unsafe(method(moveRowAtIndex:toIndex:))]
215 #[unsafe(method_family = none)]
216 pub fn moveRowAtIndex_toIndex(&self, from_index: NSInteger, to_index: NSInteger);
217
218 #[unsafe(method(removeRowAtIndex:))]
219 #[unsafe(method_family = none)]
220 pub fn removeRowAtIndex(&self, index: NSInteger);
221
222 #[unsafe(method(addColumnWithViews:))]
223 #[unsafe(method_family = none)]
224 pub fn addColumnWithViews(&self, views: &NSArray<NSView>) -> Retained<NSGridColumn>;
225
226 #[unsafe(method(insertColumnAtIndex:withViews:))]
227 #[unsafe(method_family = none)]
228 pub fn insertColumnAtIndex_withViews(
229 &self,
230 index: NSInteger,
231 views: &NSArray<NSView>,
232 ) -> Retained<NSGridColumn>;
233
234 #[unsafe(method(moveColumnAtIndex:toIndex:))]
235 #[unsafe(method_family = none)]
236 pub fn moveColumnAtIndex_toIndex(&self, from_index: NSInteger, to_index: NSInteger);
237
238 #[unsafe(method(removeColumnAtIndex:))]
239 #[unsafe(method_family = none)]
240 pub fn removeColumnAtIndex(&self, index: NSInteger);
241
242 #[unsafe(method(xPlacement))]
243 #[unsafe(method_family = none)]
244 pub fn xPlacement(&self) -> NSGridCellPlacement;
245
246 #[unsafe(method(setXPlacement:))]
248 #[unsafe(method_family = none)]
249 pub fn setXPlacement(&self, x_placement: NSGridCellPlacement);
250
251 #[unsafe(method(yPlacement))]
252 #[unsafe(method_family = none)]
253 pub fn yPlacement(&self) -> NSGridCellPlacement;
254
255 #[unsafe(method(setYPlacement:))]
257 #[unsafe(method_family = none)]
258 pub fn setYPlacement(&self, y_placement: NSGridCellPlacement);
259
260 #[unsafe(method(rowAlignment))]
261 #[unsafe(method_family = none)]
262 pub fn rowAlignment(&self) -> NSGridRowAlignment;
263
264 #[unsafe(method(setRowAlignment:))]
266 #[unsafe(method_family = none)]
267 pub fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
268
269 #[cfg(feature = "objc2-core-foundation")]
270 #[unsafe(method(rowSpacing))]
271 #[unsafe(method_family = none)]
272 pub fn rowSpacing(&self) -> CGFloat;
273
274 #[cfg(feature = "objc2-core-foundation")]
275 #[unsafe(method(setRowSpacing:))]
277 #[unsafe(method_family = none)]
278 pub fn setRowSpacing(&self, row_spacing: CGFloat);
279
280 #[cfg(feature = "objc2-core-foundation")]
281 #[unsafe(method(columnSpacing))]
282 #[unsafe(method_family = none)]
283 pub fn columnSpacing(&self) -> CGFloat;
284
285 #[cfg(feature = "objc2-core-foundation")]
286 #[unsafe(method(setColumnSpacing:))]
288 #[unsafe(method_family = none)]
289 pub fn setColumnSpacing(&self, column_spacing: CGFloat);
290
291 #[unsafe(method(mergeCellsInHorizontalRange:verticalRange:))]
292 #[unsafe(method_family = none)]
293 pub fn mergeCellsInHorizontalRange_verticalRange(&self, h_range: NSRange, v_range: NSRange);
294 );
295}
296
297#[cfg(all(feature = "NSResponder", feature = "NSView"))]
299impl NSGridView {
300 extern_methods!(
301 #[unsafe(method(init))]
302 #[unsafe(method_family = init)]
303 pub fn init(this: Allocated<Self>) -> Retained<Self>;
304 );
305}
306
307#[cfg(all(feature = "NSResponder", feature = "NSView"))]
309impl NSGridView {
310 extern_methods!(
311 #[unsafe(method(new))]
312 #[unsafe(method_family = new)]
313 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
314 );
315}
316
317extern_class!(
318 #[unsafe(super(NSObject))]
320 #[thread_kind = MainThreadOnly]
321 #[derive(Debug, PartialEq, Eq, Hash)]
322 pub struct NSGridRow;
323);
324
325extern_conformance!(
326 unsafe impl NSCoding for NSGridRow {}
327);
328
329extern_conformance!(
330 unsafe impl NSObjectProtocol for NSGridRow {}
331);
332
333impl NSGridRow {
334 extern_methods!(
335 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
336 #[unsafe(method(gridView))]
337 #[unsafe(method_family = none)]
338 pub fn gridView(&self) -> Option<Retained<NSGridView>>;
339
340 #[unsafe(method(numberOfCells))]
341 #[unsafe(method_family = none)]
342 pub fn numberOfCells(&self) -> NSInteger;
343
344 #[unsafe(method(cellAtIndex:))]
345 #[unsafe(method_family = none)]
346 pub fn cellAtIndex(&self, index: NSInteger) -> Retained<NSGridCell>;
347
348 #[unsafe(method(yPlacement))]
349 #[unsafe(method_family = none)]
350 pub fn yPlacement(&self) -> NSGridCellPlacement;
351
352 #[unsafe(method(setYPlacement:))]
354 #[unsafe(method_family = none)]
355 pub fn setYPlacement(&self, y_placement: NSGridCellPlacement);
356
357 #[unsafe(method(rowAlignment))]
358 #[unsafe(method_family = none)]
359 pub fn rowAlignment(&self) -> NSGridRowAlignment;
360
361 #[unsafe(method(setRowAlignment:))]
363 #[unsafe(method_family = none)]
364 pub fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
365
366 #[cfg(feature = "objc2-core-foundation")]
367 #[unsafe(method(height))]
368 #[unsafe(method_family = none)]
369 pub fn height(&self) -> CGFloat;
370
371 #[cfg(feature = "objc2-core-foundation")]
372 #[unsafe(method(setHeight:))]
374 #[unsafe(method_family = none)]
375 pub fn setHeight(&self, height: CGFloat);
376
377 #[cfg(feature = "objc2-core-foundation")]
378 #[unsafe(method(topPadding))]
379 #[unsafe(method_family = none)]
380 pub fn topPadding(&self) -> CGFloat;
381
382 #[cfg(feature = "objc2-core-foundation")]
383 #[unsafe(method(setTopPadding:))]
385 #[unsafe(method_family = none)]
386 pub fn setTopPadding(&self, top_padding: CGFloat);
387
388 #[cfg(feature = "objc2-core-foundation")]
389 #[unsafe(method(bottomPadding))]
390 #[unsafe(method_family = none)]
391 pub fn bottomPadding(&self) -> CGFloat;
392
393 #[cfg(feature = "objc2-core-foundation")]
394 #[unsafe(method(setBottomPadding:))]
396 #[unsafe(method_family = none)]
397 pub fn setBottomPadding(&self, bottom_padding: CGFloat);
398
399 #[unsafe(method(isHidden))]
400 #[unsafe(method_family = none)]
401 pub fn isHidden(&self) -> bool;
402
403 #[unsafe(method(setHidden:))]
405 #[unsafe(method_family = none)]
406 pub fn setHidden(&self, hidden: bool);
407
408 #[unsafe(method(mergeCellsInRange:))]
409 #[unsafe(method_family = none)]
410 pub fn mergeCellsInRange(&self, range: NSRange);
411 );
412}
413
414impl NSGridRow {
416 extern_methods!(
417 #[unsafe(method(init))]
418 #[unsafe(method_family = init)]
419 pub fn init(this: Allocated<Self>) -> Retained<Self>;
420
421 #[unsafe(method(new))]
422 #[unsafe(method_family = new)]
423 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
424 );
425}
426
427extern_class!(
428 #[unsafe(super(NSObject))]
430 #[thread_kind = MainThreadOnly]
431 #[derive(Debug, PartialEq, Eq, Hash)]
432 pub struct NSGridColumn;
433);
434
435extern_conformance!(
436 unsafe impl NSCoding for NSGridColumn {}
437);
438
439extern_conformance!(
440 unsafe impl NSObjectProtocol for NSGridColumn {}
441);
442
443impl NSGridColumn {
444 extern_methods!(
445 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
446 #[unsafe(method(gridView))]
447 #[unsafe(method_family = none)]
448 pub fn gridView(&self) -> Option<Retained<NSGridView>>;
449
450 #[unsafe(method(numberOfCells))]
451 #[unsafe(method_family = none)]
452 pub fn numberOfCells(&self) -> NSInteger;
453
454 #[unsafe(method(cellAtIndex:))]
455 #[unsafe(method_family = none)]
456 pub fn cellAtIndex(&self, index: NSInteger) -> Retained<NSGridCell>;
457
458 #[unsafe(method(xPlacement))]
459 #[unsafe(method_family = none)]
460 pub fn xPlacement(&self) -> NSGridCellPlacement;
461
462 #[unsafe(method(setXPlacement:))]
464 #[unsafe(method_family = none)]
465 pub fn setXPlacement(&self, x_placement: NSGridCellPlacement);
466
467 #[cfg(feature = "objc2-core-foundation")]
468 #[unsafe(method(width))]
469 #[unsafe(method_family = none)]
470 pub fn width(&self) -> CGFloat;
471
472 #[cfg(feature = "objc2-core-foundation")]
473 #[unsafe(method(setWidth:))]
475 #[unsafe(method_family = none)]
476 pub fn setWidth(&self, width: CGFloat);
477
478 #[cfg(feature = "objc2-core-foundation")]
479 #[unsafe(method(leadingPadding))]
480 #[unsafe(method_family = none)]
481 pub fn leadingPadding(&self) -> CGFloat;
482
483 #[cfg(feature = "objc2-core-foundation")]
484 #[unsafe(method(setLeadingPadding:))]
486 #[unsafe(method_family = none)]
487 pub fn setLeadingPadding(&self, leading_padding: CGFloat);
488
489 #[cfg(feature = "objc2-core-foundation")]
490 #[unsafe(method(trailingPadding))]
491 #[unsafe(method_family = none)]
492 pub fn trailingPadding(&self) -> CGFloat;
493
494 #[cfg(feature = "objc2-core-foundation")]
495 #[unsafe(method(setTrailingPadding:))]
497 #[unsafe(method_family = none)]
498 pub fn setTrailingPadding(&self, trailing_padding: CGFloat);
499
500 #[unsafe(method(isHidden))]
501 #[unsafe(method_family = none)]
502 pub fn isHidden(&self) -> bool;
503
504 #[unsafe(method(setHidden:))]
506 #[unsafe(method_family = none)]
507 pub fn setHidden(&self, hidden: bool);
508
509 #[unsafe(method(mergeCellsInRange:))]
510 #[unsafe(method_family = none)]
511 pub fn mergeCellsInRange(&self, range: NSRange);
512 );
513}
514
515impl NSGridColumn {
517 extern_methods!(
518 #[unsafe(method(init))]
519 #[unsafe(method_family = init)]
520 pub fn init(this: Allocated<Self>) -> Retained<Self>;
521
522 #[unsafe(method(new))]
523 #[unsafe(method_family = new)]
524 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
525 );
526}
527
528extern_class!(
529 #[unsafe(super(NSObject))]
531 #[thread_kind = MainThreadOnly]
532 #[derive(Debug, PartialEq, Eq, Hash)]
533 pub struct NSGridCell;
534);
535
536extern_conformance!(
537 unsafe impl NSCoding for NSGridCell {}
538);
539
540extern_conformance!(
541 unsafe impl NSObjectProtocol for NSGridCell {}
542);
543
544impl NSGridCell {
545 extern_methods!(
546 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
547 #[unsafe(method(contentView))]
548 #[unsafe(method_family = none)]
549 pub fn contentView(&self) -> Option<Retained<NSView>>;
550
551 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
552 #[unsafe(method(setContentView:))]
554 #[unsafe(method_family = none)]
555 pub fn setContentView(&self, content_view: Option<&NSView>);
556
557 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
558 #[unsafe(method(emptyContentView))]
559 #[unsafe(method_family = none)]
560 pub fn emptyContentView(mtm: MainThreadMarker) -> Retained<NSView>;
561
562 #[unsafe(method(row))]
563 #[unsafe(method_family = none)]
564 pub fn row(&self) -> Option<Retained<NSGridRow>>;
565
566 #[unsafe(method(column))]
567 #[unsafe(method_family = none)]
568 pub fn column(&self) -> Option<Retained<NSGridColumn>>;
569
570 #[unsafe(method(xPlacement))]
571 #[unsafe(method_family = none)]
572 pub fn xPlacement(&self) -> NSGridCellPlacement;
573
574 #[unsafe(method(setXPlacement:))]
576 #[unsafe(method_family = none)]
577 pub fn setXPlacement(&self, x_placement: NSGridCellPlacement);
578
579 #[unsafe(method(yPlacement))]
580 #[unsafe(method_family = none)]
581 pub fn yPlacement(&self) -> NSGridCellPlacement;
582
583 #[unsafe(method(setYPlacement:))]
585 #[unsafe(method_family = none)]
586 pub fn setYPlacement(&self, y_placement: NSGridCellPlacement);
587
588 #[unsafe(method(rowAlignment))]
589 #[unsafe(method_family = none)]
590 pub fn rowAlignment(&self) -> NSGridRowAlignment;
591
592 #[unsafe(method(setRowAlignment:))]
594 #[unsafe(method_family = none)]
595 pub fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
596
597 #[cfg(feature = "NSLayoutConstraint")]
598 #[unsafe(method(customPlacementConstraints))]
599 #[unsafe(method_family = none)]
600 pub fn customPlacementConstraints(&self) -> Retained<NSArray<NSLayoutConstraint>>;
601
602 #[cfg(feature = "NSLayoutConstraint")]
603 #[unsafe(method(setCustomPlacementConstraints:))]
607 #[unsafe(method_family = none)]
608 pub fn setCustomPlacementConstraints(
609 &self,
610 custom_placement_constraints: &NSArray<NSLayoutConstraint>,
611 );
612 );
613}
614
615impl NSGridCell {
617 extern_methods!(
618 #[unsafe(method(init))]
619 #[unsafe(method_family = init)]
620 pub fn init(this: Allocated<Self>) -> Retained<Self>;
621
622 #[unsafe(method(new))]
623 #[unsafe(method_family = new)]
624 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
625 );
626}