objc2_app_kit/generated/
NSBox.rs1use 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#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTitlePosition(pub NSUInteger);
17impl NSTitlePosition {
18 #[doc(alias = "NSNoTitle")]
19 pub const NoTitle: Self = Self(0);
20 #[doc(alias = "NSAboveTop")]
21 pub const AboveTop: Self = Self(1);
22 #[doc(alias = "NSAtTop")]
23 pub const AtTop: Self = Self(2);
24 #[doc(alias = "NSBelowTop")]
25 pub const BelowTop: Self = Self(3);
26 #[doc(alias = "NSAboveBottom")]
27 pub const AboveBottom: Self = Self(4);
28 #[doc(alias = "NSAtBottom")]
29 pub const AtBottom: Self = Self(5);
30 #[doc(alias = "NSBelowBottom")]
31 pub const BelowBottom: Self = Self(6);
32}
33
34unsafe impl Encode for NSTitlePosition {
35 const ENCODING: Encoding = NSUInteger::ENCODING;
36}
37
38unsafe impl RefEncode for NSTitlePosition {
39 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct NSBoxType(pub NSUInteger);
47impl NSBoxType {
48 #[doc(alias = "NSBoxPrimary")]
49 pub const Primary: Self = Self(0);
50 #[doc(alias = "NSBoxSeparator")]
51 pub const Separator: Self = Self(2);
52 #[doc(alias = "NSBoxCustom")]
53 pub const Custom: Self = Self(4);
54}
55
56unsafe impl Encode for NSBoxType {
57 const ENCODING: Encoding = NSUInteger::ENCODING;
58}
59
60unsafe impl RefEncode for NSBoxType {
61 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64extern_class!(
65 #[unsafe(super(NSView, NSResponder, NSObject))]
67 #[derive(Debug, PartialEq, Eq, Hash)]
68 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
69 pub struct NSBox;
70);
71
72#[cfg(all(
73 feature = "NSAccessibilityProtocols",
74 feature = "NSResponder",
75 feature = "NSView"
76))]
77extern_conformance!(
78 unsafe impl NSAccessibility for NSBox {}
79);
80
81#[cfg(all(
82 feature = "NSAccessibilityProtocols",
83 feature = "NSResponder",
84 feature = "NSView"
85))]
86extern_conformance!(
87 unsafe impl NSAccessibilityElementProtocol for NSBox {}
88);
89
90#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
91extern_conformance!(
92 unsafe impl NSAnimatablePropertyContainer for NSBox {}
93);
94
95#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
96extern_conformance!(
97 unsafe impl NSAppearanceCustomization for NSBox {}
98);
99
100#[cfg(all(feature = "NSResponder", feature = "NSView"))]
101extern_conformance!(
102 unsafe impl NSCoding for NSBox {}
103);
104
105#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
106extern_conformance!(
107 unsafe impl NSDraggingDestination for NSBox {}
108);
109
110#[cfg(all(feature = "NSResponder", feature = "NSView"))]
111extern_conformance!(
112 unsafe impl NSObjectProtocol for NSBox {}
113);
114
115#[cfg(all(
116 feature = "NSResponder",
117 feature = "NSUserInterfaceItemIdentification",
118 feature = "NSView"
119))]
120extern_conformance!(
121 unsafe impl NSUserInterfaceItemIdentification for NSBox {}
122);
123
124#[cfg(all(feature = "NSResponder", feature = "NSView"))]
125impl NSBox {
126 extern_methods!(
127 #[unsafe(method(boxType))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn boxType(&self) -> NSBoxType;
130
131 #[unsafe(method(setBoxType:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn setBoxType(&self, box_type: NSBoxType);
135
136 #[unsafe(method(titlePosition))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn titlePosition(&self) -> NSTitlePosition;
139
140 #[unsafe(method(setTitlePosition:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn setTitlePosition(&self, title_position: NSTitlePosition);
144
145 #[unsafe(method(title))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn title(&self) -> Retained<NSString>;
148
149 #[unsafe(method(setTitle:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn setTitle(&self, title: &NSString);
153
154 #[cfg(feature = "NSFont")]
155 #[unsafe(method(titleFont))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn titleFont(&self) -> Retained<NSFont>;
158
159 #[cfg(feature = "NSFont")]
160 #[unsafe(method(setTitleFont:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn setTitleFont(&self, title_font: &NSFont);
164
165 #[unsafe(method(borderRect))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn borderRect(&self) -> NSRect;
168
169 #[unsafe(method(titleRect))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn titleRect(&self) -> NSRect;
172
173 #[unsafe(method(titleCell))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn titleCell(&self) -> Retained<AnyObject>;
176
177 #[unsafe(method(contentViewMargins))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn contentViewMargins(&self) -> NSSize;
180
181 #[unsafe(method(setContentViewMargins:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setContentViewMargins(&self, content_view_margins: NSSize);
185
186 #[unsafe(method(sizeToFit))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn sizeToFit(&self);
189
190 #[unsafe(method(setFrameFromContentFrame:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn setFrameFromContentFrame(&self, content_frame: NSRect);
193
194 #[unsafe(method(contentView))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
197
198 #[unsafe(method(setContentView:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
202
203 #[unsafe(method(isTransparent))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn isTransparent(&self) -> bool;
206
207 #[unsafe(method(setTransparent:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn setTransparent(&self, transparent: bool);
211
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(borderWidth))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn borderWidth(&self) -> CGFloat;
216
217 #[cfg(feature = "objc2-core-foundation")]
218 #[unsafe(method(setBorderWidth:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setBorderWidth(&self, border_width: CGFloat);
222
223 #[cfg(feature = "objc2-core-foundation")]
224 #[unsafe(method(cornerRadius))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn cornerRadius(&self) -> CGFloat;
227
228 #[cfg(feature = "objc2-core-foundation")]
229 #[unsafe(method(setCornerRadius:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setCornerRadius(&self, corner_radius: CGFloat);
233
234 #[cfg(feature = "NSColor")]
235 #[unsafe(method(borderColor))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn borderColor(&self) -> Retained<NSColor>;
238
239 #[cfg(feature = "NSColor")]
240 #[unsafe(method(setBorderColor:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn setBorderColor(&self, border_color: &NSColor);
244
245 #[cfg(feature = "NSColor")]
246 #[unsafe(method(fillColor))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn fillColor(&self) -> Retained<NSColor>;
249
250 #[cfg(feature = "NSColor")]
251 #[unsafe(method(setFillColor:))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn setFillColor(&self, fill_color: &NSColor);
255 );
256}
257
258#[cfg(all(feature = "NSResponder", feature = "NSView"))]
260impl NSBox {
261 extern_methods!(
262 #[unsafe(method(initWithFrame:))]
263 #[unsafe(method_family = init)]
264 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
265
266 #[unsafe(method(initWithCoder:))]
267 #[unsafe(method_family = init)]
268 pub unsafe fn initWithCoder(
269 this: Allocated<Self>,
270 coder: &NSCoder,
271 ) -> Option<Retained<Self>>;
272 );
273}
274
275#[cfg(all(feature = "NSResponder", feature = "NSView"))]
277impl NSBox {
278 extern_methods!(
279 #[unsafe(method(init))]
280 #[unsafe(method_family = init)]
281 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
282 );
283}
284
285#[cfg(all(feature = "NSResponder", feature = "NSView"))]
287impl NSBox {
288 extern_methods!(
289 #[unsafe(method(new))]
290 #[unsafe(method_family = new)]
291 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
292 );
293}
294
295#[cfg(all(feature = "NSResponder", feature = "NSView"))]
297impl NSBox {
298 extern_methods!(
299 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
300 #[unsafe(method(borderType))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn borderType(&self) -> NSBorderType;
303
304 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
306 #[unsafe(method(setBorderType:))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn setBorderType(&self, border_type: NSBorderType);
309
310 #[deprecated]
311 #[unsafe(method(setTitleWithMnemonic:))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
314 );
315}
316
317pub static NSBoxSecondary: NSBoxType = NSBoxType(1);
319
320pub static NSBoxOldStyle: NSBoxType = NSBoxType(3);