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