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 unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
140
141 #[unsafe(method(initWithCoder:))]
142 #[unsafe(method_family = init)]
143 pub unsafe fn initWithCoder(
144 this: Allocated<Self>,
145 coder: &NSCoder,
146 ) -> Option<Retained<Self>>;
147
148 #[unsafe(method(gridViewWithNumberOfColumns:rows:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn gridViewWithNumberOfColumns_rows(
151 column_count: NSInteger,
152 row_count: NSInteger,
153 mtm: MainThreadMarker,
154 ) -> Retained<Self>;
155
156 #[unsafe(method(gridViewWithViews:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn gridViewWithViews(
159 rows: &NSArray<NSArray<NSView>>,
160 mtm: MainThreadMarker,
161 ) -> Retained<Self>;
162
163 #[unsafe(method(numberOfRows))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn numberOfRows(&self) -> NSInteger;
166
167 #[unsafe(method(numberOfColumns))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn numberOfColumns(&self) -> NSInteger;
170
171 #[unsafe(method(rowAtIndex:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn rowAtIndex(&self, index: NSInteger) -> Retained<NSGridRow>;
174
175 #[unsafe(method(indexOfRow:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn indexOfRow(&self, row: &NSGridRow) -> NSInteger;
178
179 #[unsafe(method(columnAtIndex:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn columnAtIndex(&self, index: NSInteger) -> Retained<NSGridColumn>;
182
183 #[unsafe(method(indexOfColumn:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn indexOfColumn(&self, column: &NSGridColumn) -> NSInteger;
186
187 #[unsafe(method(cellAtColumnIndex:rowIndex:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn cellAtColumnIndex_rowIndex(
190 &self,
191 column_index: NSInteger,
192 row_index: NSInteger,
193 ) -> Retained<NSGridCell>;
194
195 #[unsafe(method(cellForView:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn cellForView(&self, view: &NSView) -> Option<Retained<NSGridCell>>;
198
199 #[unsafe(method(addRowWithViews:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn addRowWithViews(&self, views: &NSArray<NSView>) -> Retained<NSGridRow>;
202
203 #[unsafe(method(insertRowAtIndex:withViews:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn insertRowAtIndex_withViews(
206 &self,
207 index: NSInteger,
208 views: &NSArray<NSView>,
209 ) -> Retained<NSGridRow>;
210
211 #[unsafe(method(moveRowAtIndex:toIndex:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn moveRowAtIndex_toIndex(&self, from_index: NSInteger, to_index: NSInteger);
214
215 #[unsafe(method(removeRowAtIndex:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn removeRowAtIndex(&self, index: NSInteger);
218
219 #[unsafe(method(addColumnWithViews:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn addColumnWithViews(&self, views: &NSArray<NSView>) -> Retained<NSGridColumn>;
222
223 #[unsafe(method(insertColumnAtIndex:withViews:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn insertColumnAtIndex_withViews(
226 &self,
227 index: NSInteger,
228 views: &NSArray<NSView>,
229 ) -> Retained<NSGridColumn>;
230
231 #[unsafe(method(moveColumnAtIndex:toIndex:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn moveColumnAtIndex_toIndex(&self, from_index: NSInteger, to_index: NSInteger);
234
235 #[unsafe(method(removeColumnAtIndex:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn removeColumnAtIndex(&self, index: NSInteger);
238
239 #[unsafe(method(xPlacement))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn xPlacement(&self) -> NSGridCellPlacement;
242
243 #[unsafe(method(setXPlacement:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn setXPlacement(&self, x_placement: NSGridCellPlacement);
247
248 #[unsafe(method(yPlacement))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn yPlacement(&self) -> NSGridCellPlacement;
251
252 #[unsafe(method(setYPlacement:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn setYPlacement(&self, y_placement: NSGridCellPlacement);
256
257 #[unsafe(method(rowAlignment))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn rowAlignment(&self) -> NSGridRowAlignment;
260
261 #[unsafe(method(setRowAlignment:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
265
266 #[cfg(feature = "objc2-core-foundation")]
267 #[unsafe(method(rowSpacing))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn rowSpacing(&self) -> CGFloat;
270
271 #[cfg(feature = "objc2-core-foundation")]
272 #[unsafe(method(setRowSpacing:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setRowSpacing(&self, row_spacing: CGFloat);
276
277 #[cfg(feature = "objc2-core-foundation")]
278 #[unsafe(method(columnSpacing))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn columnSpacing(&self) -> CGFloat;
281
282 #[cfg(feature = "objc2-core-foundation")]
283 #[unsafe(method(setColumnSpacing:))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn setColumnSpacing(&self, column_spacing: CGFloat);
287
288 #[unsafe(method(mergeCellsInHorizontalRange:verticalRange:))]
289 #[unsafe(method_family = none)]
290 pub unsafe fn mergeCellsInHorizontalRange_verticalRange(
291 &self,
292 h_range: NSRange,
293 v_range: NSRange,
294 );
295 );
296}
297
298#[cfg(all(feature = "NSResponder", feature = "NSView"))]
300impl NSGridView {
301 extern_methods!(
302 #[unsafe(method(init))]
303 #[unsafe(method_family = init)]
304 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
305 );
306}
307
308#[cfg(all(feature = "NSResponder", feature = "NSView"))]
310impl NSGridView {
311 extern_methods!(
312 #[unsafe(method(new))]
313 #[unsafe(method_family = new)]
314 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
315 );
316}
317
318extern_class!(
319 #[unsafe(super(NSObject))]
321 #[thread_kind = MainThreadOnly]
322 #[derive(Debug, PartialEq, Eq, Hash)]
323 pub struct NSGridRow;
324);
325
326extern_conformance!(
327 unsafe impl NSCoding for NSGridRow {}
328);
329
330extern_conformance!(
331 unsafe impl NSObjectProtocol for NSGridRow {}
332);
333
334impl NSGridRow {
335 extern_methods!(
336 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
337 #[unsafe(method(gridView))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn gridView(&self) -> Option<Retained<NSGridView>>;
340
341 #[unsafe(method(numberOfCells))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn numberOfCells(&self) -> NSInteger;
344
345 #[unsafe(method(cellAtIndex:))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn cellAtIndex(&self, index: NSInteger) -> Retained<NSGridCell>;
348
349 #[unsafe(method(yPlacement))]
350 #[unsafe(method_family = none)]
351 pub unsafe fn yPlacement(&self) -> NSGridCellPlacement;
352
353 #[unsafe(method(setYPlacement:))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn setYPlacement(&self, y_placement: NSGridCellPlacement);
357
358 #[unsafe(method(rowAlignment))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn rowAlignment(&self) -> NSGridRowAlignment;
361
362 #[unsafe(method(setRowAlignment:))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
366
367 #[cfg(feature = "objc2-core-foundation")]
368 #[unsafe(method(height))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn height(&self) -> CGFloat;
371
372 #[cfg(feature = "objc2-core-foundation")]
373 #[unsafe(method(setHeight:))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn setHeight(&self, height: CGFloat);
377
378 #[cfg(feature = "objc2-core-foundation")]
379 #[unsafe(method(topPadding))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn topPadding(&self) -> CGFloat;
382
383 #[cfg(feature = "objc2-core-foundation")]
384 #[unsafe(method(setTopPadding:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn setTopPadding(&self, top_padding: CGFloat);
388
389 #[cfg(feature = "objc2-core-foundation")]
390 #[unsafe(method(bottomPadding))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn bottomPadding(&self) -> CGFloat;
393
394 #[cfg(feature = "objc2-core-foundation")]
395 #[unsafe(method(setBottomPadding:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn setBottomPadding(&self, bottom_padding: CGFloat);
399
400 #[unsafe(method(isHidden))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn isHidden(&self) -> bool;
403
404 #[unsafe(method(setHidden:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn setHidden(&self, hidden: bool);
408
409 #[unsafe(method(mergeCellsInRange:))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn mergeCellsInRange(&self, range: NSRange);
412 );
413}
414
415impl NSGridRow {
417 extern_methods!(
418 #[unsafe(method(init))]
419 #[unsafe(method_family = init)]
420 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
421
422 #[unsafe(method(new))]
423 #[unsafe(method_family = new)]
424 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
425 );
426}
427
428extern_class!(
429 #[unsafe(super(NSObject))]
431 #[thread_kind = MainThreadOnly]
432 #[derive(Debug, PartialEq, Eq, Hash)]
433 pub struct NSGridColumn;
434);
435
436extern_conformance!(
437 unsafe impl NSCoding for NSGridColumn {}
438);
439
440extern_conformance!(
441 unsafe impl NSObjectProtocol for NSGridColumn {}
442);
443
444impl NSGridColumn {
445 extern_methods!(
446 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
447 #[unsafe(method(gridView))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn gridView(&self) -> Option<Retained<NSGridView>>;
450
451 #[unsafe(method(numberOfCells))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn numberOfCells(&self) -> NSInteger;
454
455 #[unsafe(method(cellAtIndex:))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn cellAtIndex(&self, index: NSInteger) -> Retained<NSGridCell>;
458
459 #[unsafe(method(xPlacement))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn xPlacement(&self) -> NSGridCellPlacement;
462
463 #[unsafe(method(setXPlacement:))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn setXPlacement(&self, x_placement: NSGridCellPlacement);
467
468 #[cfg(feature = "objc2-core-foundation")]
469 #[unsafe(method(width))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn width(&self) -> CGFloat;
472
473 #[cfg(feature = "objc2-core-foundation")]
474 #[unsafe(method(setWidth:))]
476 #[unsafe(method_family = none)]
477 pub unsafe fn setWidth(&self, width: CGFloat);
478
479 #[cfg(feature = "objc2-core-foundation")]
480 #[unsafe(method(leadingPadding))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn leadingPadding(&self) -> CGFloat;
483
484 #[cfg(feature = "objc2-core-foundation")]
485 #[unsafe(method(setLeadingPadding:))]
487 #[unsafe(method_family = none)]
488 pub unsafe fn setLeadingPadding(&self, leading_padding: CGFloat);
489
490 #[cfg(feature = "objc2-core-foundation")]
491 #[unsafe(method(trailingPadding))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn trailingPadding(&self) -> CGFloat;
494
495 #[cfg(feature = "objc2-core-foundation")]
496 #[unsafe(method(setTrailingPadding:))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn setTrailingPadding(&self, trailing_padding: CGFloat);
500
501 #[unsafe(method(isHidden))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn isHidden(&self) -> bool;
504
505 #[unsafe(method(setHidden:))]
507 #[unsafe(method_family = none)]
508 pub unsafe fn setHidden(&self, hidden: bool);
509
510 #[unsafe(method(mergeCellsInRange:))]
511 #[unsafe(method_family = none)]
512 pub unsafe fn mergeCellsInRange(&self, range: NSRange);
513 );
514}
515
516impl NSGridColumn {
518 extern_methods!(
519 #[unsafe(method(init))]
520 #[unsafe(method_family = init)]
521 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
522
523 #[unsafe(method(new))]
524 #[unsafe(method_family = new)]
525 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
526 );
527}
528
529extern_class!(
530 #[unsafe(super(NSObject))]
532 #[thread_kind = MainThreadOnly]
533 #[derive(Debug, PartialEq, Eq, Hash)]
534 pub struct NSGridCell;
535);
536
537extern_conformance!(
538 unsafe impl NSCoding for NSGridCell {}
539);
540
541extern_conformance!(
542 unsafe impl NSObjectProtocol for NSGridCell {}
543);
544
545impl NSGridCell {
546 extern_methods!(
547 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
548 #[unsafe(method(contentView))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
551
552 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
553 #[unsafe(method(setContentView:))]
555 #[unsafe(method_family = none)]
556 pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
557
558 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
559 #[unsafe(method(emptyContentView))]
560 #[unsafe(method_family = none)]
561 pub unsafe fn emptyContentView(mtm: MainThreadMarker) -> Retained<NSView>;
562
563 #[unsafe(method(row))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn row(&self) -> Option<Retained<NSGridRow>>;
566
567 #[unsafe(method(column))]
568 #[unsafe(method_family = none)]
569 pub unsafe fn column(&self) -> Option<Retained<NSGridColumn>>;
570
571 #[unsafe(method(xPlacement))]
572 #[unsafe(method_family = none)]
573 pub unsafe fn xPlacement(&self) -> NSGridCellPlacement;
574
575 #[unsafe(method(setXPlacement:))]
577 #[unsafe(method_family = none)]
578 pub unsafe fn setXPlacement(&self, x_placement: NSGridCellPlacement);
579
580 #[unsafe(method(yPlacement))]
581 #[unsafe(method_family = none)]
582 pub unsafe fn yPlacement(&self) -> NSGridCellPlacement;
583
584 #[unsafe(method(setYPlacement:))]
586 #[unsafe(method_family = none)]
587 pub unsafe fn setYPlacement(&self, y_placement: NSGridCellPlacement);
588
589 #[unsafe(method(rowAlignment))]
590 #[unsafe(method_family = none)]
591 pub unsafe fn rowAlignment(&self) -> NSGridRowAlignment;
592
593 #[unsafe(method(setRowAlignment:))]
595 #[unsafe(method_family = none)]
596 pub unsafe fn setRowAlignment(&self, row_alignment: NSGridRowAlignment);
597
598 #[cfg(feature = "NSLayoutConstraint")]
599 #[unsafe(method(customPlacementConstraints))]
600 #[unsafe(method_family = none)]
601 pub unsafe fn customPlacementConstraints(&self) -> Retained<NSArray<NSLayoutConstraint>>;
602
603 #[cfg(feature = "NSLayoutConstraint")]
604 #[unsafe(method(setCustomPlacementConstraints:))]
606 #[unsafe(method_family = none)]
607 pub unsafe fn setCustomPlacementConstraints(
608 &self,
609 custom_placement_constraints: &NSArray<NSLayoutConstraint>,
610 );
611 );
612}
613
614impl NSGridCell {
616 extern_methods!(
617 #[unsafe(method(init))]
618 #[unsafe(method_family = init)]
619 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
620
621 #[unsafe(method(new))]
622 #[unsafe(method_family = new)]
623 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
624 );
625}