objc2_app_kit/generated/
NSPanel.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspanel?language=objc)
12    #[unsafe(super(NSWindow, NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
15    pub struct NSPanel;
16);
17
18#[cfg(all(
19    feature = "NSAccessibilityProtocols",
20    feature = "NSResponder",
21    feature = "NSWindow"
22))]
23extern_conformance!(
24    unsafe impl NSAccessibility for NSPanel {}
25);
26
27#[cfg(all(
28    feature = "NSAccessibilityProtocols",
29    feature = "NSResponder",
30    feature = "NSWindow"
31))]
32extern_conformance!(
33    unsafe impl NSAccessibilityElementProtocol for NSPanel {}
34);
35
36#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSWindow"))]
37extern_conformance!(
38    unsafe impl NSAnimatablePropertyContainer for NSPanel {}
39);
40
41#[cfg(all(
42    feature = "NSAppearance",
43    feature = "NSResponder",
44    feature = "NSWindow"
45))]
46extern_conformance!(
47    unsafe impl NSAppearanceCustomization for NSPanel {}
48);
49
50#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
51extern_conformance!(
52    unsafe impl NSCoding for NSPanel {}
53);
54
55#[cfg(all(feature = "NSMenu", feature = "NSResponder", feature = "NSWindow"))]
56extern_conformance!(
57    unsafe impl NSMenuItemValidation for NSPanel {}
58);
59
60#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
61extern_conformance!(
62    unsafe impl NSObjectProtocol for NSPanel {}
63);
64
65#[cfg(all(
66    feature = "NSResponder",
67    feature = "NSUserInterfaceItemIdentification",
68    feature = "NSWindow"
69))]
70extern_conformance!(
71    unsafe impl NSUserInterfaceItemIdentification for NSPanel {}
72);
73
74#[cfg(all(
75    feature = "NSResponder",
76    feature = "NSUserInterfaceValidation",
77    feature = "NSWindow"
78))]
79extern_conformance!(
80    unsafe impl NSUserInterfaceValidations for NSPanel {}
81);
82
83#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
84impl NSPanel {
85    extern_methods!(
86        #[unsafe(method(isFloatingPanel))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn isFloatingPanel(&self) -> bool;
89
90        /// Setter for [`isFloatingPanel`][Self::isFloatingPanel].
91        #[unsafe(method(setFloatingPanel:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setFloatingPanel(&self, floating_panel: bool);
94
95        #[unsafe(method(becomesKeyOnlyIfNeeded))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn becomesKeyOnlyIfNeeded(&self) -> bool;
98
99        /// Setter for [`becomesKeyOnlyIfNeeded`][Self::becomesKeyOnlyIfNeeded].
100        #[unsafe(method(setBecomesKeyOnlyIfNeeded:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setBecomesKeyOnlyIfNeeded(&self, becomes_key_only_if_needed: bool);
103
104        #[unsafe(method(worksWhenModal))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn worksWhenModal(&self) -> bool;
107
108        /// Setter for [`worksWhenModal`][Self::worksWhenModal].
109        #[unsafe(method(setWorksWhenModal:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn setWorksWhenModal(&self, works_when_modal: bool);
112    );
113}
114
115/// Methods declared on superclass `NSWindow`.
116#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
117impl NSPanel {
118    extern_methods!(
119        #[cfg(feature = "NSGraphics")]
120        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
121        #[unsafe(method_family = init)]
122        pub unsafe fn initWithContentRect_styleMask_backing_defer(
123            this: Allocated<Self>,
124            content_rect: NSRect,
125            style: NSWindowStyleMask,
126            backing_store_type: NSBackingStoreType,
127            flag: bool,
128        ) -> Retained<Self>;
129
130        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
131        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
134            this: Allocated<Self>,
135            content_rect: NSRect,
136            style: NSWindowStyleMask,
137            backing_store_type: NSBackingStoreType,
138            flag: bool,
139            screen: Option<&NSScreen>,
140        ) -> Retained<Self>;
141
142        #[unsafe(method(initWithCoder:))]
143        #[unsafe(method_family = init)]
144        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
145
146        #[cfg(feature = "NSViewController")]
147        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
148        #[unsafe(method(windowWithContentViewController:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn windowWithContentViewController(
151            content_view_controller: &NSViewController,
152        ) -> Retained<Self>;
153    );
154}
155
156/// Methods declared on superclass `NSResponder`.
157#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
158impl NSPanel {
159    extern_methods!(
160        #[unsafe(method(init))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163    );
164}
165
166/// Methods declared on superclass `NSObject`.
167#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
168impl NSPanel {
169    extern_methods!(
170        #[unsafe(method(new))]
171        #[unsafe(method_family = new)]
172        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
173    );
174}
175
176extern "C-unwind" {
177    #[deprecated = "Use NSAlert instead"]
178    pub fn NSReleaseAlertPanel(panel: Option<&AnyObject>);
179}
180
181/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertdefaultreturn?language=objc)
182#[deprecated = "Use NSAlertFirstButtonReturn with an NSAlert presentation instead"]
183pub const NSAlertDefaultReturn: c_int = 1;
184/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertalternatereturn?language=objc)
185#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
186pub const NSAlertAlternateReturn: c_int = 0;
187/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertotherreturn?language=objc)
188#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
189pub const NSAlertOtherReturn: c_int = -1;
190/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalerterrorreturn?language=objc)
191#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
192pub const NSAlertErrorReturn: c_int = -2;