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 fn boxType(&self) -> NSBoxType;
130
131 #[unsafe(method(setBoxType:))]
133 #[unsafe(method_family = none)]
134 pub fn setBoxType(&self, box_type: NSBoxType);
135
136 #[unsafe(method(titlePosition))]
137 #[unsafe(method_family = none)]
138 pub fn titlePosition(&self) -> NSTitlePosition;
139
140 #[unsafe(method(setTitlePosition:))]
142 #[unsafe(method_family = none)]
143 pub fn setTitlePosition(&self, title_position: NSTitlePosition);
144
145 #[unsafe(method(title))]
146 #[unsafe(method_family = none)]
147 pub fn title(&self) -> Retained<NSString>;
148
149 #[unsafe(method(setTitle:))]
153 #[unsafe(method_family = none)]
154 pub fn setTitle(&self, title: &NSString);
155
156 #[cfg(feature = "NSFont")]
157 #[unsafe(method(titleFont))]
158 #[unsafe(method_family = none)]
159 pub fn titleFont(&self) -> Retained<NSFont>;
160
161 #[cfg(feature = "NSFont")]
162 #[unsafe(method(setTitleFont:))]
164 #[unsafe(method_family = none)]
165 pub fn setTitleFont(&self, title_font: &NSFont);
166
167 #[unsafe(method(borderRect))]
168 #[unsafe(method_family = none)]
169 pub fn borderRect(&self) -> NSRect;
170
171 #[unsafe(method(titleRect))]
172 #[unsafe(method_family = none)]
173 pub fn titleRect(&self) -> NSRect;
174
175 #[unsafe(method(titleCell))]
176 #[unsafe(method_family = none)]
177 pub fn titleCell(&self) -> Retained<AnyObject>;
178
179 #[unsafe(method(contentViewMargins))]
180 #[unsafe(method_family = none)]
181 pub fn contentViewMargins(&self) -> NSSize;
182
183 #[unsafe(method(setContentViewMargins:))]
185 #[unsafe(method_family = none)]
186 pub fn setContentViewMargins(&self, content_view_margins: NSSize);
187
188 #[unsafe(method(sizeToFit))]
189 #[unsafe(method_family = none)]
190 pub fn sizeToFit(&self);
191
192 #[unsafe(method(setFrameFromContentFrame:))]
193 #[unsafe(method_family = none)]
194 pub fn setFrameFromContentFrame(&self, content_frame: NSRect);
195
196 #[unsafe(method(contentView))]
197 #[unsafe(method_family = none)]
198 pub fn contentView(&self) -> Option<Retained<NSView>>;
199
200 #[unsafe(method(setContentView:))]
202 #[unsafe(method_family = none)]
203 pub fn setContentView(&self, content_view: Option<&NSView>);
204
205 #[unsafe(method(isTransparent))]
206 #[unsafe(method_family = none)]
207 pub fn isTransparent(&self) -> bool;
208
209 #[unsafe(method(setTransparent:))]
211 #[unsafe(method_family = none)]
212 pub fn setTransparent(&self, transparent: bool);
213
214 #[cfg(feature = "objc2-core-foundation")]
215 #[unsafe(method(borderWidth))]
216 #[unsafe(method_family = none)]
217 pub fn borderWidth(&self) -> CGFloat;
218
219 #[cfg(feature = "objc2-core-foundation")]
220 #[unsafe(method(setBorderWidth:))]
222 #[unsafe(method_family = none)]
223 pub fn setBorderWidth(&self, border_width: CGFloat);
224
225 #[cfg(feature = "objc2-core-foundation")]
226 #[unsafe(method(cornerRadius))]
227 #[unsafe(method_family = none)]
228 pub fn cornerRadius(&self) -> CGFloat;
229
230 #[cfg(feature = "objc2-core-foundation")]
231 #[unsafe(method(setCornerRadius:))]
233 #[unsafe(method_family = none)]
234 pub fn setCornerRadius(&self, corner_radius: CGFloat);
235
236 #[cfg(feature = "NSColor")]
237 #[unsafe(method(borderColor))]
238 #[unsafe(method_family = none)]
239 pub fn borderColor(&self) -> Retained<NSColor>;
240
241 #[cfg(feature = "NSColor")]
242 #[unsafe(method(setBorderColor:))]
246 #[unsafe(method_family = none)]
247 pub fn setBorderColor(&self, border_color: &NSColor);
248
249 #[cfg(feature = "NSColor")]
250 #[unsafe(method(fillColor))]
251 #[unsafe(method_family = none)]
252 pub fn fillColor(&self) -> Retained<NSColor>;
253
254 #[cfg(feature = "NSColor")]
255 #[unsafe(method(setFillColor:))]
259 #[unsafe(method_family = none)]
260 pub fn setFillColor(&self, fill_color: &NSColor);
261 );
262}
263
264#[cfg(all(feature = "NSResponder", feature = "NSView"))]
266impl NSBox {
267 extern_methods!(
268 #[unsafe(method(initWithFrame:))]
269 #[unsafe(method_family = init)]
270 pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
271
272 #[unsafe(method(initWithCoder:))]
276 #[unsafe(method_family = init)]
277 pub unsafe fn initWithCoder(
278 this: Allocated<Self>,
279 coder: &NSCoder,
280 ) -> Option<Retained<Self>>;
281 );
282}
283
284#[cfg(all(feature = "NSResponder", feature = "NSView"))]
286impl NSBox {
287 extern_methods!(
288 #[unsafe(method(init))]
289 #[unsafe(method_family = init)]
290 pub fn init(this: Allocated<Self>) -> Retained<Self>;
291 );
292}
293
294#[cfg(all(feature = "NSResponder", feature = "NSView"))]
296impl NSBox {
297 extern_methods!(
298 #[unsafe(method(new))]
299 #[unsafe(method_family = new)]
300 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
301 );
302}
303
304#[cfg(all(feature = "NSResponder", feature = "NSView"))]
306impl NSBox {
307 extern_methods!(
308 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
309 #[unsafe(method(borderType))]
310 #[unsafe(method_family = none)]
311 pub fn borderType(&self) -> NSBorderType;
312
313 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
315 #[unsafe(method(setBorderType:))]
316 #[unsafe(method_family = none)]
317 pub fn setBorderType(&self, border_type: NSBorderType);
318
319 #[deprecated]
323 #[unsafe(method(setTitleWithMnemonic:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
326 );
327}
328
329#[deprecated]
331pub static NSBoxSecondary: NSBoxType = NSBoxType(1);
332
333#[deprecated = "NSBoxOldStyle is discouraged in modern application design. It should be replaced with either NSBoxPrimary or NSBoxCustom."]
335pub static NSBoxOldStyle: NSBoxType = NSBoxType(3);