1use 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
12extern_class!(
13 #[unsafe(super(NSMatrix, NSControl, NSView, NSResponder, NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 #[cfg(all(
17 feature = "NSControl",
18 feature = "NSMatrix",
19 feature = "NSResponder",
20 feature = "NSView"
21 ))]
22 #[deprecated = "Use NSTextField directly instead, and consider NSStackView for layout assistance"]
23 pub struct NSForm;
24);
25
26#[cfg(all(
27 feature = "NSAccessibilityProtocols",
28 feature = "NSControl",
29 feature = "NSMatrix",
30 feature = "NSResponder",
31 feature = "NSView"
32))]
33extern_conformance!(
34 unsafe impl NSAccessibility for NSForm {}
35);
36
37#[cfg(all(
38 feature = "NSAccessibilityProtocols",
39 feature = "NSControl",
40 feature = "NSMatrix",
41 feature = "NSResponder",
42 feature = "NSView"
43))]
44extern_conformance!(
45 unsafe impl NSAccessibilityElementProtocol for NSForm {}
46);
47
48#[cfg(all(
49 feature = "NSAnimation",
50 feature = "NSControl",
51 feature = "NSMatrix",
52 feature = "NSResponder",
53 feature = "NSView"
54))]
55extern_conformance!(
56 unsafe impl NSAnimatablePropertyContainer for NSForm {}
57);
58
59#[cfg(all(
60 feature = "NSAppearance",
61 feature = "NSControl",
62 feature = "NSMatrix",
63 feature = "NSResponder",
64 feature = "NSView"
65))]
66extern_conformance!(
67 unsafe impl NSAppearanceCustomization for NSForm {}
68);
69
70#[cfg(all(
71 feature = "NSControl",
72 feature = "NSMatrix",
73 feature = "NSResponder",
74 feature = "NSView"
75))]
76extern_conformance!(
77 unsafe impl NSCoding for NSForm {}
78);
79
80#[cfg(all(
81 feature = "NSControl",
82 feature = "NSDragging",
83 feature = "NSMatrix",
84 feature = "NSResponder",
85 feature = "NSView"
86))]
87extern_conformance!(
88 unsafe impl NSDraggingDestination for NSForm {}
89);
90
91#[cfg(all(
92 feature = "NSControl",
93 feature = "NSMatrix",
94 feature = "NSResponder",
95 feature = "NSView"
96))]
97extern_conformance!(
98 unsafe impl NSObjectProtocol for NSForm {}
99);
100
101#[cfg(all(
102 feature = "NSControl",
103 feature = "NSMatrix",
104 feature = "NSResponder",
105 feature = "NSUserInterfaceItemIdentification",
106 feature = "NSView"
107))]
108extern_conformance!(
109 unsafe impl NSUserInterfaceItemIdentification for NSForm {}
110);
111
112#[cfg(all(
113 feature = "NSControl",
114 feature = "NSMatrix",
115 feature = "NSResponder",
116 feature = "NSUserInterfaceValidation",
117 feature = "NSView"
118))]
119extern_conformance!(
120 unsafe impl NSUserInterfaceValidations for NSForm {}
121);
122
123#[cfg(all(
124 feature = "NSControl",
125 feature = "NSMatrix",
126 feature = "NSResponder",
127 feature = "NSView"
128))]
129extern_conformance!(
130 unsafe impl NSViewToolTipOwner for NSForm {}
131);
132
133#[cfg(all(
134 feature = "NSControl",
135 feature = "NSMatrix",
136 feature = "NSResponder",
137 feature = "NSView"
138))]
139impl NSForm {
140 extern_methods!(
141 #[unsafe(method(indexOfSelectedItem))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn indexOfSelectedItem(&self) -> NSInteger;
144
145 #[cfg(feature = "objc2-core-foundation")]
146 #[unsafe(method(setEntryWidth:))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn setEntryWidth(&self, width: CGFloat);
149
150 #[cfg(feature = "objc2-core-foundation")]
151 #[unsafe(method(setInterlineSpacing:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn setInterlineSpacing(&self, spacing: CGFloat);
154
155 #[unsafe(method(setBordered:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn setBordered(&self, flag: bool);
158
159 #[unsafe(method(setBezeled:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn setBezeled(&self, flag: bool);
162
163 #[cfg(feature = "NSText")]
164 #[unsafe(method(setTitleAlignment:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn setTitleAlignment(&self, mode: NSTextAlignment);
167
168 #[cfg(feature = "NSText")]
169 #[unsafe(method(setTextAlignment:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn setTextAlignment(&self, mode: NSTextAlignment);
172
173 #[cfg(feature = "NSFont")]
174 #[unsafe(method(setTitleFont:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn setTitleFont(&self, font_obj: &NSFont);
177
178 #[cfg(feature = "NSFont")]
179 #[unsafe(method(setTextFont:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setTextFont(&self, font_obj: &NSFont);
182
183 #[unsafe(method(cellAtIndex:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn cellAtIndex(&self, index: NSInteger) -> Option<Retained<AnyObject>>;
186
187 #[unsafe(method(drawCellAtIndex:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn drawCellAtIndex(&self, index: NSInteger);
190
191 #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
192 #[unsafe(method(addEntry:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn addEntry(&self, title: &NSString) -> Retained<NSFormCell>;
195
196 #[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
197 #[unsafe(method(insertEntry:atIndex:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn insertEntry_atIndex(
200 &self,
201 title: &NSString,
202 index: NSInteger,
203 ) -> Option<Retained<NSFormCell>>;
204
205 #[unsafe(method(removeEntryAtIndex:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn removeEntryAtIndex(&self, index: NSInteger);
208
209 #[unsafe(method(indexOfCellWithTag:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn indexOfCellWithTag(&self, tag: NSInteger) -> NSInteger;
212
213 #[unsafe(method(selectTextAtIndex:))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn selectTextAtIndex(&self, index: NSInteger);
216
217 #[unsafe(method(setFrameSize:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn setFrameSize(&self, new_size: NSSize);
220
221 #[cfg(feature = "NSText")]
222 #[unsafe(method(setTitleBaseWritingDirection:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn setTitleBaseWritingDirection(&self, writing_direction: NSWritingDirection);
225
226 #[cfg(feature = "NSText")]
227 #[unsafe(method(setTextBaseWritingDirection:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn setTextBaseWritingDirection(&self, writing_direction: NSWritingDirection);
230
231 #[cfg(feature = "objc2-core-foundation")]
232 #[unsafe(method(setPreferredTextFieldWidth:))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn setPreferredTextFieldWidth(&self, preferred_width: CGFloat);
235
236 #[cfg(feature = "objc2-core-foundation")]
237 #[unsafe(method(preferredTextFieldWidth))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn preferredTextFieldWidth(&self) -> CGFloat;
240 );
241}
242
243#[cfg(all(
245 feature = "NSControl",
246 feature = "NSMatrix",
247 feature = "NSResponder",
248 feature = "NSView"
249))]
250impl NSForm {
251 extern_methods!(
252 #[unsafe(method(initWithFrame:))]
253 #[unsafe(method_family = init)]
254 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
255
256 #[cfg(feature = "NSCell")]
257 #[unsafe(method(initWithFrame:mode:prototype:numberOfRows:numberOfColumns:))]
258 #[unsafe(method_family = init)]
259 pub unsafe fn initWithFrame_mode_prototype_numberOfRows_numberOfColumns(
260 this: Allocated<Self>,
261 frame_rect: NSRect,
262 mode: NSMatrixMode,
263 cell: &NSCell,
264 rows_high: NSInteger,
265 cols_wide: NSInteger,
266 ) -> Retained<Self>;
267
268 #[unsafe(method(initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:))]
269 #[unsafe(method_family = init)]
270 pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
271 this: Allocated<Self>,
272 frame_rect: NSRect,
273 mode: NSMatrixMode,
274 factory_id: Option<&AnyClass>,
275 rows_high: NSInteger,
276 cols_wide: NSInteger,
277 ) -> Retained<Self>;
278 );
279}
280
281#[cfg(all(
283 feature = "NSControl",
284 feature = "NSMatrix",
285 feature = "NSResponder",
286 feature = "NSView"
287))]
288impl NSForm {
289 extern_methods!(
290 #[unsafe(method(initWithCoder:))]
291 #[unsafe(method_family = init)]
292 pub unsafe fn initWithCoder(
293 this: Allocated<Self>,
294 coder: &NSCoder,
295 ) -> Option<Retained<Self>>;
296 );
297}
298
299#[cfg(all(
301 feature = "NSControl",
302 feature = "NSMatrix",
303 feature = "NSResponder",
304 feature = "NSView"
305))]
306impl NSForm {
307 extern_methods!(
308 #[unsafe(method(init))]
309 #[unsafe(method_family = init)]
310 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
311 );
312}
313
314#[cfg(all(
316 feature = "NSControl",
317 feature = "NSMatrix",
318 feature = "NSResponder",
319 feature = "NSView"
320))]
321impl NSForm {
322 extern_methods!(
323 #[unsafe(method(new))]
324 #[unsafe(method_family = new)]
325 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
326 );
327}