objc2_app_kit/generated/
NSSplitView.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/nssplitviewautosavename?language=objc)
13pub type NSSplitViewAutosaveName = NSString;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewdividerstyle?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct NSSplitViewDividerStyle(pub NSInteger);
20impl NSSplitViewDividerStyle {
21    #[doc(alias = "NSSplitViewDividerStyleThick")]
22    pub const Thick: Self = Self(1);
23    #[doc(alias = "NSSplitViewDividerStyleThin")]
24    pub const Thin: Self = Self(2);
25    #[doc(alias = "NSSplitViewDividerStylePaneSplitter")]
26    pub const PaneSplitter: Self = Self(3);
27}
28
29unsafe impl Encode for NSSplitViewDividerStyle {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for NSSplitViewDividerStyle {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitview?language=objc)
39    #[unsafe(super(NSView, NSResponder, NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
42    pub struct NSSplitView;
43);
44
45#[cfg(all(
46    feature = "NSAccessibilityProtocols",
47    feature = "NSResponder",
48    feature = "NSView"
49))]
50extern_conformance!(
51    unsafe impl NSAccessibility for NSSplitView {}
52);
53
54#[cfg(all(
55    feature = "NSAccessibilityProtocols",
56    feature = "NSResponder",
57    feature = "NSView"
58))]
59extern_conformance!(
60    unsafe impl NSAccessibilityElementProtocol for NSSplitView {}
61);
62
63#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
64extern_conformance!(
65    unsafe impl NSAnimatablePropertyContainer for NSSplitView {}
66);
67
68#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
69extern_conformance!(
70    unsafe impl NSAppearanceCustomization for NSSplitView {}
71);
72
73#[cfg(all(feature = "NSResponder", feature = "NSView"))]
74extern_conformance!(
75    unsafe impl NSCoding for NSSplitView {}
76);
77
78#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
79extern_conformance!(
80    unsafe impl NSDraggingDestination for NSSplitView {}
81);
82
83#[cfg(all(feature = "NSResponder", feature = "NSView"))]
84extern_conformance!(
85    unsafe impl NSObjectProtocol for NSSplitView {}
86);
87
88#[cfg(all(
89    feature = "NSResponder",
90    feature = "NSUserInterfaceItemIdentification",
91    feature = "NSView"
92))]
93extern_conformance!(
94    unsafe impl NSUserInterfaceItemIdentification for NSSplitView {}
95);
96
97#[cfg(all(feature = "NSResponder", feature = "NSView"))]
98impl NSSplitView {
99    extern_methods!(
100        #[unsafe(method(isVertical))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn isVertical(&self) -> bool;
103
104        /// Setter for [`isVertical`][Self::isVertical].
105        #[unsafe(method(setVertical:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setVertical(&self, vertical: bool);
108
109        #[unsafe(method(dividerStyle))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn dividerStyle(&self) -> NSSplitViewDividerStyle;
112
113        /// Setter for [`dividerStyle`][Self::dividerStyle].
114        #[unsafe(method(setDividerStyle:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setDividerStyle(&self, divider_style: NSSplitViewDividerStyle);
117
118        #[unsafe(method(autosaveName))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn autosaveName(&self) -> Option<Retained<NSSplitViewAutosaveName>>;
121
122        /// Setter for [`autosaveName`][Self::autosaveName].
123        #[unsafe(method(setAutosaveName:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setAutosaveName(&self, autosave_name: Option<&NSSplitViewAutosaveName>);
126
127        #[unsafe(method(delegate))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSSplitViewDelegate>>>;
130
131        /// This is a [weak property][objc2::topics::weak_property].
132        /// Setter for [`delegate`][Self::delegate].
133        #[unsafe(method(setDelegate:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setDelegate(
136            &self,
137            delegate: Option<&ProtocolObject<dyn NSSplitViewDelegate>>,
138        );
139
140        #[unsafe(method(drawDividerInRect:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn drawDividerInRect(&self, rect: NSRect);
143
144        #[cfg(feature = "NSColor")]
145        #[unsafe(method(dividerColor))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn dividerColor(&self) -> Retained<NSColor>;
148
149        #[cfg(feature = "objc2-core-foundation")]
150        #[unsafe(method(dividerThickness))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn dividerThickness(&self) -> CGFloat;
153
154        #[unsafe(method(adjustSubviews))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn adjustSubviews(&self);
157
158        #[unsafe(method(isSubviewCollapsed:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn isSubviewCollapsed(&self, subview: &NSView) -> bool;
161
162        #[cfg(feature = "objc2-core-foundation")]
163        #[unsafe(method(minPossiblePositionOfDividerAtIndex:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn minPossiblePositionOfDividerAtIndex(
166            &self,
167            divider_index: NSInteger,
168        ) -> CGFloat;
169
170        #[cfg(feature = "objc2-core-foundation")]
171        #[unsafe(method(maxPossiblePositionOfDividerAtIndex:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn maxPossiblePositionOfDividerAtIndex(
174            &self,
175            divider_index: NSInteger,
176        ) -> CGFloat;
177
178        #[cfg(feature = "objc2-core-foundation")]
179        #[unsafe(method(setPosition:ofDividerAtIndex:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setPosition_ofDividerAtIndex(
182            &self,
183            position: CGFloat,
184            divider_index: NSInteger,
185        );
186
187        #[cfg(feature = "NSLayoutConstraint")]
188        #[unsafe(method(holdingPriorityForSubviewAtIndex:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn holdingPriorityForSubviewAtIndex(
191            &self,
192            subview_index: NSInteger,
193        ) -> NSLayoutPriority;
194
195        #[cfg(feature = "NSLayoutConstraint")]
196        #[unsafe(method(setHoldingPriority:forSubviewAtIndex:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setHoldingPriority_forSubviewAtIndex(
199            &self,
200            priority: NSLayoutPriority,
201            subview_index: NSInteger,
202        );
203    );
204}
205
206/// Methods declared on superclass `NSView`.
207#[cfg(all(feature = "NSResponder", feature = "NSView"))]
208impl NSSplitView {
209    extern_methods!(
210        #[unsafe(method(initWithFrame:))]
211        #[unsafe(method_family = init)]
212        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
213
214        #[unsafe(method(initWithCoder:))]
215        #[unsafe(method_family = init)]
216        pub unsafe fn initWithCoder(
217            this: Allocated<Self>,
218            coder: &NSCoder,
219        ) -> Option<Retained<Self>>;
220    );
221}
222
223/// Methods declared on superclass `NSResponder`.
224#[cfg(all(feature = "NSResponder", feature = "NSView"))]
225impl NSSplitView {
226    extern_methods!(
227        #[unsafe(method(init))]
228        #[unsafe(method_family = init)]
229        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
230    );
231}
232
233/// Methods declared on superclass `NSObject`.
234#[cfg(all(feature = "NSResponder", feature = "NSView"))]
235impl NSSplitView {
236    extern_methods!(
237        #[unsafe(method(new))]
238        #[unsafe(method_family = new)]
239        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
240    );
241}
242
243/// NSSplitViewArrangedSubviews.
244#[cfg(all(feature = "NSResponder", feature = "NSView"))]
245impl NSSplitView {
246    extern_methods!(
247        /// Whether or not all subviews will be added as arranged views. When NO, a subview must be explicitly added as an arrangedSubview if the view should be arranged as a split pane. When YES,
248        /// `-arrangedSubviews`always be identical to
249        /// `-subviews.`Defaults to YES.
250        /// Setting this from YES to NO will leave all existing subviews as
251        /// `-arrangedSubviews.`Setting this from NO to YES will cause
252        /// `-arrangedSubviews`to become the value of
253        /// `-subviews.`
254        #[unsafe(method(arrangesAllSubviews))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn arrangesAllSubviews(&self) -> bool;
257
258        /// Setter for [`arrangesAllSubviews`][Self::arrangesAllSubviews].
259        #[unsafe(method(setArrangesAllSubviews:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setArrangesAllSubviews(&self, arranges_all_subviews: bool);
262
263        /// The list of views that are arranged as split panes in the receiver.
264        /// They are a subset of
265        /// `-subviews,`with potential difference in ordering. If
266        /// `-arrangesAllSubviews`is YES, then
267        /// `-arrangedSubviews`is identical to
268        /// `-subviews.`
269        #[unsafe(method(arrangedSubviews))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn arrangedSubviews(&self) -> Retained<NSArray<NSView>>;
272
273        /// Adds a view as arranged split pane. If the view is not a subview of the receiver, it will be added as one.
274        #[unsafe(method(addArrangedSubview:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn addArrangedSubview(&self, view: &NSView);
277
278        /// Adds a view as an arranged split pane list at the specific index.
279        /// If the view is already an arranged split view, it will move the view the specified index (but not move the subview index).
280        /// If the view is not a subview of the receiver, it will be added as one (not necessarily at the same index).
281        #[unsafe(method(insertArrangedSubview:atIndex:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn insertArrangedSubview_atIndex(&self, view: &NSView, index: NSInteger);
284
285        /// Removes a view as arranged split pane. If
286        /// `-arrangesAllSubviews`is set to NO, this does not remove the view as a subview.
287        /// Removing the view as a subview (either by -[view removeFromSuperview] or setting the receiver's subviews) will automatically remove it as an arranged subview.
288        #[unsafe(method(removeArrangedSubview:))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn removeArrangedSubview(&self, view: &NSView);
291    );
292}
293
294extern_protocol!(
295    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewdelegate?language=objc)
296    pub unsafe trait NSSplitViewDelegate: NSObjectProtocol + MainThreadOnly {
297        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
298        #[optional]
299        #[unsafe(method(splitView:canCollapseSubview:))]
300        #[unsafe(method_family = none)]
301        unsafe fn splitView_canCollapseSubview(
302            &self,
303            split_view: &NSSplitView,
304            subview: &NSView,
305        ) -> bool;
306
307        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
308        #[deprecated = "NSSplitView no longer supports collapsing sections via double-click. This delegate method is never called."]
309        #[optional]
310        #[unsafe(method(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:))]
311        #[unsafe(method_family = none)]
312        unsafe fn splitView_shouldCollapseSubview_forDoubleClickOnDividerAtIndex(
313            &self,
314            split_view: &NSSplitView,
315            subview: &NSView,
316            divider_index: NSInteger,
317        ) -> bool;
318
319        #[cfg(all(
320            feature = "NSResponder",
321            feature = "NSView",
322            feature = "objc2-core-foundation"
323        ))]
324        #[optional]
325        #[unsafe(method(splitView:constrainMinCoordinate:ofSubviewAt:))]
326        #[unsafe(method_family = none)]
327        unsafe fn splitView_constrainMinCoordinate_ofSubviewAt(
328            &self,
329            split_view: &NSSplitView,
330            proposed_minimum_position: CGFloat,
331            divider_index: NSInteger,
332        ) -> CGFloat;
333
334        #[cfg(all(
335            feature = "NSResponder",
336            feature = "NSView",
337            feature = "objc2-core-foundation"
338        ))]
339        #[optional]
340        #[unsafe(method(splitView:constrainMaxCoordinate:ofSubviewAt:))]
341        #[unsafe(method_family = none)]
342        unsafe fn splitView_constrainMaxCoordinate_ofSubviewAt(
343            &self,
344            split_view: &NSSplitView,
345            proposed_maximum_position: CGFloat,
346            divider_index: NSInteger,
347        ) -> CGFloat;
348
349        #[cfg(all(
350            feature = "NSResponder",
351            feature = "NSView",
352            feature = "objc2-core-foundation"
353        ))]
354        #[optional]
355        #[unsafe(method(splitView:constrainSplitPosition:ofSubviewAt:))]
356        #[unsafe(method_family = none)]
357        unsafe fn splitView_constrainSplitPosition_ofSubviewAt(
358            &self,
359            split_view: &NSSplitView,
360            proposed_position: CGFloat,
361            divider_index: NSInteger,
362        ) -> CGFloat;
363
364        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
365        #[optional]
366        #[unsafe(method(splitView:resizeSubviewsWithOldSize:))]
367        #[unsafe(method_family = none)]
368        unsafe fn splitView_resizeSubviewsWithOldSize(
369            &self,
370            split_view: &NSSplitView,
371            old_size: NSSize,
372        );
373
374        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
375        #[optional]
376        #[unsafe(method(splitView:shouldAdjustSizeOfSubview:))]
377        #[unsafe(method_family = none)]
378        unsafe fn splitView_shouldAdjustSizeOfSubview(
379            &self,
380            split_view: &NSSplitView,
381            view: &NSView,
382        ) -> bool;
383
384        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
385        #[optional]
386        #[unsafe(method(splitView:shouldHideDividerAtIndex:))]
387        #[unsafe(method_family = none)]
388        unsafe fn splitView_shouldHideDividerAtIndex(
389            &self,
390            split_view: &NSSplitView,
391            divider_index: NSInteger,
392        ) -> bool;
393
394        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
395        #[optional]
396        #[unsafe(method(splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:))]
397        #[unsafe(method_family = none)]
398        unsafe fn splitView_effectiveRect_forDrawnRect_ofDividerAtIndex(
399            &self,
400            split_view: &NSSplitView,
401            proposed_effective_rect: NSRect,
402            drawn_rect: NSRect,
403            divider_index: NSInteger,
404        ) -> NSRect;
405
406        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
407        #[optional]
408        #[unsafe(method(splitView:additionalEffectiveRectOfDividerAtIndex:))]
409        #[unsafe(method_family = none)]
410        unsafe fn splitView_additionalEffectiveRectOfDividerAtIndex(
411            &self,
412            split_view: &NSSplitView,
413            divider_index: NSInteger,
414        ) -> NSRect;
415
416        #[optional]
417        #[unsafe(method(splitViewWillResizeSubviews:))]
418        #[unsafe(method_family = none)]
419        unsafe fn splitViewWillResizeSubviews(&self, notification: &NSNotification);
420
421        #[optional]
422        #[unsafe(method(splitViewDidResizeSubviews:))]
423        #[unsafe(method_family = none)]
424        unsafe fn splitViewDidResizeSubviews(&self, notification: &NSNotification);
425    }
426);
427
428extern "C" {
429    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewwillresizesubviewsnotification?language=objc)
430    pub static NSSplitViewWillResizeSubviewsNotification: &'static NSNotificationName;
431}
432
433extern "C" {
434    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewdidresizesubviewsnotification?language=objc)
435    pub static NSSplitViewDidResizeSubviewsNotification: &'static NSNotificationName;
436}
437
438/// NSDeprecated.
439#[cfg(all(feature = "NSResponder", feature = "NSView"))]
440impl NSSplitView {
441    extern_methods!(
442        #[deprecated]
443        #[unsafe(method(setIsPaneSplitter:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn setIsPaneSplitter(&self, flag: bool);
446
447        #[deprecated]
448        #[unsafe(method(isPaneSplitter))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn isPaneSplitter(&self) -> bool;
451    );
452}