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 fn indexOfSelectedItem(&self) -> NSInteger;
144
145 #[cfg(feature = "objc2-core-foundation")]
146 #[unsafe(method(setEntryWidth:))]
147 #[unsafe(method_family = none)]
148 pub fn setEntryWidth(&self, width: CGFloat);
149
150 #[cfg(feature = "objc2-core-foundation")]
151 #[unsafe(method(setInterlineSpacing:))]
152 #[unsafe(method_family = none)]
153 pub fn setInterlineSpacing(&self, spacing: CGFloat);
154
155 #[unsafe(method(setBordered:))]
156 #[unsafe(method_family = none)]
157 pub fn setBordered(&self, flag: bool);
158
159 #[unsafe(method(setBezeled:))]
160 #[unsafe(method_family = none)]
161 pub fn setBezeled(&self, flag: bool);
162
163 #[cfg(feature = "NSText")]
164 #[unsafe(method(setTitleAlignment:))]
165 #[unsafe(method_family = none)]
166 pub fn setTitleAlignment(&self, mode: NSTextAlignment);
167
168 #[cfg(feature = "NSText")]
169 #[unsafe(method(setTextAlignment:))]
170 #[unsafe(method_family = none)]
171 pub fn setTextAlignment(&self, mode: NSTextAlignment);
172
173 #[cfg(feature = "NSFont")]
174 #[unsafe(method(setTitleFont:))]
175 #[unsafe(method_family = none)]
176 pub fn setTitleFont(&self, font_obj: &NSFont);
177
178 #[cfg(feature = "NSFont")]
179 #[unsafe(method(setTextFont:))]
180 #[unsafe(method_family = none)]
181 pub fn setTextFont(&self, font_obj: &NSFont);
182
183 #[unsafe(method(cellAtIndex:))]
184 #[unsafe(method_family = none)]
185 pub fn cellAtIndex(&self, index: NSInteger) -> Option<Retained<AnyObject>>;
186
187 #[unsafe(method(drawCellAtIndex:))]
188 #[unsafe(method_family = none)]
189 pub 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 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 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 fn removeEntryAtIndex(&self, index: NSInteger);
208
209 #[unsafe(method(indexOfCellWithTag:))]
210 #[unsafe(method_family = none)]
211 pub fn indexOfCellWithTag(&self, tag: NSInteger) -> NSInteger;
212
213 #[unsafe(method(selectTextAtIndex:))]
214 #[unsafe(method_family = none)]
215 pub fn selectTextAtIndex(&self, index: NSInteger);
216
217 #[unsafe(method(setFrameSize:))]
218 #[unsafe(method_family = none)]
219 pub fn setFrameSize(&self, new_size: NSSize);
220
221 #[cfg(feature = "NSText")]
222 #[unsafe(method(setTitleBaseWritingDirection:))]
223 #[unsafe(method_family = none)]
224 pub fn setTitleBaseWritingDirection(&self, writing_direction: NSWritingDirection);
225
226 #[cfg(feature = "NSText")]
227 #[unsafe(method(setTextBaseWritingDirection:))]
228 #[unsafe(method_family = none)]
229 pub fn setTextBaseWritingDirection(&self, writing_direction: NSWritingDirection);
230
231 #[cfg(feature = "objc2-core-foundation")]
232 #[unsafe(method(setPreferredTextFieldWidth:))]
233 #[unsafe(method_family = none)]
234 pub fn setPreferredTextFieldWidth(&self, preferred_width: CGFloat);
235
236 #[cfg(feature = "objc2-core-foundation")]
237 #[unsafe(method(preferredTextFieldWidth))]
238 #[unsafe(method_family = none)]
239 pub 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 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 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:))]
272 #[unsafe(method_family = init)]
273 pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
274 this: Allocated<Self>,
275 frame_rect: NSRect,
276 mode: NSMatrixMode,
277 factory_id: Option<&AnyClass>,
278 rows_high: NSInteger,
279 cols_wide: NSInteger,
280 ) -> Retained<Self>;
281 );
282}
283
284#[cfg(all(
286 feature = "NSControl",
287 feature = "NSMatrix",
288 feature = "NSResponder",
289 feature = "NSView"
290))]
291impl NSForm {
292 extern_methods!(
293 #[unsafe(method(initWithCoder:))]
297 #[unsafe(method_family = init)]
298 pub unsafe fn initWithCoder(
299 this: Allocated<Self>,
300 coder: &NSCoder,
301 ) -> Option<Retained<Self>>;
302 );
303}
304
305#[cfg(all(
307 feature = "NSControl",
308 feature = "NSMatrix",
309 feature = "NSResponder",
310 feature = "NSView"
311))]
312impl NSForm {
313 extern_methods!(
314 #[unsafe(method(init))]
315 #[unsafe(method_family = init)]
316 pub fn init(this: Allocated<Self>) -> Retained<Self>;
317 );
318}
319
320#[cfg(all(
322 feature = "NSControl",
323 feature = "NSMatrix",
324 feature = "NSResponder",
325 feature = "NSView"
326))]
327impl NSForm {
328 extern_methods!(
329 #[unsafe(method(new))]
330 #[unsafe(method_family = new)]
331 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
332 );
333}