objc2_app_kit/generated/
NSTabView.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumberwithdirectionaltabs?language=objc)
11#[cfg(feature = "NSApplication")]
12pub static NSAppKitVersionNumberWithDirectionalTabs: NSAppKitVersion = 631.0 as _;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewtype?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct NSTabViewType(pub NSUInteger);
19impl NSTabViewType {
20    #[doc(alias = "NSTopTabsBezelBorder")]
21    pub const TopTabsBezelBorder: Self = Self(0);
22    #[doc(alias = "NSLeftTabsBezelBorder")]
23    pub const LeftTabsBezelBorder: Self = Self(1);
24    #[doc(alias = "NSBottomTabsBezelBorder")]
25    pub const BottomTabsBezelBorder: Self = Self(2);
26    #[doc(alias = "NSRightTabsBezelBorder")]
27    pub const RightTabsBezelBorder: Self = Self(3);
28    #[doc(alias = "NSNoTabsBezelBorder")]
29    pub const NoTabsBezelBorder: Self = Self(4);
30    #[doc(alias = "NSNoTabsLineBorder")]
31    pub const NoTabsLineBorder: Self = Self(5);
32    #[doc(alias = "NSNoTabsNoBorder")]
33    pub const NoTabsNoBorder: Self = Self(6);
34}
35
36unsafe impl Encode for NSTabViewType {
37    const ENCODING: Encoding = NSUInteger::ENCODING;
38}
39
40unsafe impl RefEncode for NSTabViewType {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabposition?language=objc)
45// NS_ENUM
46#[repr(transparent)]
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
48pub struct NSTabPosition(pub NSUInteger);
49impl NSTabPosition {
50    #[doc(alias = "NSTabPositionNone")]
51    pub const None: Self = Self(0);
52    #[doc(alias = "NSTabPositionTop")]
53    pub const Top: Self = Self(1);
54    #[doc(alias = "NSTabPositionLeft")]
55    pub const Left: Self = Self(2);
56    #[doc(alias = "NSTabPositionBottom")]
57    pub const Bottom: Self = Self(3);
58    #[doc(alias = "NSTabPositionRight")]
59    pub const Right: Self = Self(4);
60}
61
62unsafe impl Encode for NSTabPosition {
63    const ENCODING: Encoding = NSUInteger::ENCODING;
64}
65
66unsafe impl RefEncode for NSTabPosition {
67    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
68}
69
70/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewbordertype?language=objc)
71// NS_ENUM
72#[repr(transparent)]
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
74pub struct NSTabViewBorderType(pub NSUInteger);
75impl NSTabViewBorderType {
76    #[doc(alias = "NSTabViewBorderTypeNone")]
77    pub const None: Self = Self(0);
78    #[doc(alias = "NSTabViewBorderTypeLine")]
79    pub const Line: Self = Self(1);
80    #[doc(alias = "NSTabViewBorderTypeBezel")]
81    pub const Bezel: Self = Self(2);
82}
83
84unsafe impl Encode for NSTabViewBorderType {
85    const ENCODING: Encoding = NSUInteger::ENCODING;
86}
87
88unsafe impl RefEncode for NSTabViewBorderType {
89    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
90}
91
92extern_class!(
93    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabview?language=objc)
94    #[unsafe(super(NSView, NSResponder, NSObject))]
95    #[derive(Debug, PartialEq, Eq, Hash)]
96    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
97    pub struct NSTabView;
98);
99
100#[cfg(all(
101    feature = "NSAccessibilityProtocols",
102    feature = "NSResponder",
103    feature = "NSView"
104))]
105unsafe impl NSAccessibility for NSTabView {}
106
107#[cfg(all(
108    feature = "NSAccessibilityProtocols",
109    feature = "NSResponder",
110    feature = "NSView"
111))]
112unsafe impl NSAccessibilityElementProtocol for NSTabView {}
113
114#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
115unsafe impl NSAnimatablePropertyContainer for NSTabView {}
116
117#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
118unsafe impl NSAppearanceCustomization for NSTabView {}
119
120#[cfg(all(feature = "NSResponder", feature = "NSView"))]
121unsafe impl NSCoding for NSTabView {}
122
123#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
124unsafe impl NSDraggingDestination for NSTabView {}
125
126#[cfg(all(feature = "NSResponder", feature = "NSView"))]
127unsafe impl NSObjectProtocol for NSTabView {}
128
129#[cfg(all(
130    feature = "NSResponder",
131    feature = "NSUserInterfaceItemIdentification",
132    feature = "NSView"
133))]
134unsafe impl NSUserInterfaceItemIdentification for NSTabView {}
135
136#[cfg(all(feature = "NSResponder", feature = "NSView"))]
137impl NSTabView {
138    extern_methods!(
139        #[cfg(feature = "NSTabViewItem")]
140        #[unsafe(method(selectTabViewItem:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn selectTabViewItem(&self, tab_view_item: Option<&NSTabViewItem>);
143
144        #[unsafe(method(selectTabViewItemAtIndex:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn selectTabViewItemAtIndex(&self, index: NSInteger);
147
148        #[unsafe(method(selectTabViewItemWithIdentifier:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn selectTabViewItemWithIdentifier(&self, identifier: &AnyObject);
151
152        #[unsafe(method(takeSelectedTabViewItemFromSender:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn takeSelectedTabViewItemFromSender(&self, sender: Option<&AnyObject>);
155
156        #[unsafe(method(selectFirstTabViewItem:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn selectFirstTabViewItem(&self, sender: Option<&AnyObject>);
159
160        #[unsafe(method(selectLastTabViewItem:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn selectLastTabViewItem(&self, sender: Option<&AnyObject>);
163
164        #[unsafe(method(selectNextTabViewItem:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn selectNextTabViewItem(&self, sender: Option<&AnyObject>);
167
168        #[unsafe(method(selectPreviousTabViewItem:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn selectPreviousTabViewItem(&self, sender: Option<&AnyObject>);
171
172        #[cfg(feature = "NSTabViewItem")]
173        #[unsafe(method(selectedTabViewItem))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn selectedTabViewItem(&self) -> Option<Retained<NSTabViewItem>>;
176
177        #[cfg(feature = "NSFont")]
178        #[unsafe(method(font))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn font(&self) -> Retained<NSFont>;
181
182        #[cfg(feature = "NSFont")]
183        /// Setter for [`font`][Self::font].
184        #[unsafe(method(setFont:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setFont(&self, font: &NSFont);
187
188        #[unsafe(method(tabViewType))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn tabViewType(&self) -> NSTabViewType;
191
192        /// Setter for [`tabViewType`][Self::tabViewType].
193        #[unsafe(method(setTabViewType:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setTabViewType(&self, tab_view_type: NSTabViewType);
196
197        #[unsafe(method(tabPosition))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn tabPosition(&self) -> NSTabPosition;
200
201        /// Setter for [`tabPosition`][Self::tabPosition].
202        #[unsafe(method(setTabPosition:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn setTabPosition(&self, tab_position: NSTabPosition);
205
206        #[unsafe(method(tabViewBorderType))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn tabViewBorderType(&self) -> NSTabViewBorderType;
209
210        /// Setter for [`tabViewBorderType`][Self::tabViewBorderType].
211        #[unsafe(method(setTabViewBorderType:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setTabViewBorderType(&self, tab_view_border_type: NSTabViewBorderType);
214
215        #[cfg(feature = "NSTabViewItem")]
216        #[unsafe(method(tabViewItems))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn tabViewItems(&self) -> Retained<NSArray<NSTabViewItem>>;
219
220        #[cfg(feature = "NSTabViewItem")]
221        /// Setter for [`tabViewItems`][Self::tabViewItems].
222        #[unsafe(method(setTabViewItems:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setTabViewItems(&self, tab_view_items: &NSArray<NSTabViewItem>);
225
226        #[unsafe(method(allowsTruncatedLabels))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn allowsTruncatedLabels(&self) -> bool;
229
230        /// Setter for [`allowsTruncatedLabels`][Self::allowsTruncatedLabels].
231        #[unsafe(method(setAllowsTruncatedLabels:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setAllowsTruncatedLabels(&self, allows_truncated_labels: bool);
234
235        #[unsafe(method(minimumSize))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn minimumSize(&self) -> NSSize;
238
239        #[unsafe(method(drawsBackground))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn drawsBackground(&self) -> bool;
242
243        /// Setter for [`drawsBackground`][Self::drawsBackground].
244        #[unsafe(method(setDrawsBackground:))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn setDrawsBackground(&self, draws_background: bool);
247
248        #[cfg(feature = "NSCell")]
249        #[unsafe(method(controlSize))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn controlSize(&self) -> NSControlSize;
252
253        #[cfg(feature = "NSCell")]
254        /// Setter for [`controlSize`][Self::controlSize].
255        #[unsafe(method(setControlSize:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setControlSize(&self, control_size: NSControlSize);
258
259        #[cfg(feature = "NSTabViewItem")]
260        #[unsafe(method(addTabViewItem:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn addTabViewItem(&self, tab_view_item: &NSTabViewItem);
263
264        #[cfg(feature = "NSTabViewItem")]
265        #[unsafe(method(insertTabViewItem:atIndex:))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn insertTabViewItem_atIndex(
268            &self,
269            tab_view_item: &NSTabViewItem,
270            index: NSInteger,
271        );
272
273        #[cfg(feature = "NSTabViewItem")]
274        #[unsafe(method(removeTabViewItem:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn removeTabViewItem(&self, tab_view_item: &NSTabViewItem);
277
278        #[unsafe(method(delegate))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTabViewDelegate>>>;
281
282        /// This is a [weak property][objc2::topics::weak_property].
283        /// Setter for [`delegate`][Self::delegate].
284        #[unsafe(method(setDelegate:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSTabViewDelegate>>);
287
288        #[cfg(feature = "NSTabViewItem")]
289        #[unsafe(method(tabViewItemAtPoint:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn tabViewItemAtPoint(&self, point: NSPoint) -> Option<Retained<NSTabViewItem>>;
292
293        #[unsafe(method(contentRect))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn contentRect(&self) -> NSRect;
296
297        #[unsafe(method(numberOfTabViewItems))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn numberOfTabViewItems(&self) -> NSInteger;
300
301        #[cfg(feature = "NSTabViewItem")]
302        #[unsafe(method(indexOfTabViewItem:))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn indexOfTabViewItem(&self, tab_view_item: &NSTabViewItem) -> NSInteger;
305
306        #[cfg(feature = "NSTabViewItem")]
307        #[unsafe(method(tabViewItemAtIndex:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn tabViewItemAtIndex(&self, index: NSInteger) -> Retained<NSTabViewItem>;
310
311        #[unsafe(method(indexOfTabViewItemWithIdentifier:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn indexOfTabViewItemWithIdentifier(&self, identifier: &AnyObject) -> NSInteger;
314
315        #[cfg(feature = "NSCell")]
316        #[deprecated = "The controlTint property is not respected on 10.14 and later."]
317        #[unsafe(method(controlTint))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn controlTint(&self) -> NSControlTint;
320
321        #[cfg(feature = "NSCell")]
322        /// Setter for [`controlTint`][Self::controlTint].
323        #[deprecated = "The controlTint property is not respected on 10.14 and later."]
324        #[unsafe(method(setControlTint:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn setControlTint(&self, control_tint: NSControlTint);
327    );
328}
329
330/// Methods declared on superclass `NSView`.
331#[cfg(all(feature = "NSResponder", feature = "NSView"))]
332impl NSTabView {
333    extern_methods!(
334        #[unsafe(method(initWithFrame:))]
335        #[unsafe(method_family = init)]
336        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
337
338        #[unsafe(method(initWithCoder:))]
339        #[unsafe(method_family = init)]
340        pub unsafe fn initWithCoder(
341            this: Allocated<Self>,
342            coder: &NSCoder,
343        ) -> Option<Retained<Self>>;
344    );
345}
346
347/// Methods declared on superclass `NSResponder`.
348#[cfg(all(feature = "NSResponder", feature = "NSView"))]
349impl NSTabView {
350    extern_methods!(
351        #[unsafe(method(init))]
352        #[unsafe(method_family = init)]
353        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
354    );
355}
356
357/// Methods declared on superclass `NSObject`.
358#[cfg(all(feature = "NSResponder", feature = "NSView"))]
359impl NSTabView {
360    extern_methods!(
361        #[unsafe(method(new))]
362        #[unsafe(method_family = new)]
363        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
364    );
365}
366
367extern_protocol!(
368    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabviewdelegate?language=objc)
369    pub unsafe trait NSTabViewDelegate: NSObjectProtocol + MainThreadOnly {
370        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
371        #[optional]
372        #[unsafe(method(tabView:shouldSelectTabViewItem:))]
373        #[unsafe(method_family = none)]
374        unsafe fn tabView_shouldSelectTabViewItem(
375            &self,
376            tab_view: &NSTabView,
377            tab_view_item: Option<&NSTabViewItem>,
378        ) -> bool;
379
380        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
381        #[optional]
382        #[unsafe(method(tabView:willSelectTabViewItem:))]
383        #[unsafe(method_family = none)]
384        unsafe fn tabView_willSelectTabViewItem(
385            &self,
386            tab_view: &NSTabView,
387            tab_view_item: Option<&NSTabViewItem>,
388        );
389
390        #[cfg(all(feature = "NSResponder", feature = "NSTabViewItem", feature = "NSView"))]
391        #[optional]
392        #[unsafe(method(tabView:didSelectTabViewItem:))]
393        #[unsafe(method_family = none)]
394        unsafe fn tabView_didSelectTabViewItem(
395            &self,
396            tab_view: &NSTabView,
397            tab_view_item: Option<&NSTabViewItem>,
398        );
399
400        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
401        #[optional]
402        #[unsafe(method(tabViewDidChangeNumberOfTabViewItems:))]
403        #[unsafe(method_family = none)]
404        unsafe fn tabViewDidChangeNumberOfTabViewItems(&self, tab_view: &NSTabView);
405    }
406);