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 fn isVertical(&self) -> bool;
103
104        /// Setter for [`isVertical`][Self::isVertical].
105        #[unsafe(method(setVertical:))]
106        #[unsafe(method_family = none)]
107        pub fn setVertical(&self, vertical: bool);
108
109        #[unsafe(method(dividerStyle))]
110        #[unsafe(method_family = none)]
111        pub fn dividerStyle(&self) -> NSSplitViewDividerStyle;
112
113        /// Setter for [`dividerStyle`][Self::dividerStyle].
114        #[unsafe(method(setDividerStyle:))]
115        #[unsafe(method_family = none)]
116        pub fn setDividerStyle(&self, divider_style: NSSplitViewDividerStyle);
117
118        #[unsafe(method(autosaveName))]
119        #[unsafe(method_family = none)]
120        pub fn autosaveName(&self) -> Option<Retained<NSSplitViewAutosaveName>>;
121
122        /// Setter for [`autosaveName`][Self::autosaveName].
123        ///
124        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
125        #[unsafe(method(setAutosaveName:))]
126        #[unsafe(method_family = none)]
127        pub fn setAutosaveName(&self, autosave_name: Option<&NSSplitViewAutosaveName>);
128
129        #[unsafe(method(delegate))]
130        #[unsafe(method_family = none)]
131        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSSplitViewDelegate>>>;
132
133        /// Setter for [`delegate`][Self::delegate].
134        ///
135        /// This is a [weak property][objc2::topics::weak_property].
136        #[unsafe(method(setDelegate:))]
137        #[unsafe(method_family = none)]
138        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSSplitViewDelegate>>);
139
140        #[unsafe(method(drawDividerInRect:))]
141        #[unsafe(method_family = none)]
142        pub fn drawDividerInRect(&self, rect: NSRect);
143
144        #[cfg(feature = "NSColor")]
145        #[unsafe(method(dividerColor))]
146        #[unsafe(method_family = none)]
147        pub fn dividerColor(&self) -> Retained<NSColor>;
148
149        #[cfg(feature = "objc2-core-foundation")]
150        #[unsafe(method(dividerThickness))]
151        #[unsafe(method_family = none)]
152        pub fn dividerThickness(&self) -> CGFloat;
153
154        #[unsafe(method(adjustSubviews))]
155        #[unsafe(method_family = none)]
156        pub fn adjustSubviews(&self);
157
158        #[unsafe(method(isSubviewCollapsed:))]
159        #[unsafe(method_family = none)]
160        pub fn isSubviewCollapsed(&self, subview: &NSView) -> bool;
161
162        #[cfg(feature = "objc2-core-foundation")]
163        #[unsafe(method(minPossiblePositionOfDividerAtIndex:))]
164        #[unsafe(method_family = none)]
165        pub fn minPossiblePositionOfDividerAtIndex(&self, divider_index: NSInteger) -> CGFloat;
166
167        #[cfg(feature = "objc2-core-foundation")]
168        #[unsafe(method(maxPossiblePositionOfDividerAtIndex:))]
169        #[unsafe(method_family = none)]
170        pub fn maxPossiblePositionOfDividerAtIndex(&self, divider_index: NSInteger) -> CGFloat;
171
172        #[cfg(feature = "objc2-core-foundation")]
173        #[unsafe(method(setPosition:ofDividerAtIndex:))]
174        #[unsafe(method_family = none)]
175        pub fn setPosition_ofDividerAtIndex(&self, position: CGFloat, divider_index: NSInteger);
176
177        #[cfg(feature = "NSLayoutConstraint")]
178        #[unsafe(method(holdingPriorityForSubviewAtIndex:))]
179        #[unsafe(method_family = none)]
180        pub fn holdingPriorityForSubviewAtIndex(
181            &self,
182            subview_index: NSInteger,
183        ) -> NSLayoutPriority;
184
185        #[cfg(feature = "NSLayoutConstraint")]
186        #[unsafe(method(setHoldingPriority:forSubviewAtIndex:))]
187        #[unsafe(method_family = none)]
188        pub fn setHoldingPriority_forSubviewAtIndex(
189            &self,
190            priority: NSLayoutPriority,
191            subview_index: NSInteger,
192        );
193    );
194}
195
196/// Methods declared on superclass `NSView`.
197#[cfg(all(feature = "NSResponder", feature = "NSView"))]
198impl NSSplitView {
199    extern_methods!(
200        #[unsafe(method(initWithFrame:))]
201        #[unsafe(method_family = init)]
202        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
203
204        /// # Safety
205        ///
206        /// `coder` possibly has further requirements.
207        #[unsafe(method(initWithCoder:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithCoder(
210            this: Allocated<Self>,
211            coder: &NSCoder,
212        ) -> Option<Retained<Self>>;
213    );
214}
215
216/// Methods declared on superclass `NSResponder`.
217#[cfg(all(feature = "NSResponder", feature = "NSView"))]
218impl NSSplitView {
219    extern_methods!(
220        #[unsafe(method(init))]
221        #[unsafe(method_family = init)]
222        pub fn init(this: Allocated<Self>) -> Retained<Self>;
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227#[cfg(all(feature = "NSResponder", feature = "NSView"))]
228impl NSSplitView {
229    extern_methods!(
230        #[unsafe(method(new))]
231        #[unsafe(method_family = new)]
232        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
233    );
234}
235
236/// NSSplitViewArrangedSubviews.
237#[cfg(all(feature = "NSResponder", feature = "NSView"))]
238impl NSSplitView {
239    extern_methods!(
240        /// 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,
241        /// `-arrangedSubviews`always be identical to
242        /// `-subviews.`Defaults to YES.
243        /// Setting this from YES to NO will leave all existing subviews as
244        /// `-arrangedSubviews.`Setting this from NO to YES will cause
245        /// `-arrangedSubviews`to become the value of
246        /// `-subviews.`
247        #[unsafe(method(arrangesAllSubviews))]
248        #[unsafe(method_family = none)]
249        pub fn arrangesAllSubviews(&self) -> bool;
250
251        /// Setter for [`arrangesAllSubviews`][Self::arrangesAllSubviews].
252        #[unsafe(method(setArrangesAllSubviews:))]
253        #[unsafe(method_family = none)]
254        pub fn setArrangesAllSubviews(&self, arranges_all_subviews: bool);
255
256        /// The list of views that are arranged as split panes in the receiver.
257        /// They are a subset of
258        /// `-subviews,`with potential difference in ordering. If
259        /// `-arrangesAllSubviews`is YES, then
260        /// `-arrangedSubviews`is identical to
261        /// `-subviews.`
262        #[unsafe(method(arrangedSubviews))]
263        #[unsafe(method_family = none)]
264        pub fn arrangedSubviews(&self) -> Retained<NSArray<NSView>>;
265
266        /// Adds a view as arranged split pane. If the view is not a subview of the receiver, it will be added as one.
267        #[unsafe(method(addArrangedSubview:))]
268        #[unsafe(method_family = none)]
269        pub fn addArrangedSubview(&self, view: &NSView);
270
271        /// Adds a view as an arranged split pane list at the specific index.
272        /// If the view is already an arranged split view, it will move the view the specified index (but not move the subview index).
273        /// If the view is not a subview of the receiver, it will be added as one (not necessarily at the same index).
274        #[unsafe(method(insertArrangedSubview:atIndex:))]
275        #[unsafe(method_family = none)]
276        pub fn insertArrangedSubview_atIndex(&self, view: &NSView, index: NSInteger);
277
278        /// Removes a view as arranged split pane. If
279        /// `-arrangesAllSubviews`is set to NO, this does not remove the view as a subview.
280        /// Removing the view as a subview (either by -[view removeFromSuperview] or setting the receiver's subviews) will automatically remove it as an arranged subview.
281        #[unsafe(method(removeArrangedSubview:))]
282        #[unsafe(method_family = none)]
283        pub fn removeArrangedSubview(&self, view: &NSView);
284    );
285}
286
287extern_protocol!(
288    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewdelegate?language=objc)
289    pub unsafe trait NSSplitViewDelegate: NSObjectProtocol + MainThreadOnly {
290        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
291        #[optional]
292        #[unsafe(method(splitView:canCollapseSubview:))]
293        #[unsafe(method_family = none)]
294        fn splitView_canCollapseSubview(&self, split_view: &NSSplitView, subview: &NSView) -> bool;
295
296        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
297        #[deprecated = "NSSplitView no longer supports collapsing sections via double-click. This delegate method is never called."]
298        #[optional]
299        #[unsafe(method(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:))]
300        #[unsafe(method_family = none)]
301        fn splitView_shouldCollapseSubview_forDoubleClickOnDividerAtIndex(
302            &self,
303            split_view: &NSSplitView,
304            subview: &NSView,
305            divider_index: NSInteger,
306        ) -> bool;
307
308        #[cfg(all(
309            feature = "NSResponder",
310            feature = "NSView",
311            feature = "objc2-core-foundation"
312        ))]
313        #[optional]
314        #[unsafe(method(splitView:constrainMinCoordinate:ofSubviewAt:))]
315        #[unsafe(method_family = none)]
316        fn splitView_constrainMinCoordinate_ofSubviewAt(
317            &self,
318            split_view: &NSSplitView,
319            proposed_minimum_position: CGFloat,
320            divider_index: NSInteger,
321        ) -> CGFloat;
322
323        #[cfg(all(
324            feature = "NSResponder",
325            feature = "NSView",
326            feature = "objc2-core-foundation"
327        ))]
328        #[optional]
329        #[unsafe(method(splitView:constrainMaxCoordinate:ofSubviewAt:))]
330        #[unsafe(method_family = none)]
331        fn splitView_constrainMaxCoordinate_ofSubviewAt(
332            &self,
333            split_view: &NSSplitView,
334            proposed_maximum_position: CGFloat,
335            divider_index: NSInteger,
336        ) -> CGFloat;
337
338        #[cfg(all(
339            feature = "NSResponder",
340            feature = "NSView",
341            feature = "objc2-core-foundation"
342        ))]
343        #[optional]
344        #[unsafe(method(splitView:constrainSplitPosition:ofSubviewAt:))]
345        #[unsafe(method_family = none)]
346        fn splitView_constrainSplitPosition_ofSubviewAt(
347            &self,
348            split_view: &NSSplitView,
349            proposed_position: CGFloat,
350            divider_index: NSInteger,
351        ) -> CGFloat;
352
353        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
354        #[optional]
355        #[unsafe(method(splitView:resizeSubviewsWithOldSize:))]
356        #[unsafe(method_family = none)]
357        fn splitView_resizeSubviewsWithOldSize(&self, split_view: &NSSplitView, old_size: NSSize);
358
359        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
360        #[optional]
361        #[unsafe(method(splitView:shouldAdjustSizeOfSubview:))]
362        #[unsafe(method_family = none)]
363        fn splitView_shouldAdjustSizeOfSubview(
364            &self,
365            split_view: &NSSplitView,
366            view: &NSView,
367        ) -> bool;
368
369        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
370        #[optional]
371        #[unsafe(method(splitView:shouldHideDividerAtIndex:))]
372        #[unsafe(method_family = none)]
373        fn splitView_shouldHideDividerAtIndex(
374            &self,
375            split_view: &NSSplitView,
376            divider_index: NSInteger,
377        ) -> bool;
378
379        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
380        #[optional]
381        #[unsafe(method(splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:))]
382        #[unsafe(method_family = none)]
383        fn splitView_effectiveRect_forDrawnRect_ofDividerAtIndex(
384            &self,
385            split_view: &NSSplitView,
386            proposed_effective_rect: NSRect,
387            drawn_rect: NSRect,
388            divider_index: NSInteger,
389        ) -> NSRect;
390
391        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
392        #[optional]
393        #[unsafe(method(splitView:additionalEffectiveRectOfDividerAtIndex:))]
394        #[unsafe(method_family = none)]
395        fn splitView_additionalEffectiveRectOfDividerAtIndex(
396            &self,
397            split_view: &NSSplitView,
398            divider_index: NSInteger,
399        ) -> NSRect;
400
401        #[optional]
402        #[unsafe(method(splitViewWillResizeSubviews:))]
403        #[unsafe(method_family = none)]
404        fn splitViewWillResizeSubviews(&self, notification: &NSNotification);
405
406        #[optional]
407        #[unsafe(method(splitViewDidResizeSubviews:))]
408        #[unsafe(method_family = none)]
409        fn splitViewDidResizeSubviews(&self, notification: &NSNotification);
410    }
411);
412
413extern "C" {
414    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewwillresizesubviewsnotification?language=objc)
415    pub static NSSplitViewWillResizeSubviewsNotification: &'static NSNotificationName;
416}
417
418extern "C" {
419    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssplitviewdidresizesubviewsnotification?language=objc)
420    pub static NSSplitViewDidResizeSubviewsNotification: &'static NSNotificationName;
421}
422
423/// NSDeprecated.
424#[cfg(all(feature = "NSResponder", feature = "NSView"))]
425impl NSSplitView {
426    extern_methods!(
427        #[deprecated]
428        #[unsafe(method(setIsPaneSplitter:))]
429        #[unsafe(method_family = none)]
430        pub fn setIsPaneSplitter(&self, flag: bool);
431
432        #[deprecated]
433        #[unsafe(method(isPaneSplitter))]
434        #[unsafe(method_family = none)]
435        pub fn isPaneSplitter(&self) -> bool;
436    );
437}