objc2_app_kit/generated/
NSTableColumn.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/nstablecolumnresizingoptions?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTableColumnResizingOptions(pub NSUInteger);
17bitflags::bitflags! {
18    impl NSTableColumnResizingOptions: NSUInteger {
19        #[doc(alias = "NSTableColumnNoResizing")]
20        const NoResizing = 0;
21        #[doc(alias = "NSTableColumnAutoresizingMask")]
22        const AutoresizingMask = 1<<0;
23        #[doc(alias = "NSTableColumnUserResizingMask")]
24        const UserResizingMask = 1<<1;
25    }
26}
27
28unsafe impl Encode for NSTableColumnResizingOptions {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for NSTableColumnResizingOptions {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstablecolumn?language=objc)
38    #[unsafe(super(NSObject))]
39    #[thread_kind = MainThreadOnly]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct NSTableColumn;
42);
43
44extern_conformance!(
45    unsafe impl NSCoding for NSTableColumn {}
46);
47
48extern_conformance!(
49    unsafe impl NSObjectProtocol for NSTableColumn {}
50);
51
52#[cfg(feature = "NSUserInterfaceItemIdentification")]
53extern_conformance!(
54    unsafe impl NSUserInterfaceItemIdentification for NSTableColumn {}
55);
56
57impl NSTableColumn {
58    extern_methods!(
59        #[cfg(feature = "NSUserInterfaceItemIdentification")]
60        #[unsafe(method(initWithIdentifier:))]
61        #[unsafe(method_family = init)]
62        pub fn initWithIdentifier(
63            this: Allocated<Self>,
64            identifier: &NSUserInterfaceItemIdentifier,
65        ) -> Retained<Self>;
66
67        /// # Safety
68        ///
69        /// `coder` possibly has further requirements.
70        #[unsafe(method(initWithCoder:))]
71        #[unsafe(method_family = init)]
72        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
73
74        #[cfg(feature = "NSUserInterfaceItemIdentification")]
75        #[unsafe(method(identifier))]
76        #[unsafe(method_family = none)]
77        pub fn identifier(&self) -> Retained<NSUserInterfaceItemIdentifier>;
78
79        #[cfg(feature = "NSUserInterfaceItemIdentification")]
80        /// Setter for [`identifier`][Self::identifier].
81        ///
82        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
83        #[unsafe(method(setIdentifier:))]
84        #[unsafe(method_family = none)]
85        pub fn setIdentifier(&self, identifier: &NSUserInterfaceItemIdentifier);
86
87        #[cfg(all(
88            feature = "NSControl",
89            feature = "NSResponder",
90            feature = "NSTableView",
91            feature = "NSView"
92        ))]
93        #[unsafe(method(tableView))]
94        #[unsafe(method_family = none)]
95        pub fn tableView(&self) -> Option<Retained<NSTableView>>;
96
97        #[cfg(all(
98            feature = "NSControl",
99            feature = "NSResponder",
100            feature = "NSTableView",
101            feature = "NSView"
102        ))]
103        /// Setter for [`tableView`][Self::tableView].
104        ///
105        /// This is a [weak property][objc2::topics::weak_property].
106        #[unsafe(method(setTableView:))]
107        #[unsafe(method_family = none)]
108        pub fn setTableView(&self, table_view: Option<&NSTableView>);
109
110        #[cfg(feature = "objc2-core-foundation")]
111        #[unsafe(method(width))]
112        #[unsafe(method_family = none)]
113        pub fn width(&self) -> CGFloat;
114
115        #[cfg(feature = "objc2-core-foundation")]
116        /// Setter for [`width`][Self::width].
117        #[unsafe(method(setWidth:))]
118        #[unsafe(method_family = none)]
119        pub fn setWidth(&self, width: CGFloat);
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(minWidth))]
123        #[unsafe(method_family = none)]
124        pub fn minWidth(&self) -> CGFloat;
125
126        #[cfg(feature = "objc2-core-foundation")]
127        /// Setter for [`minWidth`][Self::minWidth].
128        #[unsafe(method(setMinWidth:))]
129        #[unsafe(method_family = none)]
130        pub fn setMinWidth(&self, min_width: CGFloat);
131
132        #[cfg(feature = "objc2-core-foundation")]
133        #[unsafe(method(maxWidth))]
134        #[unsafe(method_family = none)]
135        pub fn maxWidth(&self) -> CGFloat;
136
137        #[cfg(feature = "objc2-core-foundation")]
138        /// Setter for [`maxWidth`][Self::maxWidth].
139        #[unsafe(method(setMaxWidth:))]
140        #[unsafe(method_family = none)]
141        pub fn setMaxWidth(&self, max_width: CGFloat);
142
143        #[unsafe(method(title))]
144        #[unsafe(method_family = none)]
145        pub fn title(&self) -> Retained<NSString>;
146
147        /// Setter for [`title`][Self::title].
148        ///
149        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
150        #[unsafe(method(setTitle:))]
151        #[unsafe(method_family = none)]
152        pub fn setTitle(&self, title: &NSString);
153
154        #[cfg(all(
155            feature = "NSActionCell",
156            feature = "NSCell",
157            feature = "NSTableHeaderCell",
158            feature = "NSTextFieldCell"
159        ))]
160        #[unsafe(method(headerCell))]
161        #[unsafe(method_family = none)]
162        pub fn headerCell(&self) -> Retained<NSTableHeaderCell>;
163
164        #[cfg(all(
165            feature = "NSActionCell",
166            feature = "NSCell",
167            feature = "NSTableHeaderCell",
168            feature = "NSTextFieldCell"
169        ))]
170        /// Setter for [`headerCell`][Self::headerCell].
171        #[unsafe(method(setHeaderCell:))]
172        #[unsafe(method_family = none)]
173        pub fn setHeaderCell(&self, header_cell: &NSTableHeaderCell);
174
175        #[unsafe(method(isEditable))]
176        #[unsafe(method_family = none)]
177        pub fn isEditable(&self) -> bool;
178
179        /// Setter for [`isEditable`][Self::isEditable].
180        #[unsafe(method(setEditable:))]
181        #[unsafe(method_family = none)]
182        pub fn setEditable(&self, editable: bool);
183
184        #[unsafe(method(sizeToFit))]
185        #[unsafe(method_family = none)]
186        pub fn sizeToFit(&self);
187
188        #[unsafe(method(sortDescriptorPrototype))]
189        #[unsafe(method_family = none)]
190        pub fn sortDescriptorPrototype(&self) -> Option<Retained<NSSortDescriptor>>;
191
192        /// Setter for [`sortDescriptorPrototype`][Self::sortDescriptorPrototype].
193        ///
194        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
195        #[unsafe(method(setSortDescriptorPrototype:))]
196        #[unsafe(method_family = none)]
197        pub fn setSortDescriptorPrototype(
198            &self,
199            sort_descriptor_prototype: Option<&NSSortDescriptor>,
200        );
201
202        #[unsafe(method(resizingMask))]
203        #[unsafe(method_family = none)]
204        pub fn resizingMask(&self) -> NSTableColumnResizingOptions;
205
206        /// Setter for [`resizingMask`][Self::resizingMask].
207        #[unsafe(method(setResizingMask:))]
208        #[unsafe(method_family = none)]
209        pub fn setResizingMask(&self, resizing_mask: NSTableColumnResizingOptions);
210
211        #[unsafe(method(headerToolTip))]
212        #[unsafe(method_family = none)]
213        pub fn headerToolTip(&self) -> Option<Retained<NSString>>;
214
215        /// Setter for [`headerToolTip`][Self::headerToolTip].
216        ///
217        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
218        #[unsafe(method(setHeaderToolTip:))]
219        #[unsafe(method_family = none)]
220        pub fn setHeaderToolTip(&self, header_tool_tip: Option<&NSString>);
221
222        #[unsafe(method(isHidden))]
223        #[unsafe(method_family = none)]
224        pub fn isHidden(&self) -> bool;
225
226        /// Setter for [`isHidden`][Self::isHidden].
227        #[unsafe(method(setHidden:))]
228        #[unsafe(method_family = none)]
229        pub fn setHidden(&self, hidden: bool);
230    );
231}
232
233/// Methods declared on superclass `NSObject`.
234impl NSTableColumn {
235    extern_methods!(
236        #[unsafe(method(init))]
237        #[unsafe(method_family = init)]
238        pub fn init(this: Allocated<Self>) -> Retained<Self>;
239
240        #[unsafe(method(new))]
241        #[unsafe(method_family = new)]
242        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
243    );
244}
245
246/// NSDeprecated.
247impl NSTableColumn {
248    extern_methods!(
249        #[deprecated]
250        #[unsafe(method(setResizable:))]
251        #[unsafe(method_family = none)]
252        pub fn setResizable(&self, flag: bool);
253
254        #[deprecated]
255        #[unsafe(method(isResizable))]
256        #[unsafe(method_family = none)]
257        pub fn isResizable(&self) -> bool;
258
259        #[unsafe(method(dataCell))]
260        #[unsafe(method_family = none)]
261        pub fn dataCell(&self) -> Retained<AnyObject>;
262
263        /// Setter for [`dataCell`][Self::dataCell].
264        ///
265        /// # Safety
266        ///
267        /// `data_cell` should be of the correct type.
268        #[unsafe(method(setDataCell:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setDataCell(&self, data_cell: &AnyObject);
271
272        #[unsafe(method(dataCellForRow:))]
273        #[unsafe(method_family = none)]
274        pub fn dataCellForRow(&self, row: NSInteger) -> Retained<AnyObject>;
275    );
276}