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